From a01d2ede1d889d6c1a9fc37b613a6a5487f6db3e Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 26 May 2022 00:14:33 +0200 Subject: [PATCH 01/13] chore(deps): update dependency com.google.cloud:google-cloud-datastream to v1 (#171) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-datastream](https://togithub.com/googleapis/java-datastream) | `0.4.4` -> `1.0.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-datastream/1.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-datastream/1.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-datastream/1.0.0/compatibility-slim/0.4.4)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-datastream/1.0.0/confidence-slim/0.4.4)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. ⚠ **Warning**: custom changes will be lost. --- This PR has been generated by [Mend Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-datastream). --- README.md | 6 +++--- samples/install-without-bom/pom.xml | 2 +- samples/snapshot/pom.xml | 2 +- samples/snippets/pom.xml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cf97903e..565b7094 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you are using Maven, add this to your pom.xml file: com.google.cloud google-cloud-datastream - 0.4.4 + 1.0.0 ``` @@ -27,13 +27,13 @@ If you are using Maven, add this to your pom.xml file: If you are using Gradle without BOM, add this to your dependencies ```Groovy -implementation 'com.google.cloud:google-cloud-datastream:0.4.4' +implementation 'com.google.cloud:google-cloud-datastream:1.0.0' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-datastream" % "0.4.4" +libraryDependencies += "com.google.cloud" % "google-cloud-datastream" % "1.0.0" ``` ## Authentication diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 2c1106b9..ef2aee39 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -29,7 +29,7 @@ com.google.cloud google-cloud-datastream - 0.4.4 + 1.0.0 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 54e5081a..c0f15a55 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-datastream - 0.4.4 + 1.0.0 diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index ea4a9451..938a6c40 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-datastream - 0.4.4 + 1.0.0 From 1a34d9c8128c35582a0db1abfd9c647287960667 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 27 May 2022 04:08:32 +0000 Subject: [PATCH 02/13] chore(deps): upgrade gapic-generator-java to 2.8.0 and update gax-java to 2.18.1 (#168) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 450543911 Source-Link: https://github.com/googleapis/googleapis/commit/55283447ab72f10b6c2571d770af0498b593e84f Source-Link: https://github.com/googleapis/googleapis-gen/commit/9f6775cab1958982b88967a43e5e806af0f135db Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOWY2Nzc1Y2FiMTk1ODk4MmI4ODk2N2E0M2U1ZTgwNmFmMGYxMzVkYiJ9 --- .../java/com/google/cloud/datastream/v1/DatastreamClient.java | 4 ---- .../cloud/datastream/v1/stub/DatastreamStubSettings.java | 1 - .../google/cloud/datastream/v1alpha1/DatastreamClient.java | 3 --- .../datastream/v1alpha1/stub/DatastreamStubSettings.java | 1 - 4 files changed, 9 deletions(-) diff --git a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/DatastreamClient.java b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/DatastreamClient.java index 72e03219..990b4206 100644 --- a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/DatastreamClient.java +++ b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/DatastreamClient.java @@ -18,7 +18,6 @@ import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutures; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; @@ -133,7 +132,6 @@ public static final DatastreamClient create(DatastreamSettings settings) throws * Constructs an instance of DatastreamClient, using the given stub for making calls. This is for * advanced usage - prefer using create(DatastreamSettings). */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final DatastreamClient create(DatastreamStub stub) { return new DatastreamClient(stub); } @@ -148,7 +146,6 @@ protected DatastreamClient(DatastreamSettings settings) throws IOException { this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected DatastreamClient(DatastreamStub stub) { this.settings = null; this.stub = stub; @@ -159,7 +156,6 @@ public final DatastreamSettings getSettings() { return settings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public DatastreamStub getStub() { return stub; } diff --git a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/stub/DatastreamStubSettings.java b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/stub/DatastreamStubSettings.java index ca567ea6..3598bbd2 100644 --- a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/stub/DatastreamStubSettings.java +++ b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/stub/DatastreamStubSettings.java @@ -857,7 +857,6 @@ public UnaryCallSettings getLocationSettings() { return getLocationSettings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public DatastreamStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() diff --git a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/DatastreamClient.java b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/DatastreamClient.java index d8566180..42936600 100644 --- a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/DatastreamClient.java +++ b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/DatastreamClient.java @@ -130,7 +130,6 @@ public static final DatastreamClient create(DatastreamSettings settings) throws * Constructs an instance of DatastreamClient, using the given stub for making calls. This is for * advanced usage - prefer using create(DatastreamSettings). */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final DatastreamClient create(DatastreamStub stub) { return new DatastreamClient(stub); } @@ -145,7 +144,6 @@ protected DatastreamClient(DatastreamSettings settings) throws IOException { this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected DatastreamClient(DatastreamStub stub) { this.settings = null; this.stub = stub; @@ -156,7 +154,6 @@ public final DatastreamSettings getSettings() { return settings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public DatastreamStub getStub() { return stub; } diff --git a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/stub/DatastreamStubSettings.java b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/stub/DatastreamStubSettings.java index ea704e95..1620f180 100644 --- a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/stub/DatastreamStubSettings.java +++ b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/stub/DatastreamStubSettings.java @@ -691,7 +691,6 @@ public UnaryCallSettings deleteRouteSettings() { return deleteRouteOperationSettings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public DatastreamStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() From c12b5003e61c698b0535b1e7f07abbe555dbba27 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 13 Jun 2022 19:06:18 +0200 Subject: [PATCH 03/13] build(deps): update dependency com.google.cloud:google-cloud-shared-config to v1.5.0 (#174) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-shared-config](https://togithub.com/googleapis/java-shared-config) | `1.4.0` -> `1.5.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-config/1.5.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-config/1.5.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-config/1.5.0/compatibility-slim/1.4.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-config/1.5.0/confidence-slim/1.4.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
googleapis/java-shared-config ### [`v1.5.0`](https://togithub.com/googleapis/java-shared-config/blob/HEAD/CHANGELOG.md#​150-httpsgithubcomgoogleapisjava-shared-configcomparev140v150-2022-06-10) [Compare Source](https://togithub.com/googleapis/java-shared-config/compare/v1.4.0...v1.5.0) ##### Features - add build scripts for native image testing in Java 17 ([#​1440](https://togithub.com/googleapis/java-shared-config/issues/1440)) ([#​475](https://togithub.com/googleapis/java-shared-config/issues/475)) ([e4dfc1b](https://togithub.com/googleapis/java-shared-config/commit/e4dfc1ba29295158c78c8fcf94467d2a6a33538a)) - to produce Java 8 compatible bytecode when using JDK 9+ ([2468276](https://togithub.com/googleapis/java-shared-config/commit/2468276145cdfe1ca911b52f765e026e77661a09)) ##### Dependencies - update surefire.version to v3.0.0-m7 ([bbfe663](https://togithub.com/googleapis/java-shared-config/commit/bbfe66393af3e49612c9c1e4334ba39c133ea1d0))
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-datastream). --- google-cloud-datastream-bom/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/google-cloud-datastream-bom/pom.xml b/google-cloud-datastream-bom/pom.xml index 31a3f35c..0a887e0e 100644 --- a/google-cloud-datastream-bom/pom.xml +++ b/google-cloud-datastream-bom/pom.xml @@ -8,7 +8,7 @@ com.google.cloud google-cloud-shared-config - 1.4.0 + 1.5.0 Google Datastream BOM diff --git a/pom.xml b/pom.xml index 7c3dc5fe..7acfbe1f 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ com.google.cloud google-cloud-shared-config - 1.4.0 + 1.5.0 From 885880225b9ec092f7975ddf045169278f1e0c8c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 13 Jun 2022 20:12:16 +0000 Subject: [PATCH 04/13] chore: Integrate new gapic-generator-java and rules_gapic (#172) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 454027580 Source-Link: https://github.com/googleapis/googleapis/commit/1b222777baa702e7135610355706570ed2b56318 Source-Link: https://github.com/googleapis/googleapis-gen/commit/e04cea20d0d12eb5c3bdb360a9e72b654edcb638 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTA0Y2VhMjBkMGQxMmViNWMzYmRiMzYwYTllNzJiNjU0ZWRjYjYzOCJ9 --- .../cloud/datastream/v1/DatastreamClient.java | 14 +++++++------- .../datastream/v1alpha1/DatastreamClient.java | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/DatastreamClient.java b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/DatastreamClient.java index 990b4206..c3ffc32c 100644 --- a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/DatastreamClient.java +++ b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/DatastreamClient.java @@ -310,7 +310,7 @@ public final ListConnectionProfilesPagedResponse listConnectionProfiles( * while (true) { * ListConnectionProfilesResponse response = * datastreamClient.listConnectionProfilesCallable().call(request); - * for (ConnectionProfile element : response.getResponsesList()) { + * for (ConnectionProfile element : response.getConnectionProfilesList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -1058,7 +1058,7 @@ public final ListStreamsPagedResponse listStreams(ListStreamsRequest request) { * .build(); * while (true) { * ListStreamsResponse response = datastreamClient.listStreamsCallable().call(request); - * for (Stream element : response.getResponsesList()) { + * for (Stream element : response.getStreamsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -1857,7 +1857,7 @@ public final ListStreamObjectsPagedResponse listStreamObjects(ListStreamObjectsR * while (true) { * ListStreamObjectsResponse response = * datastreamClient.listStreamObjectsCallable().call(request); - * for (StreamObject element : response.getResponsesList()) { + * for (StreamObject element : response.getStreamObjectsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -2213,7 +2213,7 @@ public final FetchStaticIpsPagedResponse fetchStaticIps(FetchStaticIpsRequest re * .build(); * while (true) { * FetchStaticIpsResponse response = datastreamClient.fetchStaticIpsCallable().call(request); - * for (String element : response.getResponsesList()) { + * for (String element : response.getStaticIpsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -2642,7 +2642,7 @@ public final ListPrivateConnectionsPagedResponse listPrivateConnections( * while (true) { * ListPrivateConnectionsResponse response = * datastreamClient.listPrivateConnectionsCallable().call(request); - * for (PrivateConnection element : response.getResponsesList()) { + * for (PrivateConnection element : response.getPrivateConnectionsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -3213,7 +3213,7 @@ public final UnaryCallable listRoute * .build(); * while (true) { * ListRoutesResponse response = datastreamClient.listRoutesCallable().call(request); - * for (Route element : response.getResponsesList()) { + * for (Route element : response.getRoutesList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -3443,7 +3443,7 @@ public final ListLocationsPagedResponse listLocations(ListLocationsRequest reque * .build(); * while (true) { * ListLocationsResponse response = datastreamClient.listLocationsCallable().call(request); - * for (Location element : response.getResponsesList()) { + * for (Location element : response.getLocationsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); diff --git a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/DatastreamClient.java b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/DatastreamClient.java index 42936600..8e017739 100644 --- a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/DatastreamClient.java +++ b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/DatastreamClient.java @@ -308,7 +308,7 @@ public final ListConnectionProfilesPagedResponse listConnectionProfiles( * while (true) { * ListConnectionProfilesResponse response = * datastreamClient.listConnectionProfilesCallable().call(request); - * for (ConnectionProfile element : response.getResponsesList()) { + * for (ConnectionProfile element : response.getConnectionProfilesList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -1044,7 +1044,7 @@ public final ListStreamsPagedResponse listStreams(ListStreamsRequest request) { * .build(); * while (true) { * ListStreamsResponse response = datastreamClient.listStreamsCallable().call(request); - * for (Stream element : response.getResponsesList()) { + * for (Stream element : response.getStreamsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -1773,7 +1773,7 @@ public final FetchStaticIpsPagedResponse fetchStaticIps(FetchStaticIpsRequest re * .build(); * while (true) { * FetchStaticIpsResponse response = datastreamClient.fetchStaticIpsCallable().call(request); - * for (String element : response.getResponsesList()) { + * for (String element : response.getStaticIpsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -2202,7 +2202,7 @@ public final ListPrivateConnectionsPagedResponse listPrivateConnections( * while (true) { * ListPrivateConnectionsResponse response = * datastreamClient.listPrivateConnectionsCallable().call(request); - * for (PrivateConnection element : response.getResponsesList()) { + * for (PrivateConnection element : response.getPrivateConnectionsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -2763,7 +2763,7 @@ public final UnaryCallable listRoute * .build(); * while (true) { * ListRoutesResponse response = datastreamClient.listRoutesCallable().call(request); - * for (Route element : response.getResponsesList()) { + * for (Route element : response.getRoutesList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); From 0563443a2853a31d3365d08b5402b7617dee8bc3 Mon Sep 17 00:00:00 2001 From: Emily Ball Date: Tue, 14 Jun 2022 21:30:27 +0000 Subject: [PATCH 05/13] chore: include generated samples dir (#173) --- .github/.OwlBot.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/.OwlBot.yaml b/.github/.OwlBot.yaml index b08f9f41..ca2e2669 100644 --- a/.github/.OwlBot.yaml +++ b/.github/.OwlBot.yaml @@ -16,6 +16,7 @@ docker: image: "gcr.io/cloud-devrel-public-resources/owlbot-java:latest" deep-remove-regex: +- "/samples/snippets/generated" - "/grpc-google-.*/src" - "/proto-google-.*/src" - "/google-.*/src" @@ -29,4 +30,6 @@ deep-copy-regex: - source: "/google/cloud/datastream/(v.*)/.*-java/grpc-google-.*/src" dest: "/owl-bot-staging/$1/grpc-google-cloud-datastream-$1/src" - source: "/google/cloud/datastream/(v.*)/.*-java/gapic-google-.*/src" - dest: "/owl-bot-staging/$1/google-cloud-datastream/src" \ No newline at end of file + dest: "/owl-bot-staging/$1/google-cloud-datastream/src" +- source: "/google/cloud/datastream/(v.*)/.*-java/samples/snippets/generated" + dest: "/owl-bot-staging/$1/samples/snippets/generated" From 4f222a0f0cd6a055627c459d81cdfeeb3d1baf26 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 23 Jun 2022 17:28:22 +0200 Subject: [PATCH 06/13] deps: update dependency com.google.cloud:google-cloud-shared-dependencies to v2.13.0 (#175) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-shared-dependencies](https://togithub.com/googleapis/java-shared-dependencies) | `2.12.0` -> `2.13.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/2.13.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/2.13.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/2.13.0/compatibility-slim/2.12.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/2.13.0/confidence-slim/2.12.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
googleapis/java-shared-dependencies ### [`v2.13.0`](https://togithub.com/googleapis/java-shared-dependencies/blob/HEAD/CHANGELOG.md#​2130-httpsgithubcomgoogleapisjava-shared-dependenciescomparev2120v2130-2022-06-22) [Compare Source](https://togithub.com/googleapis/java-shared-dependencies/compare/v2.12.0...v2.13.0) ##### Dependencies - update dependency com.google.api-client:google-api-client-bom to v1.35.0 ([#​709](https://togithub.com/googleapis/java-shared-dependencies/issues/709)) ([239f8c3](https://togithub.com/googleapis/java-shared-dependencies/commit/239f8c33a11e233e6af79aee8c7e68cd156a0554)) - update dependency com.google.api-client:google-api-client-bom to v1.35.1 ([#​713](https://togithub.com/googleapis/java-shared-dependencies/issues/713)) ([6559b45](https://togithub.com/googleapis/java-shared-dependencies/commit/6559b45b027dba783a9525d35e32183d78773cbe)) - update dependency com.google.api:api-common to v2.2.1 ([#​710](https://togithub.com/googleapis/java-shared-dependencies/issues/710)) ([650d4c5](https://togithub.com/googleapis/java-shared-dependencies/commit/650d4c5f8c3cfce711257d47280ad773cd2e2414)) - update dependency com.google.errorprone:error_prone_annotations to v2.14.0 ([#​701](https://togithub.com/googleapis/java-shared-dependencies/issues/701)) ([d24730f](https://togithub.com/googleapis/java-shared-dependencies/commit/d24730f78669f80b109e590b903446e5552e3e36)) - update dependency com.google.http-client:google-http-client-bom to v1.42.0 ([#​711](https://togithub.com/googleapis/java-shared-dependencies/issues/711)) ([5168a18](https://togithub.com/googleapis/java-shared-dependencies/commit/5168a181722128d434a0d0d2ab5cc485686bbc78)) - update dependency com.google.oauth-client:google-oauth-client-bom to v1.34.0 ([#​708](https://togithub.com/googleapis/java-shared-dependencies/issues/708)) ([620336e](https://togithub.com/googleapis/java-shared-dependencies/commit/620336e6733e2017116e5e8a7b403b183a728bc1)) - update dependency com.google.oauth-client:google-oauth-client-bom to v1.34.1 ([#​712](https://togithub.com/googleapis/java-shared-dependencies/issues/712)) ([a2c18a5](https://togithub.com/googleapis/java-shared-dependencies/commit/a2c18a5bc4152cc9034cec691a29f54a35c38a51)) - update dependency com.google.protobuf:protobuf-bom to v3.21.0 ([#​703](https://togithub.com/googleapis/java-shared-dependencies/issues/703)) ([5f9fe12](https://togithub.com/googleapis/java-shared-dependencies/commit/5f9fe1200b4bdf4c54bf947c21bd3ed02f26f990)) - update dependency com.google.protobuf:protobuf-bom to v3.21.1 ([#​705](https://togithub.com/googleapis/java-shared-dependencies/issues/705)) ([c68edfb](https://togithub.com/googleapis/java-shared-dependencies/commit/c68edfbe7e1993e1112640b867b29aa2fbcf7579)) - update dependency io.grpc:grpc-bom to v1.47.0 ([#​707](https://togithub.com/googleapis/java-shared-dependencies/issues/707)) ([d02918a](https://togithub.com/googleapis/java-shared-dependencies/commit/d02918a0418cd65d1d247f27afb0637f1f8f5666)) - update dependency org.checkerframework:checker-qual to v3.22.1 ([#​706](https://togithub.com/googleapis/java-shared-dependencies/issues/706)) ([545843b](https://togithub.com/googleapis/java-shared-dependencies/commit/545843b492cead230b8cc72a1dae7d4922f33b39)) - update dependency org.checkerframework:checker-qual to v3.22.2 ([#​717](https://togithub.com/googleapis/java-shared-dependencies/issues/717)) ([142852a](https://togithub.com/googleapis/java-shared-dependencies/commit/142852a37140f221197f5c71aed451def353b1e0)) - update gax.version to v2.18.2 ([#​718](https://togithub.com/googleapis/java-shared-dependencies/issues/718)) ([5f8156e](https://togithub.com/googleapis/java-shared-dependencies/commit/5f8156e55c6a07b018a8c5efafa68be781b4288b)) - update google.common-protos.version to v2.9.0 ([#​714](https://togithub.com/googleapis/java-shared-dependencies/issues/714)) ([9e5591e](https://togithub.com/googleapis/java-shared-dependencies/commit/9e5591ec3035350450ecbfebd00e08216433b06c)) - update google.core.version to v2.8.0 ([#​719](https://togithub.com/googleapis/java-shared-dependencies/issues/719)) ([4023c60](https://togithub.com/googleapis/java-shared-dependencies/commit/4023c6063a2c5b5308da531df1a08c90c491965d)) - update iam.version to v1.4.0 ([#​700](https://togithub.com/googleapis/java-shared-dependencies/issues/700)) ([c1097a4](https://togithub.com/googleapis/java-shared-dependencies/commit/c1097a46ab0739b0b7234bc510e4c3d9ce2c2861)) - update iam.version to v1.4.1 ([#​716](https://togithub.com/googleapis/java-shared-dependencies/issues/716)) ([e2dc7c2](https://togithub.com/googleapis/java-shared-dependencies/commit/e2dc7c21c39e007878841e2664d548ec44a72d54))
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-datastream). --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7acfbe1f..b2967a63 100644 --- a/pom.xml +++ b/pom.xml @@ -95,7 +95,7 @@ com.google.cloud google-cloud-shared-dependencies - 2.12.0 + 2.13.0 pom import From 3e6838526f2a2e4233767b1ce3032c4c6b5e0086 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 24 Jun 2022 15:02:11 +0000 Subject: [PATCH 07/13] feat: Enable REST transport for most of Java and Go clients (#176) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 456641589 Source-Link: https://github.com/googleapis/googleapis/commit/8a251f5225b789b2383207ffd978f6aa3d77fcf7 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4ca52a529cf01308d9714950edffbea3560cfbdb Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGNhNTJhNTI5Y2YwMTMwOGQ5NzE0OTUwZWRmZmJlYTM1NjBjZmJkYiJ9 --- google-cloud-datastream/pom.xml | 16 + .../cloud/datastream/v1/DatastreamClient.java | 37 +- .../datastream/v1/DatastreamSettings.java | 23 +- .../datastream/v1/stub/DatastreamStub.java | 6 +- .../v1/stub/DatastreamStubSettings.java | 53 +- .../HttpJsonDatastreamCallableFactory.java | 105 + .../v1/stub/HttpJsonDatastreamStub.java | 1916 ++++++++++++ .../datastream/v1alpha1/DatastreamClient.java | 37 +- .../v1alpha1/DatastreamSettings.java | 23 +- .../v1alpha1/stub/DatastreamStub.java | 6 +- .../v1alpha1/stub/DatastreamStubSettings.java | 53 +- .../HttpJsonDatastreamCallableFactory.java | 105 + .../v1alpha1/stub/HttpJsonDatastreamStub.java | 1589 ++++++++++ .../v1/DatastreamClientHttpJsonTest.java | 2641 +++++++++++++++++ .../DatastreamClientHttpJsonTest.java | 2127 +++++++++++++ .../SyncCreateSetCredentialsProvider.java | 41 + .../SyncCreateSetCredentialsProvider1.java | 40 + .../create/SyncCreateSetEndpoint.java | 38 + .../AsyncCreateConnectionProfile.java | 53 + .../AsyncCreateConnectionProfileLRO.java | 53 + .../SyncCreateConnectionProfile.java | 48 + ...leLocationnameConnectionprofileString.java | 47 + ...nProfileStringConnectionprofileString.java | 46 + .../AsyncCreatePrivateConnection.java | 51 + .../AsyncCreatePrivateConnectionLRO.java | 51 + .../SyncCreatePrivateConnection.java | 46 + ...onLocationnamePrivateconnectionString.java | 47 + ...nnectionStringPrivateconnectionString.java | 46 + .../createroute/AsyncCreateRoute.java | 52 + .../createroute/AsyncCreateRouteLRO.java | 53 + .../createroute/SyncCreateRoute.java | 48 + ...RoutePrivateconnectionnameRouteString.java | 43 + .../SyncCreateRouteStringRouteString.java | 42 + .../createstream/AsyncCreateStream.java | 52 + .../createstream/AsyncCreateStreamLRO.java | 53 + .../createstream/SyncCreateStream.java | 48 + ...cCreateStreamLocationnameStreamString.java | 41 + .../SyncCreateStreamStringStreamString.java | 41 + .../AsyncDeleteConnectionProfile.java | 50 + .../AsyncDeleteConnectionProfileLRO.java | 51 + .../SyncDeleteConnectionProfile.java | 45 + ...onnectionProfileConnectionprofilename.java | 40 + .../SyncDeleteConnectionProfileString.java | 39 + .../AsyncDeletePrivateConnection.java | 51 + .../AsyncDeletePrivateConnectionLRO.java | 52 + .../SyncDeletePrivateConnection.java | 46 + ...rivateConnectionPrivateconnectionname.java | 40 + .../SyncDeletePrivateConnectionString.java | 39 + .../deleteroute/AsyncDeleteRoute.java | 49 + .../deleteroute/AsyncDeleteRouteLRO.java | 51 + .../deleteroute/SyncDeleteRoute.java | 45 + .../deleteroute/SyncDeleteRouteRoutename.java | 38 + .../deleteroute/SyncDeleteRouteString.java | 39 + .../deletestream/AsyncDeleteStream.java | 47 + .../deletestream/AsyncDeleteStreamLRO.java | 49 + .../deletestream/SyncDeleteStream.java | 43 + .../SyncDeleteStreamStreamname.java | 38 + .../deletestream/SyncDeleteStreamString.java | 38 + .../AsyncDiscoverConnectionProfile.java | 47 + .../SyncDiscoverConnectionProfile.java | 44 + .../fetchstaticips/AsyncFetchStaticIps.java | 49 + .../AsyncFetchStaticIpsPaged.java | 57 + .../fetchstaticips/SyncFetchStaticIps.java | 46 + .../SyncFetchStaticIpsLocationname.java | 40 + .../SyncFetchStaticIpsString.java | 40 + .../AsyncGetConnectionProfile.java | 49 + .../SyncGetConnectionProfile.java | 45 + ...onnectionProfileConnectionprofilename.java | 40 + .../SyncGetConnectionProfileString.java | 40 + .../getlocation/AsyncGetLocation.java | 42 + .../getlocation/SyncGetLocation.java | 39 + .../AsyncGetPrivateConnection.java | 49 + .../SyncGetPrivateConnection.java | 45 + ...rivateConnectionPrivateconnectionname.java | 40 + .../SyncGetPrivateConnectionString.java | 40 + .../getroute/AsyncGetRoute.java | 48 + .../getroute/SyncGetRoute.java | 45 + .../getroute/SyncGetRouteRoutename.java | 39 + .../getroute/SyncGetRouteString.java | 40 + .../getstream/AsyncGetStream.java | 46 + .../getstream/SyncGetStream.java | 43 + .../getstream/SyncGetStreamStreamname.java | 39 + .../getstream/SyncGetStreamString.java | 39 + .../getstreamobject/AsyncGetStreamObject.java | 48 + .../getstreamobject/SyncGetStreamObject.java | 44 + .../SyncGetStreamObjectStreamobjectname.java | 40 + .../SyncGetStreamObjectString.java | 40 + .../AsyncListConnectionProfiles.java | 53 + .../AsyncListConnectionProfilesPaged.java | 61 + .../SyncListConnectionProfiles.java | 50 + ...yncListConnectionProfilesLocationname.java | 42 + .../SyncListConnectionProfilesString.java | 42 + .../listlocations/AsyncListLocations.java | 51 + .../AsyncListLocationsPaged.java | 58 + .../listlocations/SyncListLocations.java | 47 + .../AsyncListPrivateConnections.java | 53 + .../AsyncListPrivateConnectionsPaged.java | 61 + .../SyncListPrivateConnections.java | 50 + ...yncListPrivateConnectionsLocationname.java | 42 + .../SyncListPrivateConnectionsString.java | 42 + .../listroutes/AsyncListRoutes.java | 54 + .../listroutes/AsyncListRoutesPaged.java | 62 + .../listroutes/SyncListRoutes.java | 51 + .../SyncListRoutesPrivateconnectionname.java | 42 + .../listroutes/SyncListRoutesString.java | 42 + .../AsyncListStreamObjects.java | 51 + .../AsyncListStreamObjectsPaged.java | 59 + .../SyncListStreamObjects.java | 47 + .../SyncListStreamObjectsStreamname.java | 41 + .../SyncListStreamObjectsString.java | 41 + .../liststreams/AsyncListStreams.java | 52 + .../liststreams/AsyncListStreamsPaged.java | 60 + .../liststreams/SyncListStreams.java | 49 + .../SyncListStreamsLocationname.java | 41 + .../liststreams/SyncListStreamsString.java | 41 + .../AsyncLookupStreamObject.java | 49 + .../SyncLookupStreamObject.java | 45 + .../AsyncStartBackfillJob.java | 48 + .../SyncStartBackfillJob.java | 44 + .../SyncStartBackfillJobStreamobjectname.java | 40 + .../SyncStartBackfillJobString.java | 40 + .../stopbackfilljob/AsyncStopBackfillJob.java | 48 + .../stopbackfilljob/SyncStopBackfillJob.java | 44 + .../SyncStopBackfillJobStreamobjectname.java | 40 + .../SyncStopBackfillJobString.java | 40 + .../AsyncUpdateConnectionProfile.java | 52 + .../AsyncUpdateConnectionProfileLRO.java | 52 + .../SyncUpdateConnectionProfile.java | 47 + ...tionProfileConnectionprofileFieldmask.java | 43 + .../updatestream/AsyncUpdateStream.java | 51 + .../updatestream/AsyncUpdateStreamLRO.java | 52 + .../updatestream/SyncUpdateStream.java | 47 + .../SyncUpdateStreamStreamFieldmask.java | 40 + .../SyncGetConnectionProfile.java | 45 + .../SyncGetConnectionProfile.java | 45 + .../SyncCreateSetCredentialsProvider.java | 41 + .../SyncCreateSetCredentialsProvider1.java | 40 + .../create/SyncCreateSetEndpoint.java | 38 + .../AsyncCreateConnectionProfile.java | 51 + .../AsyncCreateConnectionProfileLRO.java | 51 + .../SyncCreateConnectionProfile.java | 46 + ...leLocationnameConnectionprofileString.java | 47 + ...nProfileStringConnectionprofileString.java | 46 + .../AsyncCreatePrivateConnection.java | 51 + .../AsyncCreatePrivateConnectionLRO.java | 51 + .../SyncCreatePrivateConnection.java | 46 + ...onLocationnamePrivateconnectionString.java | 47 + ...nnectionStringPrivateconnectionString.java | 46 + .../createroute/AsyncCreateRoute.java | 52 + .../createroute/AsyncCreateRouteLRO.java | 53 + .../createroute/SyncCreateRoute.java | 48 + ...RoutePrivateconnectionnameRouteString.java | 44 + .../SyncCreateRouteStringRouteString.java | 42 + .../createstream/AsyncCreateStream.java | 52 + .../createstream/AsyncCreateStreamLRO.java | 53 + .../createstream/SyncCreateStream.java | 48 + ...cCreateStreamLocationnameStreamString.java | 41 + .../SyncCreateStreamStringStreamString.java | 41 + .../AsyncDeleteConnectionProfile.java | 50 + .../AsyncDeleteConnectionProfileLRO.java | 51 + .../SyncDeleteConnectionProfile.java | 45 + ...onnectionProfileConnectionprofilename.java | 41 + .../SyncDeleteConnectionProfileString.java | 39 + .../AsyncDeletePrivateConnection.java | 51 + .../AsyncDeletePrivateConnectionLRO.java | 52 + .../SyncDeletePrivateConnection.java | 46 + ...rivateConnectionPrivateconnectionname.java | 41 + .../SyncDeletePrivateConnectionString.java | 39 + .../deleteroute/AsyncDeleteRoute.java | 49 + .../deleteroute/AsyncDeleteRouteLRO.java | 51 + .../deleteroute/SyncDeleteRoute.java | 45 + .../deleteroute/SyncDeleteRouteRoutename.java | 38 + .../deleteroute/SyncDeleteRouteString.java | 39 + .../deletestream/AsyncDeleteStream.java | 47 + .../deletestream/AsyncDeleteStreamLRO.java | 49 + .../deletestream/SyncDeleteStream.java | 43 + .../SyncDeleteStreamStreamname.java | 38 + .../deletestream/SyncDeleteStreamString.java | 38 + .../AsyncDiscoverConnectionProfile.java | 47 + .../SyncDiscoverConnectionProfile.java | 44 + .../fetcherrors/AsyncFetchErrors.java | 46 + .../fetcherrors/AsyncFetchErrorsLRO.java | 48 + .../fetcherrors/SyncFetchErrors.java | 43 + .../fetchstaticips/AsyncFetchStaticIps.java | 49 + .../AsyncFetchStaticIpsPaged.java | 57 + .../fetchstaticips/SyncFetchStaticIps.java | 46 + .../SyncFetchStaticIpsLocationname.java | 40 + .../SyncFetchStaticIpsString.java | 40 + .../AsyncGetConnectionProfile.java | 49 + .../SyncGetConnectionProfile.java | 45 + ...onnectionProfileConnectionprofilename.java | 42 + .../SyncGetConnectionProfileString.java | 40 + .../AsyncGetPrivateConnection.java | 49 + .../SyncGetPrivateConnection.java | 45 + ...rivateConnectionPrivateconnectionname.java | 42 + .../SyncGetPrivateConnectionString.java | 40 + .../getroute/AsyncGetRoute.java | 48 + .../getroute/SyncGetRoute.java | 45 + .../getroute/SyncGetRouteRoutename.java | 39 + .../getroute/SyncGetRouteString.java | 40 + .../getstream/AsyncGetStream.java | 46 + .../getstream/SyncGetStream.java | 43 + .../getstream/SyncGetStreamStreamname.java | 39 + .../getstream/SyncGetStreamString.java | 39 + .../AsyncListConnectionProfiles.java | 53 + .../AsyncListConnectionProfilesPaged.java | 61 + .../SyncListConnectionProfiles.java | 50 + ...yncListConnectionProfilesLocationname.java | 42 + .../SyncListConnectionProfilesString.java | 42 + .../AsyncListPrivateConnections.java | 53 + .../AsyncListPrivateConnectionsPaged.java | 61 + .../SyncListPrivateConnections.java | 50 + ...yncListPrivateConnectionsLocationname.java | 42 + .../SyncListPrivateConnectionsString.java | 42 + .../listroutes/AsyncListRoutes.java | 54 + .../listroutes/AsyncListRoutesPaged.java | 62 + .../listroutes/SyncListRoutes.java | 51 + .../SyncListRoutesPrivateconnectionname.java | 42 + .../listroutes/SyncListRoutesString.java | 42 + .../liststreams/AsyncListStreams.java | 52 + .../liststreams/AsyncListStreamsPaged.java | 60 + .../liststreams/SyncListStreams.java | 49 + .../SyncListStreamsLocationname.java | 41 + .../liststreams/SyncListStreamsString.java | 41 + .../AsyncUpdateConnectionProfile.java | 50 + .../AsyncUpdateConnectionProfileLRO.java | 50 + .../SyncUpdateConnectionProfile.java | 45 + ...tionProfileConnectionprofileFieldmask.java | 43 + .../updatestream/AsyncUpdateStream.java | 51 + .../updatestream/AsyncUpdateStreamLRO.java | 52 + .../updatestream/SyncUpdateStream.java | 47 + .../SyncUpdateStreamStreamFieldmask.java | 40 + .../SyncGetConnectionProfile.java | 45 + .../SyncGetConnectionProfile.java | 45 + 234 files changed, 18821 insertions(+), 22 deletions(-) create mode 100644 google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/stub/HttpJsonDatastreamCallableFactory.java create mode 100644 google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/stub/HttpJsonDatastreamStub.java create mode 100644 google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/stub/HttpJsonDatastreamCallableFactory.java create mode 100644 google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/stub/HttpJsonDatastreamStub.java create mode 100644 google-cloud-datastream/src/test/java/com/google/cloud/datastream/v1/DatastreamClientHttpJsonTest.java create mode 100644 google-cloud-datastream/src/test/java/com/google/cloud/datastream/v1alpha1/DatastreamClientHttpJsonTest.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/create/SyncCreateSetCredentialsProvider.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/create/SyncCreateSetCredentialsProvider1.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/create/SyncCreateSetEndpoint.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/AsyncCreateConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/AsyncCreateConnectionProfileLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileLocationnameConnectionprofileString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileStringConnectionprofileString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/AsyncCreatePrivateConnection.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/AsyncCreatePrivateConnectionLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/SyncCreatePrivateConnection.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionLocationnamePrivateconnectionString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionStringPrivateconnectionString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/AsyncCreateRoute.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/AsyncCreateRouteLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/SyncCreateRoute.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/SyncCreateRoutePrivateconnectionnameRouteString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/SyncCreateRouteStringRouteString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createstream/AsyncCreateStream.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createstream/AsyncCreateStreamLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createstream/SyncCreateStream.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createstream/SyncCreateStreamLocationnameStreamString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createstream/SyncCreateStreamStringStreamString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/AsyncDeleteConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/AsyncDeleteConnectionProfileLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileConnectionprofilename.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/AsyncDeletePrivateConnection.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/AsyncDeletePrivateConnectionLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnection.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionPrivateconnectionname.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/AsyncDeleteRoute.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/AsyncDeleteRouteLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRoute.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRouteRoutename.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRouteString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/AsyncDeleteStream.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/AsyncDeleteStreamLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStream.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStreamStreamname.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStreamString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/discoverconnectionprofile/AsyncDiscoverConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/discoverconnectionprofile/SyncDiscoverConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/fetchstaticips/AsyncFetchStaticIps.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/fetchstaticips/AsyncFetchStaticIpsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/fetchstaticips/SyncFetchStaticIps.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/fetchstaticips/SyncFetchStaticIpsLocationname.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/fetchstaticips/SyncFetchStaticIpsString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getconnectionprofile/AsyncGetConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getconnectionprofile/SyncGetConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getconnectionprofile/SyncGetConnectionProfileConnectionprofilename.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getconnectionprofile/SyncGetConnectionProfileString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getlocation/AsyncGetLocation.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getlocation/SyncGetLocation.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getprivateconnection/AsyncGetPrivateConnection.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getprivateconnection/SyncGetPrivateConnection.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getprivateconnection/SyncGetPrivateConnectionPrivateconnectionname.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getprivateconnection/SyncGetPrivateConnectionString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getroute/AsyncGetRoute.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getroute/SyncGetRoute.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getroute/SyncGetRouteRoutename.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getroute/SyncGetRouteString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstream/AsyncGetStream.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstream/SyncGetStream.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstream/SyncGetStreamStreamname.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstream/SyncGetStreamString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstreamobject/AsyncGetStreamObject.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstreamobject/SyncGetStreamObject.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstreamobject/SyncGetStreamObjectStreamobjectname.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstreamobject/SyncGetStreamObjectString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listconnectionprofiles/AsyncListConnectionProfiles.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listconnectionprofiles/AsyncListConnectionProfilesPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listconnectionprofiles/SyncListConnectionProfiles.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listconnectionprofiles/SyncListConnectionProfilesLocationname.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listconnectionprofiles/SyncListConnectionProfilesString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listlocations/AsyncListLocations.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listlocations/AsyncListLocationsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listlocations/SyncListLocations.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listprivateconnections/AsyncListPrivateConnections.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listprivateconnections/AsyncListPrivateConnectionsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listprivateconnections/SyncListPrivateConnections.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listprivateconnections/SyncListPrivateConnectionsLocationname.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listprivateconnections/SyncListPrivateConnectionsString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listroutes/AsyncListRoutes.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listroutes/AsyncListRoutesPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listroutes/SyncListRoutes.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listroutes/SyncListRoutesPrivateconnectionname.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listroutes/SyncListRoutesString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreamobjects/AsyncListStreamObjects.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreamobjects/AsyncListStreamObjectsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreamobjects/SyncListStreamObjects.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreamobjects/SyncListStreamObjectsStreamname.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreamobjects/SyncListStreamObjectsString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreams/AsyncListStreams.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreams/AsyncListStreamsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreams/SyncListStreams.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreams/SyncListStreamsLocationname.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreams/SyncListStreamsString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/lookupstreamobject/AsyncLookupStreamObject.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/lookupstreamobject/SyncLookupStreamObject.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/startbackfilljob/AsyncStartBackfillJob.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/startbackfilljob/SyncStartBackfillJob.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/startbackfilljob/SyncStartBackfillJobStreamobjectname.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/startbackfilljob/SyncStartBackfillJobString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/stopbackfilljob/AsyncStopBackfillJob.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/stopbackfilljob/SyncStopBackfillJob.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/stopbackfilljob/SyncStopBackfillJobStreamobjectname.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/stopbackfilljob/SyncStopBackfillJobString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updateconnectionprofile/AsyncUpdateConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updateconnectionprofile/AsyncUpdateConnectionProfileLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfileConnectionprofileFieldmask.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updatestream/AsyncUpdateStream.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updatestream/AsyncUpdateStreamLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updatestream/SyncUpdateStream.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updatestream/SyncUpdateStreamStreamFieldmask.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/datastreamsettings/getconnectionprofile/SyncGetConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1/stub/datastreamstubsettings/getconnectionprofile/SyncGetConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/create/SyncCreateSetCredentialsProvider.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/create/SyncCreateSetCredentialsProvider1.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/create/SyncCreateSetEndpoint.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/AsyncCreateConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/AsyncCreateConnectionProfileLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileLocationnameConnectionprofileString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileStringConnectionprofileString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/AsyncCreatePrivateConnection.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/AsyncCreatePrivateConnectionLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/SyncCreatePrivateConnection.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionLocationnamePrivateconnectionString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionStringPrivateconnectionString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/AsyncCreateRoute.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/AsyncCreateRouteLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/SyncCreateRoute.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/SyncCreateRoutePrivateconnectionnameRouteString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/SyncCreateRouteStringRouteString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createstream/AsyncCreateStream.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createstream/AsyncCreateStreamLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createstream/SyncCreateStream.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createstream/SyncCreateStreamLocationnameStreamString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createstream/SyncCreateStreamStringStreamString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/AsyncDeleteConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/AsyncDeleteConnectionProfileLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileConnectionprofilename.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/AsyncDeletePrivateConnection.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/AsyncDeletePrivateConnectionLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnection.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionPrivateconnectionname.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/AsyncDeleteRoute.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/AsyncDeleteRouteLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRoute.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRouteRoutename.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRouteString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/AsyncDeleteStream.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/AsyncDeleteStreamLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStream.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStreamStreamname.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStreamString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/discoverconnectionprofile/AsyncDiscoverConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/discoverconnectionprofile/SyncDiscoverConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetcherrors/AsyncFetchErrors.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetcherrors/AsyncFetchErrorsLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetcherrors/SyncFetchErrors.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetchstaticips/AsyncFetchStaticIps.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetchstaticips/AsyncFetchStaticIpsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetchstaticips/SyncFetchStaticIps.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetchstaticips/SyncFetchStaticIpsLocationname.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetchstaticips/SyncFetchStaticIpsString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getconnectionprofile/AsyncGetConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getconnectionprofile/SyncGetConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getconnectionprofile/SyncGetConnectionProfileConnectionprofilename.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getconnectionprofile/SyncGetConnectionProfileString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getprivateconnection/AsyncGetPrivateConnection.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getprivateconnection/SyncGetPrivateConnection.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getprivateconnection/SyncGetPrivateConnectionPrivateconnectionname.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getprivateconnection/SyncGetPrivateConnectionString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getroute/AsyncGetRoute.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getroute/SyncGetRoute.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getroute/SyncGetRouteRoutename.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getroute/SyncGetRouteString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getstream/AsyncGetStream.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getstream/SyncGetStream.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getstream/SyncGetStreamStreamname.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getstream/SyncGetStreamString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listconnectionprofiles/AsyncListConnectionProfiles.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listconnectionprofiles/AsyncListConnectionProfilesPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listconnectionprofiles/SyncListConnectionProfiles.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listconnectionprofiles/SyncListConnectionProfilesLocationname.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listconnectionprofiles/SyncListConnectionProfilesString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listprivateconnections/AsyncListPrivateConnections.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listprivateconnections/AsyncListPrivateConnectionsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listprivateconnections/SyncListPrivateConnections.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listprivateconnections/SyncListPrivateConnectionsLocationname.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listprivateconnections/SyncListPrivateConnectionsString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listroutes/AsyncListRoutes.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listroutes/AsyncListRoutesPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listroutes/SyncListRoutes.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listroutes/SyncListRoutesPrivateconnectionname.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listroutes/SyncListRoutesString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/liststreams/AsyncListStreams.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/liststreams/AsyncListStreamsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/liststreams/SyncListStreams.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/liststreams/SyncListStreamsLocationname.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/liststreams/SyncListStreamsString.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updateconnectionprofile/AsyncUpdateConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updateconnectionprofile/AsyncUpdateConnectionProfileLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfileConnectionprofileFieldmask.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updatestream/AsyncUpdateStream.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updatestream/AsyncUpdateStreamLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updatestream/SyncUpdateStream.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updatestream/SyncUpdateStreamStreamFieldmask.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamsettings/getconnectionprofile/SyncGetConnectionProfile.java create mode 100644 samples/snippets/generated/com/google/cloud/datastream/v1alpha1/stub/datastreamstubsettings/getconnectionprofile/SyncGetConnectionProfile.java diff --git a/google-cloud-datastream/pom.xml b/google-cloud-datastream/pom.xml index f0aa8c07..9c8a11c5 100644 --- a/google-cloud-datastream/pom.xml +++ b/google-cloud-datastream/pom.xml @@ -64,6 +64,10 @@ com.google.api gax-grpc + + + com.google.api + gax-httpjson org.threeten @@ -89,12 +93,24 @@ test + + com.google.api + gax + testlib + test + com.google.api gax-grpc testlib test + + com.google.api + gax-httpjson + testlib + test + diff --git a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/DatastreamClient.java b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/DatastreamClient.java index c3ffc32c..b2ea9b78 100644 --- a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/DatastreamClient.java +++ b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/DatastreamClient.java @@ -19,6 +19,7 @@ import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutures; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.longrunning.OperationsClient; import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; @@ -34,7 +35,6 @@ import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; -import com.google.longrunning.OperationsClient; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import java.io.IOException; @@ -107,13 +107,28 @@ * DatastreamClient datastreamClient = DatastreamClient.create(datastreamSettings); * } * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * DatastreamSettings datastreamSettings =
+ *     DatastreamSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             DatastreamSettings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * DatastreamClient datastreamClient = DatastreamClient.create(datastreamSettings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") public class DatastreamClient implements BackgroundResource { private final DatastreamSettings settings; private final DatastreamStub stub; - private final OperationsClient operationsClient; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of DatastreamClient with default settings. */ public static final DatastreamClient create() throws IOException { @@ -143,13 +158,17 @@ public static final DatastreamClient create(DatastreamStub stub) { protected DatastreamClient(DatastreamSettings settings) throws IOException { this.settings = settings; this.stub = ((DatastreamStubSettings) settings.getStubSettings()).createStub(); - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } protected DatastreamClient(DatastreamStub stub) { this.settings = null; this.stub = stub; - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } public final DatastreamSettings getSettings() { @@ -164,10 +183,18 @@ public DatastreamStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - public final OperationsClient getOperationsClient() { + public final com.google.longrunning.OperationsClient getOperationsClient() { return operationsClient; } + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final OperationsClient getHttpJsonOperationsClient() { + return httpJsonOperationsClient; + } + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Use this method to list connection profiles created in a project and location. diff --git a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/DatastreamSettings.java b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/DatastreamSettings.java index 88c71dab..c300817a 100644 --- a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/DatastreamSettings.java +++ b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/DatastreamSettings.java @@ -29,6 +29,7 @@ import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; @@ -327,11 +328,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return DatastreamStubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return DatastreamStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return DatastreamStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return DatastreamStubSettings.defaultTransportChannelProvider(); } @@ -341,11 +349,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return DatastreamStubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -383,6 +397,11 @@ private static Builder createDefault() { return new Builder(DatastreamStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(DatastreamStubSettings.newHttpJsonBuilder()); + } + public DatastreamStubSettings.Builder getStubSettingsBuilder() { return ((DatastreamStubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/stub/DatastreamStub.java b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/stub/DatastreamStub.java index 8104da66..b86ed104 100644 --- a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/stub/DatastreamStub.java +++ b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/stub/DatastreamStub.java @@ -86,7 +86,11 @@ public abstract class DatastreamStub implements BackgroundResource { public OperationsStub getOperationsStub() { - throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); + return null; + } + + public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { + return null; } public UnaryCallable diff --git a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/stub/DatastreamStubSettings.java b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/stub/DatastreamStubSettings.java index 3598bbd2..6114d9a9 100644 --- a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/stub/DatastreamStubSettings.java +++ b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/stub/DatastreamStubSettings.java @@ -34,6 +34,9 @@ import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; import com.google.api.gax.grpc.ProtoOperationTransformers; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.longrunning.OperationSnapshot; import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; import com.google.api.gax.retrying.RetrySettings; @@ -863,6 +866,11 @@ public DatastreamStub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcDatastreamStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonDatastreamStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -895,18 +903,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde .setUseJwtAccessWithScope(true); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return InstantiatingGrpcChannelProvider.newBuilder() .setMaxInboundMessageSize(Integer.MAX_VALUE); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return defaultGrpcTransportProviderBuilder().build(); } @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken( "gapic", GaxProperties.getLibraryVersion(DatastreamStubSettings.class)) @@ -914,11 +929,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } - /** Returns a new builder for this class. */ + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(DatastreamStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return DatastreamStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -1272,6 +1306,19 @@ private static Builder createDefault() { return initDefaults(builder); } + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + private static Builder initDefaults(Builder builder) { builder .listConnectionProfilesSettings() diff --git a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/stub/HttpJsonDatastreamCallableFactory.java b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/stub/HttpJsonDatastreamCallableFactory.java new file mode 100644 index 00000000..bdb126e8 --- /dev/null +++ b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/stub/HttpJsonDatastreamCallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the Datastream service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonDatastreamCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/stub/HttpJsonDatastreamStub.java b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/stub/HttpJsonDatastreamStub.java new file mode 100644 index 00000000..93b28d2e --- /dev/null +++ b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/stub/HttpJsonDatastreamStub.java @@ -0,0 +1,1916 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.stub; + +import static com.google.cloud.datastream.v1.DatastreamClient.FetchStaticIpsPagedResponse; +import static com.google.cloud.datastream.v1.DatastreamClient.ListConnectionProfilesPagedResponse; +import static com.google.cloud.datastream.v1.DatastreamClient.ListLocationsPagedResponse; +import static com.google.cloud.datastream.v1.DatastreamClient.ListPrivateConnectionsPagedResponse; +import static com.google.cloud.datastream.v1.DatastreamClient.ListRoutesPagedResponse; +import static com.google.cloud.datastream.v1.DatastreamClient.ListStreamObjectsPagedResponse; +import static com.google.cloud.datastream.v1.DatastreamClient.ListStreamsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshot; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.datastream.v1.ConnectionProfile; +import com.google.cloud.datastream.v1.CreateConnectionProfileRequest; +import com.google.cloud.datastream.v1.CreatePrivateConnectionRequest; +import com.google.cloud.datastream.v1.CreateRouteRequest; +import com.google.cloud.datastream.v1.CreateStreamRequest; +import com.google.cloud.datastream.v1.DeleteConnectionProfileRequest; +import com.google.cloud.datastream.v1.DeletePrivateConnectionRequest; +import com.google.cloud.datastream.v1.DeleteRouteRequest; +import com.google.cloud.datastream.v1.DeleteStreamRequest; +import com.google.cloud.datastream.v1.DiscoverConnectionProfileRequest; +import com.google.cloud.datastream.v1.DiscoverConnectionProfileResponse; +import com.google.cloud.datastream.v1.FetchStaticIpsRequest; +import com.google.cloud.datastream.v1.FetchStaticIpsResponse; +import com.google.cloud.datastream.v1.GetConnectionProfileRequest; +import com.google.cloud.datastream.v1.GetPrivateConnectionRequest; +import com.google.cloud.datastream.v1.GetRouteRequest; +import com.google.cloud.datastream.v1.GetStreamObjectRequest; +import com.google.cloud.datastream.v1.GetStreamRequest; +import com.google.cloud.datastream.v1.ListConnectionProfilesRequest; +import com.google.cloud.datastream.v1.ListConnectionProfilesResponse; +import com.google.cloud.datastream.v1.ListPrivateConnectionsRequest; +import com.google.cloud.datastream.v1.ListPrivateConnectionsResponse; +import com.google.cloud.datastream.v1.ListRoutesRequest; +import com.google.cloud.datastream.v1.ListRoutesResponse; +import com.google.cloud.datastream.v1.ListStreamObjectsRequest; +import com.google.cloud.datastream.v1.ListStreamObjectsResponse; +import com.google.cloud.datastream.v1.ListStreamsRequest; +import com.google.cloud.datastream.v1.ListStreamsResponse; +import com.google.cloud.datastream.v1.LookupStreamObjectRequest; +import com.google.cloud.datastream.v1.OperationMetadata; +import com.google.cloud.datastream.v1.PrivateConnection; +import com.google.cloud.datastream.v1.Route; +import com.google.cloud.datastream.v1.StartBackfillJobRequest; +import com.google.cloud.datastream.v1.StartBackfillJobResponse; +import com.google.cloud.datastream.v1.StopBackfillJobRequest; +import com.google.cloud.datastream.v1.StopBackfillJobResponse; +import com.google.cloud.datastream.v1.Stream; +import com.google.cloud.datastream.v1.StreamObject; +import com.google.cloud.datastream.v1.UpdateConnectionProfileRequest; +import com.google.cloud.datastream.v1.UpdateStreamRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.longrunning.Operation; +import com.google.protobuf.Empty; +import com.google.protobuf.TypeRegistry; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the Datastream service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonDatastreamStub extends DatastreamStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(Empty.getDescriptor()) + .add(ConnectionProfile.getDescriptor()) + .add(OperationMetadata.getDescriptor()) + .add(Route.getDescriptor()) + .add(PrivateConnection.getDescriptor()) + .add(Stream.getDescriptor()) + .build(); + + private static final ApiMethodDescriptor< + ListConnectionProfilesRequest, ListConnectionProfilesResponse> + listConnectionProfilesMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/ListConnectionProfiles") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/connectionProfiles", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam(fields, "orderBy", request.getOrderBy()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListConnectionProfilesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getConnectionProfileMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/GetConnectionProfile") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/connectionProfiles/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ConnectionProfile.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createConnectionProfileMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/CreateConnectionProfile") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/connectionProfiles", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "connectionProfileId", request.getConnectionProfileId()); + serializer.putQueryParam(fields, "force", request.getForce()); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("connectionProfile", request.getConnectionProfile())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateConnectionProfileRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + updateConnectionProfileMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/UpdateConnectionProfile") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{connectionProfile.name=projects/*/locations/*/connectionProfiles/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "connectionProfile.name", + request.getConnectionProfile().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "force", request.getForce()); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("connectionProfile", request.getConnectionProfile())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateConnectionProfileRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + deleteConnectionProfileMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/DeleteConnectionProfile") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/connectionProfiles/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteConnectionProfileRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor< + DiscoverConnectionProfileRequest, DiscoverConnectionProfileResponse> + discoverConnectionProfileMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/DiscoverConnectionProfile") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/connectionProfiles:discover", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(DiscoverConnectionProfileResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listStreamsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/ListStreams") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/streams", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam(fields, "orderBy", request.getOrderBy()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListStreamsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor getStreamMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/GetStream") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/streams/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Stream.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createStreamMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/CreateStream") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/streams", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "force", request.getForce()); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + serializer.putQueryParam(fields, "streamId", request.getStreamId()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create().toBody("stream", request.getStream())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateStreamRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + updateStreamMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/UpdateStream") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{stream.name=projects/*/locations/*/streams/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "stream.name", request.getStream().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "force", request.getForce()); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create().toBody("stream", request.getStream())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateStreamRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + deleteStreamMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/DeleteStream") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/streams/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteStreamRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + getStreamObjectMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/GetStreamObject") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/streams/*/objects/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(StreamObject.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + lookupStreamObjectMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/LookupStreamObject") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*/streams/*}/objects:lookup", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(StreamObject.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listStreamObjectsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/ListStreamObjects") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*/streams/*}/objects", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListStreamObjectsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + startBackfillJobMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/StartBackfillJob") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{object=projects/*/locations/*/streams/*/objects/*}:startBackfillJob", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "object", request.getObject()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearObject().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(StartBackfillJobResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + stopBackfillJobMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/StopBackfillJob") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{object=projects/*/locations/*/streams/*/objects/*}:stopBackfillJob", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "object", request.getObject()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearObject().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(StopBackfillJobResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + fetchStaticIpsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/FetchStaticIps") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*}:fetchStaticIps", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(FetchStaticIpsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createPrivateConnectionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/CreatePrivateConnection") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/privateConnections", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "privateConnectionId", request.getPrivateConnectionId()); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("privateConnection", request.getPrivateConnection())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreatePrivateConnectionRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + getPrivateConnectionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/GetPrivateConnection") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/privateConnections/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(PrivateConnection.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListPrivateConnectionsRequest, ListPrivateConnectionsResponse> + listPrivateConnectionsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/ListPrivateConnections") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/privateConnections", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam(fields, "orderBy", request.getOrderBy()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListPrivateConnectionsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deletePrivateConnectionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/DeletePrivateConnection") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/privateConnections/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "force", request.getForce()); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeletePrivateConnectionRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + createRouteMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/CreateRoute") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*/privateConnections/*}/routes", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + serializer.putQueryParam(fields, "routeId", request.getRouteId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create().toBody("route", request.getRoute())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateRouteRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor getRouteMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/GetRoute") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/privateConnections/*/routes/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Route.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listRoutesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/ListRoutes") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*/privateConnections/*}/routes", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam(fields, "orderBy", request.getOrderBy()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListRoutesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteRouteMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1.Datastream/DeleteRoute") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/privateConnections/*/routes/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteRouteRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable + listConnectionProfilesCallable; + private final UnaryCallable + listConnectionProfilesPagedCallable; + private final UnaryCallable + getConnectionProfileCallable; + private final UnaryCallable + createConnectionProfileCallable; + private final OperationCallable< + CreateConnectionProfileRequest, ConnectionProfile, OperationMetadata> + createConnectionProfileOperationCallable; + private final UnaryCallable + updateConnectionProfileCallable; + private final OperationCallable< + UpdateConnectionProfileRequest, ConnectionProfile, OperationMetadata> + updateConnectionProfileOperationCallable; + private final UnaryCallable + deleteConnectionProfileCallable; + private final OperationCallable + deleteConnectionProfileOperationCallable; + private final UnaryCallable + discoverConnectionProfileCallable; + private final UnaryCallable listStreamsCallable; + private final UnaryCallable + listStreamsPagedCallable; + private final UnaryCallable getStreamCallable; + private final UnaryCallable createStreamCallable; + private final OperationCallable + createStreamOperationCallable; + private final UnaryCallable updateStreamCallable; + private final OperationCallable + updateStreamOperationCallable; + private final UnaryCallable deleteStreamCallable; + private final OperationCallable + deleteStreamOperationCallable; + private final UnaryCallable getStreamObjectCallable; + private final UnaryCallable lookupStreamObjectCallable; + private final UnaryCallable + listStreamObjectsCallable; + private final UnaryCallable + listStreamObjectsPagedCallable; + private final UnaryCallable + startBackfillJobCallable; + private final UnaryCallable + stopBackfillJobCallable; + private final UnaryCallable fetchStaticIpsCallable; + private final UnaryCallable + fetchStaticIpsPagedCallable; + private final UnaryCallable + createPrivateConnectionCallable; + private final OperationCallable< + CreatePrivateConnectionRequest, PrivateConnection, OperationMetadata> + createPrivateConnectionOperationCallable; + private final UnaryCallable + getPrivateConnectionCallable; + private final UnaryCallable + listPrivateConnectionsCallable; + private final UnaryCallable + listPrivateConnectionsPagedCallable; + private final UnaryCallable + deletePrivateConnectionCallable; + private final OperationCallable + deletePrivateConnectionOperationCallable; + private final UnaryCallable createRouteCallable; + private final OperationCallable + createRouteOperationCallable; + private final UnaryCallable getRouteCallable; + private final UnaryCallable listRoutesCallable; + private final UnaryCallable listRoutesPagedCallable; + private final UnaryCallable deleteRouteCallable; + private final OperationCallable + deleteRouteOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonDatastreamStub create(DatastreamStubSettings settings) + throws IOException { + return new HttpJsonDatastreamStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonDatastreamStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonDatastreamStub( + DatastreamStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonDatastreamStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonDatastreamStub( + DatastreamStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonDatastreamStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonDatastreamStub(DatastreamStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonDatastreamCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonDatastreamStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonDatastreamStub( + DatastreamStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings + listConnectionProfilesTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listConnectionProfilesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getConnectionProfileTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getConnectionProfileMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createConnectionProfileTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createConnectionProfileMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateConnectionProfileTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateConnectionProfileMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + deleteConnectionProfileTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteConnectionProfileMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + discoverConnectionProfileTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(discoverConnectionProfileMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings listStreamsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listStreamsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getStreamTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getStreamMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings createStreamTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createStreamMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateStreamTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateStreamMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteStreamTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteStreamMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getStreamObjectTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getStreamObjectMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + lookupStreamObjectTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(lookupStreamObjectMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listStreamObjectsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listStreamObjectsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + startBackfillJobTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(startBackfillJobMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + stopBackfillJobTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(stopBackfillJobMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + fetchStaticIpsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(fetchStaticIpsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createPrivateConnectionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createPrivateConnectionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getPrivateConnectionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getPrivateConnectionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listPrivateConnectionsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listPrivateConnectionsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + deletePrivateConnectionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deletePrivateConnectionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings createRouteTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createRouteMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getRouteTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getRouteMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings listRoutesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listRoutesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteRouteTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteRouteMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.listConnectionProfilesCallable = + callableFactory.createUnaryCallable( + listConnectionProfilesTransportSettings, + settings.listConnectionProfilesSettings(), + clientContext); + this.listConnectionProfilesPagedCallable = + callableFactory.createPagedCallable( + listConnectionProfilesTransportSettings, + settings.listConnectionProfilesSettings(), + clientContext); + this.getConnectionProfileCallable = + callableFactory.createUnaryCallable( + getConnectionProfileTransportSettings, + settings.getConnectionProfileSettings(), + clientContext); + this.createConnectionProfileCallable = + callableFactory.createUnaryCallable( + createConnectionProfileTransportSettings, + settings.createConnectionProfileSettings(), + clientContext); + this.createConnectionProfileOperationCallable = + callableFactory.createOperationCallable( + createConnectionProfileTransportSettings, + settings.createConnectionProfileOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.updateConnectionProfileCallable = + callableFactory.createUnaryCallable( + updateConnectionProfileTransportSettings, + settings.updateConnectionProfileSettings(), + clientContext); + this.updateConnectionProfileOperationCallable = + callableFactory.createOperationCallable( + updateConnectionProfileTransportSettings, + settings.updateConnectionProfileOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deleteConnectionProfileCallable = + callableFactory.createUnaryCallable( + deleteConnectionProfileTransportSettings, + settings.deleteConnectionProfileSettings(), + clientContext); + this.deleteConnectionProfileOperationCallable = + callableFactory.createOperationCallable( + deleteConnectionProfileTransportSettings, + settings.deleteConnectionProfileOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.discoverConnectionProfileCallable = + callableFactory.createUnaryCallable( + discoverConnectionProfileTransportSettings, + settings.discoverConnectionProfileSettings(), + clientContext); + this.listStreamsCallable = + callableFactory.createUnaryCallable( + listStreamsTransportSettings, settings.listStreamsSettings(), clientContext); + this.listStreamsPagedCallable = + callableFactory.createPagedCallable( + listStreamsTransportSettings, settings.listStreamsSettings(), clientContext); + this.getStreamCallable = + callableFactory.createUnaryCallable( + getStreamTransportSettings, settings.getStreamSettings(), clientContext); + this.createStreamCallable = + callableFactory.createUnaryCallable( + createStreamTransportSettings, settings.createStreamSettings(), clientContext); + this.createStreamOperationCallable = + callableFactory.createOperationCallable( + createStreamTransportSettings, + settings.createStreamOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.updateStreamCallable = + callableFactory.createUnaryCallable( + updateStreamTransportSettings, settings.updateStreamSettings(), clientContext); + this.updateStreamOperationCallable = + callableFactory.createOperationCallable( + updateStreamTransportSettings, + settings.updateStreamOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deleteStreamCallable = + callableFactory.createUnaryCallable( + deleteStreamTransportSettings, settings.deleteStreamSettings(), clientContext); + this.deleteStreamOperationCallable = + callableFactory.createOperationCallable( + deleteStreamTransportSettings, + settings.deleteStreamOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getStreamObjectCallable = + callableFactory.createUnaryCallable( + getStreamObjectTransportSettings, settings.getStreamObjectSettings(), clientContext); + this.lookupStreamObjectCallable = + callableFactory.createUnaryCallable( + lookupStreamObjectTransportSettings, + settings.lookupStreamObjectSettings(), + clientContext); + this.listStreamObjectsCallable = + callableFactory.createUnaryCallable( + listStreamObjectsTransportSettings, + settings.listStreamObjectsSettings(), + clientContext); + this.listStreamObjectsPagedCallable = + callableFactory.createPagedCallable( + listStreamObjectsTransportSettings, + settings.listStreamObjectsSettings(), + clientContext); + this.startBackfillJobCallable = + callableFactory.createUnaryCallable( + startBackfillJobTransportSettings, settings.startBackfillJobSettings(), clientContext); + this.stopBackfillJobCallable = + callableFactory.createUnaryCallable( + stopBackfillJobTransportSettings, settings.stopBackfillJobSettings(), clientContext); + this.fetchStaticIpsCallable = + callableFactory.createUnaryCallable( + fetchStaticIpsTransportSettings, settings.fetchStaticIpsSettings(), clientContext); + this.fetchStaticIpsPagedCallable = + callableFactory.createPagedCallable( + fetchStaticIpsTransportSettings, settings.fetchStaticIpsSettings(), clientContext); + this.createPrivateConnectionCallable = + callableFactory.createUnaryCallable( + createPrivateConnectionTransportSettings, + settings.createPrivateConnectionSettings(), + clientContext); + this.createPrivateConnectionOperationCallable = + callableFactory.createOperationCallable( + createPrivateConnectionTransportSettings, + settings.createPrivateConnectionOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getPrivateConnectionCallable = + callableFactory.createUnaryCallable( + getPrivateConnectionTransportSettings, + settings.getPrivateConnectionSettings(), + clientContext); + this.listPrivateConnectionsCallable = + callableFactory.createUnaryCallable( + listPrivateConnectionsTransportSettings, + settings.listPrivateConnectionsSettings(), + clientContext); + this.listPrivateConnectionsPagedCallable = + callableFactory.createPagedCallable( + listPrivateConnectionsTransportSettings, + settings.listPrivateConnectionsSettings(), + clientContext); + this.deletePrivateConnectionCallable = + callableFactory.createUnaryCallable( + deletePrivateConnectionTransportSettings, + settings.deletePrivateConnectionSettings(), + clientContext); + this.deletePrivateConnectionOperationCallable = + callableFactory.createOperationCallable( + deletePrivateConnectionTransportSettings, + settings.deletePrivateConnectionOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.createRouteCallable = + callableFactory.createUnaryCallable( + createRouteTransportSettings, settings.createRouteSettings(), clientContext); + this.createRouteOperationCallable = + callableFactory.createOperationCallable( + createRouteTransportSettings, + settings.createRouteOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getRouteCallable = + callableFactory.createUnaryCallable( + getRouteTransportSettings, settings.getRouteSettings(), clientContext); + this.listRoutesCallable = + callableFactory.createUnaryCallable( + listRoutesTransportSettings, settings.listRoutesSettings(), clientContext); + this.listRoutesPagedCallable = + callableFactory.createPagedCallable( + listRoutesTransportSettings, settings.listRoutesSettings(), clientContext); + this.deleteRouteCallable = + callableFactory.createUnaryCallable( + deleteRouteTransportSettings, settings.deleteRouteSettings(), clientContext); + this.deleteRouteOperationCallable = + callableFactory.createOperationCallable( + deleteRouteTransportSettings, + settings.deleteRouteOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(listConnectionProfilesMethodDescriptor); + methodDescriptors.add(getConnectionProfileMethodDescriptor); + methodDescriptors.add(createConnectionProfileMethodDescriptor); + methodDescriptors.add(updateConnectionProfileMethodDescriptor); + methodDescriptors.add(deleteConnectionProfileMethodDescriptor); + methodDescriptors.add(discoverConnectionProfileMethodDescriptor); + methodDescriptors.add(listStreamsMethodDescriptor); + methodDescriptors.add(getStreamMethodDescriptor); + methodDescriptors.add(createStreamMethodDescriptor); + methodDescriptors.add(updateStreamMethodDescriptor); + methodDescriptors.add(deleteStreamMethodDescriptor); + methodDescriptors.add(getStreamObjectMethodDescriptor); + methodDescriptors.add(lookupStreamObjectMethodDescriptor); + methodDescriptors.add(listStreamObjectsMethodDescriptor); + methodDescriptors.add(startBackfillJobMethodDescriptor); + methodDescriptors.add(stopBackfillJobMethodDescriptor); + methodDescriptors.add(fetchStaticIpsMethodDescriptor); + methodDescriptors.add(createPrivateConnectionMethodDescriptor); + methodDescriptors.add(getPrivateConnectionMethodDescriptor); + methodDescriptors.add(listPrivateConnectionsMethodDescriptor); + methodDescriptors.add(deletePrivateConnectionMethodDescriptor); + methodDescriptors.add(createRouteMethodDescriptor); + methodDescriptors.add(getRouteMethodDescriptor); + methodDescriptors.add(listRoutesMethodDescriptor); + methodDescriptors.add(deleteRouteMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable + listConnectionProfilesCallable() { + return listConnectionProfilesCallable; + } + + @Override + public UnaryCallable + listConnectionProfilesPagedCallable() { + return listConnectionProfilesPagedCallable; + } + + @Override + public UnaryCallable + getConnectionProfileCallable() { + return getConnectionProfileCallable; + } + + @Override + public UnaryCallable + createConnectionProfileCallable() { + return createConnectionProfileCallable; + } + + @Override + public OperationCallable + createConnectionProfileOperationCallable() { + return createConnectionProfileOperationCallable; + } + + @Override + public UnaryCallable + updateConnectionProfileCallable() { + return updateConnectionProfileCallable; + } + + @Override + public OperationCallable + updateConnectionProfileOperationCallable() { + return updateConnectionProfileOperationCallable; + } + + @Override + public UnaryCallable + deleteConnectionProfileCallable() { + return deleteConnectionProfileCallable; + } + + @Override + public OperationCallable + deleteConnectionProfileOperationCallable() { + return deleteConnectionProfileOperationCallable; + } + + @Override + public UnaryCallable + discoverConnectionProfileCallable() { + return discoverConnectionProfileCallable; + } + + @Override + public UnaryCallable listStreamsCallable() { + return listStreamsCallable; + } + + @Override + public UnaryCallable listStreamsPagedCallable() { + return listStreamsPagedCallable; + } + + @Override + public UnaryCallable getStreamCallable() { + return getStreamCallable; + } + + @Override + public UnaryCallable createStreamCallable() { + return createStreamCallable; + } + + @Override + public OperationCallable + createStreamOperationCallable() { + return createStreamOperationCallable; + } + + @Override + public UnaryCallable updateStreamCallable() { + return updateStreamCallable; + } + + @Override + public OperationCallable + updateStreamOperationCallable() { + return updateStreamOperationCallable; + } + + @Override + public UnaryCallable deleteStreamCallable() { + return deleteStreamCallable; + } + + @Override + public OperationCallable + deleteStreamOperationCallable() { + return deleteStreamOperationCallable; + } + + @Override + public UnaryCallable getStreamObjectCallable() { + return getStreamObjectCallable; + } + + @Override + public UnaryCallable lookupStreamObjectCallable() { + return lookupStreamObjectCallable; + } + + @Override + public UnaryCallable + listStreamObjectsCallable() { + return listStreamObjectsCallable; + } + + @Override + public UnaryCallable + listStreamObjectsPagedCallable() { + return listStreamObjectsPagedCallable; + } + + @Override + public UnaryCallable + startBackfillJobCallable() { + return startBackfillJobCallable; + } + + @Override + public UnaryCallable stopBackfillJobCallable() { + return stopBackfillJobCallable; + } + + @Override + public UnaryCallable fetchStaticIpsCallable() { + return fetchStaticIpsCallable; + } + + @Override + public UnaryCallable + fetchStaticIpsPagedCallable() { + return fetchStaticIpsPagedCallable; + } + + @Override + public UnaryCallable + createPrivateConnectionCallable() { + return createPrivateConnectionCallable; + } + + @Override + public OperationCallable + createPrivateConnectionOperationCallable() { + return createPrivateConnectionOperationCallable; + } + + @Override + public UnaryCallable + getPrivateConnectionCallable() { + return getPrivateConnectionCallable; + } + + @Override + public UnaryCallable + listPrivateConnectionsCallable() { + return listPrivateConnectionsCallable; + } + + @Override + public UnaryCallable + listPrivateConnectionsPagedCallable() { + return listPrivateConnectionsPagedCallable; + } + + @Override + public UnaryCallable + deletePrivateConnectionCallable() { + return deletePrivateConnectionCallable; + } + + @Override + public OperationCallable + deletePrivateConnectionOperationCallable() { + return deletePrivateConnectionOperationCallable; + } + + @Override + public UnaryCallable createRouteCallable() { + return createRouteCallable; + } + + @Override + public OperationCallable + createRouteOperationCallable() { + return createRouteOperationCallable; + } + + @Override + public UnaryCallable getRouteCallable() { + return getRouteCallable; + } + + @Override + public UnaryCallable listRoutesCallable() { + return listRoutesCallable; + } + + @Override + public UnaryCallable listRoutesPagedCallable() { + return listRoutesPagedCallable; + } + + @Override + public UnaryCallable deleteRouteCallable() { + return deleteRouteCallable; + } + + @Override + public OperationCallable + deleteRouteOperationCallable() { + return deleteRouteOperationCallable; + } + + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/DatastreamClient.java b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/DatastreamClient.java index 8e017739..ccfa9694 100644 --- a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/DatastreamClient.java +++ b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/DatastreamClient.java @@ -20,6 +20,7 @@ import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.longrunning.OperationsClient; import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; @@ -31,7 +32,6 @@ import com.google.cloud.datastream.v1alpha1.stub.DatastreamStubSettings; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; -import com.google.longrunning.OperationsClient; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import java.io.IOException; @@ -104,6 +104,20 @@ * DatastreamClient datastreamClient = DatastreamClient.create(datastreamSettings); * } * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * DatastreamSettings datastreamSettings =
+ *     DatastreamSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             DatastreamSettings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * DatastreamClient datastreamClient = DatastreamClient.create(datastreamSettings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @BetaApi @@ -111,7 +125,8 @@ public class DatastreamClient implements BackgroundResource { private final DatastreamSettings settings; private final DatastreamStub stub; - private final OperationsClient operationsClient; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of DatastreamClient with default settings. */ public static final DatastreamClient create() throws IOException { @@ -141,13 +156,17 @@ public static final DatastreamClient create(DatastreamStub stub) { protected DatastreamClient(DatastreamSettings settings) throws IOException { this.settings = settings; this.stub = ((DatastreamStubSettings) settings.getStubSettings()).createStub(); - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } protected DatastreamClient(DatastreamStub stub) { this.settings = null; this.stub = stub; - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } public final DatastreamSettings getSettings() { @@ -162,10 +181,18 @@ public DatastreamStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - public final OperationsClient getOperationsClient() { + public final com.google.longrunning.OperationsClient getOperationsClient() { return operationsClient; } + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final OperationsClient getHttpJsonOperationsClient() { + return httpJsonOperationsClient; + } + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Use this method to list connection profiles created in a project and location. diff --git a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/DatastreamSettings.java b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/DatastreamSettings.java index 69e7b137..bd0a8f98 100644 --- a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/DatastreamSettings.java +++ b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/DatastreamSettings.java @@ -27,6 +27,7 @@ import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; @@ -293,11 +294,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return DatastreamStubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return DatastreamStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return DatastreamStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return DatastreamStubSettings.defaultTransportChannelProvider(); } @@ -307,11 +315,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return DatastreamStubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -349,6 +363,11 @@ private static Builder createDefault() { return new Builder(DatastreamStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(DatastreamStubSettings.newHttpJsonBuilder()); + } + public DatastreamStubSettings.Builder getStubSettingsBuilder() { return ((DatastreamStubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/stub/DatastreamStub.java b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/stub/DatastreamStub.java index 4fb8dac5..d95856b8 100644 --- a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/stub/DatastreamStub.java +++ b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/stub/DatastreamStub.java @@ -75,7 +75,11 @@ public abstract class DatastreamStub implements BackgroundResource { public OperationsStub getOperationsStub() { - throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); + return null; + } + + public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { + return null; } public UnaryCallable diff --git a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/stub/DatastreamStubSettings.java b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/stub/DatastreamStubSettings.java index 1620f180..09435df8 100644 --- a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/stub/DatastreamStubSettings.java +++ b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/stub/DatastreamStubSettings.java @@ -32,6 +32,9 @@ import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; import com.google.api.gax.grpc.ProtoOperationTransformers; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.longrunning.OperationSnapshot; import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; import com.google.api.gax.retrying.RetrySettings; @@ -697,6 +700,11 @@ public DatastreamStub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcDatastreamStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonDatastreamStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -729,18 +737,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde .setUseJwtAccessWithScope(true); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return InstantiatingGrpcChannelProvider.newBuilder() .setMaxInboundMessageSize(Integer.MAX_VALUE); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return defaultGrpcTransportProviderBuilder().build(); } @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken( "gapic", GaxProperties.getLibraryVersion(DatastreamStubSettings.class)) @@ -748,11 +763,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } - /** Returns a new builder for this class. */ + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(DatastreamStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return DatastreamStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -1068,6 +1102,19 @@ private static Builder createDefault() { return initDefaults(builder); } + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + private static Builder initDefaults(Builder builder) { builder .listConnectionProfilesSettings() diff --git a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/stub/HttpJsonDatastreamCallableFactory.java b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/stub/HttpJsonDatastreamCallableFactory.java new file mode 100644 index 00000000..b4cfafb1 --- /dev/null +++ b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/stub/HttpJsonDatastreamCallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the Datastream service API. + * + *

This class is for advanced usage. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonDatastreamCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/stub/HttpJsonDatastreamStub.java b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/stub/HttpJsonDatastreamStub.java new file mode 100644 index 00000000..3a1a643d --- /dev/null +++ b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/stub/HttpJsonDatastreamStub.java @@ -0,0 +1,1589 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.stub; + +import static com.google.cloud.datastream.v1alpha1.DatastreamClient.FetchStaticIpsPagedResponse; +import static com.google.cloud.datastream.v1alpha1.DatastreamClient.ListConnectionProfilesPagedResponse; +import static com.google.cloud.datastream.v1alpha1.DatastreamClient.ListPrivateConnectionsPagedResponse; +import static com.google.cloud.datastream.v1alpha1.DatastreamClient.ListRoutesPagedResponse; +import static com.google.cloud.datastream.v1alpha1.DatastreamClient.ListStreamsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshot; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.datastream.v1alpha1.ConnectionProfile; +import com.google.cloud.datastream.v1alpha1.CreateConnectionProfileRequest; +import com.google.cloud.datastream.v1alpha1.CreatePrivateConnectionRequest; +import com.google.cloud.datastream.v1alpha1.CreateRouteRequest; +import com.google.cloud.datastream.v1alpha1.CreateStreamRequest; +import com.google.cloud.datastream.v1alpha1.DeleteConnectionProfileRequest; +import com.google.cloud.datastream.v1alpha1.DeletePrivateConnectionRequest; +import com.google.cloud.datastream.v1alpha1.DeleteRouteRequest; +import com.google.cloud.datastream.v1alpha1.DeleteStreamRequest; +import com.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileRequest; +import com.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileResponse; +import com.google.cloud.datastream.v1alpha1.FetchErrorsRequest; +import com.google.cloud.datastream.v1alpha1.FetchErrorsResponse; +import com.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest; +import com.google.cloud.datastream.v1alpha1.FetchStaticIpsResponse; +import com.google.cloud.datastream.v1alpha1.GetConnectionProfileRequest; +import com.google.cloud.datastream.v1alpha1.GetPrivateConnectionRequest; +import com.google.cloud.datastream.v1alpha1.GetRouteRequest; +import com.google.cloud.datastream.v1alpha1.GetStreamRequest; +import com.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest; +import com.google.cloud.datastream.v1alpha1.ListConnectionProfilesResponse; +import com.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest; +import com.google.cloud.datastream.v1alpha1.ListPrivateConnectionsResponse; +import com.google.cloud.datastream.v1alpha1.ListRoutesRequest; +import com.google.cloud.datastream.v1alpha1.ListRoutesResponse; +import com.google.cloud.datastream.v1alpha1.ListStreamsRequest; +import com.google.cloud.datastream.v1alpha1.ListStreamsResponse; +import com.google.cloud.datastream.v1alpha1.OperationMetadata; +import com.google.cloud.datastream.v1alpha1.PrivateConnection; +import com.google.cloud.datastream.v1alpha1.Route; +import com.google.cloud.datastream.v1alpha1.Stream; +import com.google.cloud.datastream.v1alpha1.UpdateConnectionProfileRequest; +import com.google.cloud.datastream.v1alpha1.UpdateStreamRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.Empty; +import com.google.protobuf.TypeRegistry; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the Datastream service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonDatastreamStub extends DatastreamStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(Empty.getDescriptor()) + .add(OperationMetadata.getDescriptor()) + .add(Route.getDescriptor()) + .add(FetchErrorsResponse.getDescriptor()) + .add(ConnectionProfile.getDescriptor()) + .add(Stream.getDescriptor()) + .add(PrivateConnection.getDescriptor()) + .build(); + + private static final ApiMethodDescriptor< + ListConnectionProfilesRequest, ListConnectionProfilesResponse> + listConnectionProfilesMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.datastream.v1alpha1.Datastream/ListConnectionProfiles") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha1/{parent=projects/*/locations/*}/connectionProfiles", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam(fields, "orderBy", request.getOrderBy()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListConnectionProfilesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getConnectionProfileMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1alpha1.Datastream/GetConnectionProfile") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha1/{name=projects/*/locations/*/connectionProfiles/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ConnectionProfile.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createConnectionProfileMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.datastream.v1alpha1.Datastream/CreateConnectionProfile") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha1/{parent=projects/*/locations/*}/connectionProfiles", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "connectionProfileId", request.getConnectionProfileId()); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("connectionProfile", request.getConnectionProfile())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateConnectionProfileRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + updateConnectionProfileMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.datastream.v1alpha1.Datastream/UpdateConnectionProfile") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha1/{connectionProfile.name=projects/*/locations/*/connectionProfiles/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "connectionProfile.name", + request.getConnectionProfile().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("connectionProfile", request.getConnectionProfile())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateConnectionProfileRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + deleteConnectionProfileMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.datastream.v1alpha1.Datastream/DeleteConnectionProfile") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha1/{name=projects/*/locations/*/connectionProfiles/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteConnectionProfileRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor< + DiscoverConnectionProfileRequest, DiscoverConnectionProfileResponse> + discoverConnectionProfileMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.datastream.v1alpha1.Datastream/DiscoverConnectionProfile") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha1/{parent=projects/*/locations/*}/connectionProfiles:discover", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(DiscoverConnectionProfileResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listStreamsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1alpha1.Datastream/ListStreams") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha1/{parent=projects/*/locations/*}/streams", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam(fields, "orderBy", request.getOrderBy()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListStreamsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor getStreamMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1alpha1.Datastream/GetStream") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha1/{name=projects/*/locations/*/streams/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Stream.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createStreamMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1alpha1.Datastream/CreateStream") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha1/{parent=projects/*/locations/*}/streams", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "force", request.getForce()); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + serializer.putQueryParam(fields, "streamId", request.getStreamId()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create().toBody("stream", request.getStream())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateStreamRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + updateStreamMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1alpha1.Datastream/UpdateStream") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha1/{stream.name=projects/*/locations/*/streams/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "stream.name", request.getStream().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "force", request.getForce()); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create().toBody("stream", request.getStream())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateStreamRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + deleteStreamMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1alpha1.Datastream/DeleteStream") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha1/{name=projects/*/locations/*/streams/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteStreamRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + fetchErrorsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1alpha1.Datastream/FetchErrors") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha1/{stream=projects/*/locations/*/streams/*}:fetchErrors", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "stream", request.getStream()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearStream().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (FetchErrorsRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + fetchStaticIpsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1alpha1.Datastream/FetchStaticIps") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha1/{name=projects/*/locations/*}:fetchStaticIps", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(FetchStaticIpsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createPrivateConnectionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.datastream.v1alpha1.Datastream/CreatePrivateConnection") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha1/{parent=projects/*/locations/*}/privateConnections", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "privateConnectionId", request.getPrivateConnectionId()); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("privateConnection", request.getPrivateConnection())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreatePrivateConnectionRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + getPrivateConnectionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1alpha1.Datastream/GetPrivateConnection") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha1/{name=projects/*/locations/*/privateConnections/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(PrivateConnection.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListPrivateConnectionsRequest, ListPrivateConnectionsResponse> + listPrivateConnectionsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.datastream.v1alpha1.Datastream/ListPrivateConnections") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha1/{parent=projects/*/locations/*}/privateConnections", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam(fields, "orderBy", request.getOrderBy()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListPrivateConnectionsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deletePrivateConnectionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.datastream.v1alpha1.Datastream/DeletePrivateConnection") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha1/{name=projects/*/locations/*/privateConnections/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "force", request.getForce()); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeletePrivateConnectionRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + createRouteMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1alpha1.Datastream/CreateRoute") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha1/{parent=projects/*/locations/*/privateConnections/*}/routes", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + serializer.putQueryParam(fields, "routeId", request.getRouteId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create().toBody("route", request.getRoute())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateRouteRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor getRouteMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1alpha1.Datastream/GetRoute") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha1/{name=projects/*/locations/*/privateConnections/*/routes/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Route.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listRoutesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1alpha1.Datastream/ListRoutes") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha1/{parent=projects/*/locations/*/privateConnections/*}/routes", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam(fields, "orderBy", request.getOrderBy()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListRoutesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteRouteMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.datastream.v1alpha1.Datastream/DeleteRoute") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha1/{name=projects/*/locations/*/privateConnections/*/routes/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteRouteRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private final UnaryCallable + listConnectionProfilesCallable; + private final UnaryCallable + listConnectionProfilesPagedCallable; + private final UnaryCallable + getConnectionProfileCallable; + private final UnaryCallable + createConnectionProfileCallable; + private final OperationCallable< + CreateConnectionProfileRequest, ConnectionProfile, OperationMetadata> + createConnectionProfileOperationCallable; + private final UnaryCallable + updateConnectionProfileCallable; + private final OperationCallable< + UpdateConnectionProfileRequest, ConnectionProfile, OperationMetadata> + updateConnectionProfileOperationCallable; + private final UnaryCallable + deleteConnectionProfileCallable; + private final OperationCallable + deleteConnectionProfileOperationCallable; + private final UnaryCallable + discoverConnectionProfileCallable; + private final UnaryCallable listStreamsCallable; + private final UnaryCallable + listStreamsPagedCallable; + private final UnaryCallable getStreamCallable; + private final UnaryCallable createStreamCallable; + private final OperationCallable + createStreamOperationCallable; + private final UnaryCallable updateStreamCallable; + private final OperationCallable + updateStreamOperationCallable; + private final UnaryCallable deleteStreamCallable; + private final OperationCallable + deleteStreamOperationCallable; + private final UnaryCallable fetchErrorsCallable; + private final OperationCallable + fetchErrorsOperationCallable; + private final UnaryCallable fetchStaticIpsCallable; + private final UnaryCallable + fetchStaticIpsPagedCallable; + private final UnaryCallable + createPrivateConnectionCallable; + private final OperationCallable< + CreatePrivateConnectionRequest, PrivateConnection, OperationMetadata> + createPrivateConnectionOperationCallable; + private final UnaryCallable + getPrivateConnectionCallable; + private final UnaryCallable + listPrivateConnectionsCallable; + private final UnaryCallable + listPrivateConnectionsPagedCallable; + private final UnaryCallable + deletePrivateConnectionCallable; + private final OperationCallable + deletePrivateConnectionOperationCallable; + private final UnaryCallable createRouteCallable; + private final OperationCallable + createRouteOperationCallable; + private final UnaryCallable getRouteCallable; + private final UnaryCallable listRoutesCallable; + private final UnaryCallable listRoutesPagedCallable; + private final UnaryCallable deleteRouteCallable; + private final OperationCallable + deleteRouteOperationCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonDatastreamStub create(DatastreamStubSettings settings) + throws IOException { + return new HttpJsonDatastreamStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonDatastreamStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonDatastreamStub( + DatastreamStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonDatastreamStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonDatastreamStub( + DatastreamStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonDatastreamStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonDatastreamStub(DatastreamStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonDatastreamCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonDatastreamStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonDatastreamStub( + DatastreamStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings + listConnectionProfilesTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listConnectionProfilesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getConnectionProfileTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getConnectionProfileMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createConnectionProfileTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createConnectionProfileMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateConnectionProfileTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateConnectionProfileMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + deleteConnectionProfileTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteConnectionProfileMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + discoverConnectionProfileTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(discoverConnectionProfileMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings listStreamsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listStreamsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getStreamTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getStreamMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings createStreamTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createStreamMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateStreamTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateStreamMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteStreamTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteStreamMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings fetchErrorsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(fetchErrorsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + fetchStaticIpsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(fetchStaticIpsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createPrivateConnectionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createPrivateConnectionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getPrivateConnectionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getPrivateConnectionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listPrivateConnectionsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listPrivateConnectionsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + deletePrivateConnectionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deletePrivateConnectionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings createRouteTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createRouteMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getRouteTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getRouteMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings listRoutesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listRoutesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteRouteTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteRouteMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.listConnectionProfilesCallable = + callableFactory.createUnaryCallable( + listConnectionProfilesTransportSettings, + settings.listConnectionProfilesSettings(), + clientContext); + this.listConnectionProfilesPagedCallable = + callableFactory.createPagedCallable( + listConnectionProfilesTransportSettings, + settings.listConnectionProfilesSettings(), + clientContext); + this.getConnectionProfileCallable = + callableFactory.createUnaryCallable( + getConnectionProfileTransportSettings, + settings.getConnectionProfileSettings(), + clientContext); + this.createConnectionProfileCallable = + callableFactory.createUnaryCallable( + createConnectionProfileTransportSettings, + settings.createConnectionProfileSettings(), + clientContext); + this.createConnectionProfileOperationCallable = + callableFactory.createOperationCallable( + createConnectionProfileTransportSettings, + settings.createConnectionProfileOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.updateConnectionProfileCallable = + callableFactory.createUnaryCallable( + updateConnectionProfileTransportSettings, + settings.updateConnectionProfileSettings(), + clientContext); + this.updateConnectionProfileOperationCallable = + callableFactory.createOperationCallable( + updateConnectionProfileTransportSettings, + settings.updateConnectionProfileOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deleteConnectionProfileCallable = + callableFactory.createUnaryCallable( + deleteConnectionProfileTransportSettings, + settings.deleteConnectionProfileSettings(), + clientContext); + this.deleteConnectionProfileOperationCallable = + callableFactory.createOperationCallable( + deleteConnectionProfileTransportSettings, + settings.deleteConnectionProfileOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.discoverConnectionProfileCallable = + callableFactory.createUnaryCallable( + discoverConnectionProfileTransportSettings, + settings.discoverConnectionProfileSettings(), + clientContext); + this.listStreamsCallable = + callableFactory.createUnaryCallable( + listStreamsTransportSettings, settings.listStreamsSettings(), clientContext); + this.listStreamsPagedCallable = + callableFactory.createPagedCallable( + listStreamsTransportSettings, settings.listStreamsSettings(), clientContext); + this.getStreamCallable = + callableFactory.createUnaryCallable( + getStreamTransportSettings, settings.getStreamSettings(), clientContext); + this.createStreamCallable = + callableFactory.createUnaryCallable( + createStreamTransportSettings, settings.createStreamSettings(), clientContext); + this.createStreamOperationCallable = + callableFactory.createOperationCallable( + createStreamTransportSettings, + settings.createStreamOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.updateStreamCallable = + callableFactory.createUnaryCallable( + updateStreamTransportSettings, settings.updateStreamSettings(), clientContext); + this.updateStreamOperationCallable = + callableFactory.createOperationCallable( + updateStreamTransportSettings, + settings.updateStreamOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deleteStreamCallable = + callableFactory.createUnaryCallable( + deleteStreamTransportSettings, settings.deleteStreamSettings(), clientContext); + this.deleteStreamOperationCallable = + callableFactory.createOperationCallable( + deleteStreamTransportSettings, + settings.deleteStreamOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.fetchErrorsCallable = + callableFactory.createUnaryCallable( + fetchErrorsTransportSettings, settings.fetchErrorsSettings(), clientContext); + this.fetchErrorsOperationCallable = + callableFactory.createOperationCallable( + fetchErrorsTransportSettings, + settings.fetchErrorsOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.fetchStaticIpsCallable = + callableFactory.createUnaryCallable( + fetchStaticIpsTransportSettings, settings.fetchStaticIpsSettings(), clientContext); + this.fetchStaticIpsPagedCallable = + callableFactory.createPagedCallable( + fetchStaticIpsTransportSettings, settings.fetchStaticIpsSettings(), clientContext); + this.createPrivateConnectionCallable = + callableFactory.createUnaryCallable( + createPrivateConnectionTransportSettings, + settings.createPrivateConnectionSettings(), + clientContext); + this.createPrivateConnectionOperationCallable = + callableFactory.createOperationCallable( + createPrivateConnectionTransportSettings, + settings.createPrivateConnectionOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getPrivateConnectionCallable = + callableFactory.createUnaryCallable( + getPrivateConnectionTransportSettings, + settings.getPrivateConnectionSettings(), + clientContext); + this.listPrivateConnectionsCallable = + callableFactory.createUnaryCallable( + listPrivateConnectionsTransportSettings, + settings.listPrivateConnectionsSettings(), + clientContext); + this.listPrivateConnectionsPagedCallable = + callableFactory.createPagedCallable( + listPrivateConnectionsTransportSettings, + settings.listPrivateConnectionsSettings(), + clientContext); + this.deletePrivateConnectionCallable = + callableFactory.createUnaryCallable( + deletePrivateConnectionTransportSettings, + settings.deletePrivateConnectionSettings(), + clientContext); + this.deletePrivateConnectionOperationCallable = + callableFactory.createOperationCallable( + deletePrivateConnectionTransportSettings, + settings.deletePrivateConnectionOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.createRouteCallable = + callableFactory.createUnaryCallable( + createRouteTransportSettings, settings.createRouteSettings(), clientContext); + this.createRouteOperationCallable = + callableFactory.createOperationCallable( + createRouteTransportSettings, + settings.createRouteOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getRouteCallable = + callableFactory.createUnaryCallable( + getRouteTransportSettings, settings.getRouteSettings(), clientContext); + this.listRoutesCallable = + callableFactory.createUnaryCallable( + listRoutesTransportSettings, settings.listRoutesSettings(), clientContext); + this.listRoutesPagedCallable = + callableFactory.createPagedCallable( + listRoutesTransportSettings, settings.listRoutesSettings(), clientContext); + this.deleteRouteCallable = + callableFactory.createUnaryCallable( + deleteRouteTransportSettings, settings.deleteRouteSettings(), clientContext); + this.deleteRouteOperationCallable = + callableFactory.createOperationCallable( + deleteRouteTransportSettings, + settings.deleteRouteOperationSettings(), + clientContext, + httpJsonOperationsStub); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(listConnectionProfilesMethodDescriptor); + methodDescriptors.add(getConnectionProfileMethodDescriptor); + methodDescriptors.add(createConnectionProfileMethodDescriptor); + methodDescriptors.add(updateConnectionProfileMethodDescriptor); + methodDescriptors.add(deleteConnectionProfileMethodDescriptor); + methodDescriptors.add(discoverConnectionProfileMethodDescriptor); + methodDescriptors.add(listStreamsMethodDescriptor); + methodDescriptors.add(getStreamMethodDescriptor); + methodDescriptors.add(createStreamMethodDescriptor); + methodDescriptors.add(updateStreamMethodDescriptor); + methodDescriptors.add(deleteStreamMethodDescriptor); + methodDescriptors.add(fetchErrorsMethodDescriptor); + methodDescriptors.add(fetchStaticIpsMethodDescriptor); + methodDescriptors.add(createPrivateConnectionMethodDescriptor); + methodDescriptors.add(getPrivateConnectionMethodDescriptor); + methodDescriptors.add(listPrivateConnectionsMethodDescriptor); + methodDescriptors.add(deletePrivateConnectionMethodDescriptor); + methodDescriptors.add(createRouteMethodDescriptor); + methodDescriptors.add(getRouteMethodDescriptor); + methodDescriptors.add(listRoutesMethodDescriptor); + methodDescriptors.add(deleteRouteMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable + listConnectionProfilesCallable() { + return listConnectionProfilesCallable; + } + + @Override + public UnaryCallable + listConnectionProfilesPagedCallable() { + return listConnectionProfilesPagedCallable; + } + + @Override + public UnaryCallable + getConnectionProfileCallable() { + return getConnectionProfileCallable; + } + + @Override + public UnaryCallable + createConnectionProfileCallable() { + return createConnectionProfileCallable; + } + + @Override + public OperationCallable + createConnectionProfileOperationCallable() { + return createConnectionProfileOperationCallable; + } + + @Override + public UnaryCallable + updateConnectionProfileCallable() { + return updateConnectionProfileCallable; + } + + @Override + public OperationCallable + updateConnectionProfileOperationCallable() { + return updateConnectionProfileOperationCallable; + } + + @Override + public UnaryCallable + deleteConnectionProfileCallable() { + return deleteConnectionProfileCallable; + } + + @Override + public OperationCallable + deleteConnectionProfileOperationCallable() { + return deleteConnectionProfileOperationCallable; + } + + @Override + public UnaryCallable + discoverConnectionProfileCallable() { + return discoverConnectionProfileCallable; + } + + @Override + public UnaryCallable listStreamsCallable() { + return listStreamsCallable; + } + + @Override + public UnaryCallable listStreamsPagedCallable() { + return listStreamsPagedCallable; + } + + @Override + public UnaryCallable getStreamCallable() { + return getStreamCallable; + } + + @Override + public UnaryCallable createStreamCallable() { + return createStreamCallable; + } + + @Override + public OperationCallable + createStreamOperationCallable() { + return createStreamOperationCallable; + } + + @Override + public UnaryCallable updateStreamCallable() { + return updateStreamCallable; + } + + @Override + public OperationCallable + updateStreamOperationCallable() { + return updateStreamOperationCallable; + } + + @Override + public UnaryCallable deleteStreamCallable() { + return deleteStreamCallable; + } + + @Override + public OperationCallable + deleteStreamOperationCallable() { + return deleteStreamOperationCallable; + } + + @Override + public UnaryCallable fetchErrorsCallable() { + return fetchErrorsCallable; + } + + @Override + public OperationCallable + fetchErrorsOperationCallable() { + return fetchErrorsOperationCallable; + } + + @Override + public UnaryCallable fetchStaticIpsCallable() { + return fetchStaticIpsCallable; + } + + @Override + public UnaryCallable + fetchStaticIpsPagedCallable() { + return fetchStaticIpsPagedCallable; + } + + @Override + public UnaryCallable + createPrivateConnectionCallable() { + return createPrivateConnectionCallable; + } + + @Override + public OperationCallable + createPrivateConnectionOperationCallable() { + return createPrivateConnectionOperationCallable; + } + + @Override + public UnaryCallable + getPrivateConnectionCallable() { + return getPrivateConnectionCallable; + } + + @Override + public UnaryCallable + listPrivateConnectionsCallable() { + return listPrivateConnectionsCallable; + } + + @Override + public UnaryCallable + listPrivateConnectionsPagedCallable() { + return listPrivateConnectionsPagedCallable; + } + + @Override + public UnaryCallable + deletePrivateConnectionCallable() { + return deletePrivateConnectionCallable; + } + + @Override + public OperationCallable + deletePrivateConnectionOperationCallable() { + return deletePrivateConnectionOperationCallable; + } + + @Override + public UnaryCallable createRouteCallable() { + return createRouteCallable; + } + + @Override + public OperationCallable + createRouteOperationCallable() { + return createRouteOperationCallable; + } + + @Override + public UnaryCallable getRouteCallable() { + return getRouteCallable; + } + + @Override + public UnaryCallable listRoutesCallable() { + return listRoutesCallable; + } + + @Override + public UnaryCallable listRoutesPagedCallable() { + return listRoutesPagedCallable; + } + + @Override + public UnaryCallable deleteRouteCallable() { + return deleteRouteCallable; + } + + @Override + public OperationCallable + deleteRouteOperationCallable() { + return deleteRouteOperationCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-datastream/src/test/java/com/google/cloud/datastream/v1/DatastreamClientHttpJsonTest.java b/google-cloud-datastream/src/test/java/com/google/cloud/datastream/v1/DatastreamClientHttpJsonTest.java new file mode 100644 index 00000000..a79f4fcc --- /dev/null +++ b/google-cloud-datastream/src/test/java/com/google/cloud/datastream/v1/DatastreamClientHttpJsonTest.java @@ -0,0 +1,2641 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1; + +import static com.google.cloud.datastream.v1.DatastreamClient.FetchStaticIpsPagedResponse; +import static com.google.cloud.datastream.v1.DatastreamClient.ListConnectionProfilesPagedResponse; +import static com.google.cloud.datastream.v1.DatastreamClient.ListLocationsPagedResponse; +import static com.google.cloud.datastream.v1.DatastreamClient.ListPrivateConnectionsPagedResponse; +import static com.google.cloud.datastream.v1.DatastreamClient.ListRoutesPagedResponse; +import static com.google.cloud.datastream.v1.DatastreamClient.ListStreamObjectsPagedResponse; +import static com.google.cloud.datastream.v1.DatastreamClient.ListStreamsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.datastream.v1.stub.HttpJsonDatastreamStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.Any; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class DatastreamClientHttpJsonTest { + private static MockHttpService mockService; + private static DatastreamClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonDatastreamStub.getMethodDescriptors(), DatastreamSettings.getDefaultEndpoint()); + DatastreamSettings settings = + DatastreamSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + DatastreamSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = DatastreamClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void listConnectionProfilesTest() throws Exception { + ConnectionProfile responsesElement = ConnectionProfile.newBuilder().build(); + ListConnectionProfilesResponse expectedResponse = + ListConnectionProfilesResponse.newBuilder() + .setNextPageToken("") + .addAllConnectionProfiles(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListConnectionProfilesPagedResponse pagedListResponse = client.listConnectionProfiles(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getConnectionProfilesList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listConnectionProfilesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listConnectionProfiles(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listConnectionProfilesTest2() throws Exception { + ConnectionProfile responsesElement = ConnectionProfile.newBuilder().build(); + ListConnectionProfilesResponse expectedResponse = + ListConnectionProfilesResponse.newBuilder() + .setNextPageToken("") + .addAllConnectionProfiles(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListConnectionProfilesPagedResponse pagedListResponse = client.listConnectionProfiles(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getConnectionProfilesList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listConnectionProfilesExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listConnectionProfiles(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getConnectionProfileTest() throws Exception { + ConnectionProfile expectedResponse = + ConnectionProfile.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .build(); + mockService.addResponse(expectedResponse); + + ConnectionProfileName name = + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]"); + + ConnectionProfile actualResponse = client.getConnectionProfile(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getConnectionProfileExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ConnectionProfileName name = + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]"); + client.getConnectionProfile(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getConnectionProfileTest2() throws Exception { + ConnectionProfile expectedResponse = + ConnectionProfile.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-9560/locations/location-9560/connectionProfiles/connectionProfile-9560"; + + ConnectionProfile actualResponse = client.getConnectionProfile(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getConnectionProfileExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-9560/locations/location-9560/connectionProfiles/connectionProfile-9560"; + client.getConnectionProfile(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createConnectionProfileTest() throws Exception { + ConnectionProfile expectedResponse = + ConnectionProfile.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createConnectionProfileTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + ConnectionProfile connectionProfile = ConnectionProfile.newBuilder().build(); + String connectionProfileId = "connectionProfileId597575526"; + + ConnectionProfile actualResponse = + client.createConnectionProfileAsync(parent, connectionProfile, connectionProfileId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createConnectionProfileExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + ConnectionProfile connectionProfile = ConnectionProfile.newBuilder().build(); + String connectionProfileId = "connectionProfileId597575526"; + client.createConnectionProfileAsync(parent, connectionProfile, connectionProfileId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createConnectionProfileTest2() throws Exception { + ConnectionProfile expectedResponse = + ConnectionProfile.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createConnectionProfileTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + ConnectionProfile connectionProfile = ConnectionProfile.newBuilder().build(); + String connectionProfileId = "connectionProfileId597575526"; + + ConnectionProfile actualResponse = + client.createConnectionProfileAsync(parent, connectionProfile, connectionProfileId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createConnectionProfileExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + ConnectionProfile connectionProfile = ConnectionProfile.newBuilder().build(); + String connectionProfileId = "connectionProfileId597575526"; + client.createConnectionProfileAsync(parent, connectionProfile, connectionProfileId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void updateConnectionProfileTest() throws Exception { + ConnectionProfile expectedResponse = + ConnectionProfile.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateConnectionProfileTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + ConnectionProfile connectionProfile = + ConnectionProfile.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + ConnectionProfile actualResponse = + client.updateConnectionProfileAsync(connectionProfile, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateConnectionProfileExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ConnectionProfile connectionProfile = + ConnectionProfile.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateConnectionProfileAsync(connectionProfile, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteConnectionProfileTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteConnectionProfileTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + ConnectionProfileName name = + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]"); + + client.deleteConnectionProfileAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteConnectionProfileExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ConnectionProfileName name = + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]"); + client.deleteConnectionProfileAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteConnectionProfileTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteConnectionProfileTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-9560/locations/location-9560/connectionProfiles/connectionProfile-9560"; + + client.deleteConnectionProfileAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteConnectionProfileExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-9560/locations/location-9560/connectionProfiles/connectionProfile-9560"; + client.deleteConnectionProfileAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void discoverConnectionProfileTest() throws Exception { + DiscoverConnectionProfileResponse expectedResponse = + DiscoverConnectionProfileResponse.newBuilder().build(); + mockService.addResponse(expectedResponse); + + DiscoverConnectionProfileRequest request = + DiscoverConnectionProfileRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + + DiscoverConnectionProfileResponse actualResponse = client.discoverConnectionProfile(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void discoverConnectionProfileExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + DiscoverConnectionProfileRequest request = + DiscoverConnectionProfileRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + client.discoverConnectionProfile(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listStreamsTest() throws Exception { + Stream responsesElement = Stream.newBuilder().build(); + ListStreamsResponse expectedResponse = + ListStreamsResponse.newBuilder() + .setNextPageToken("") + .addAllStreams(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListStreamsPagedResponse pagedListResponse = client.listStreams(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getStreamsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listStreamsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listStreams(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listStreamsTest2() throws Exception { + Stream responsesElement = Stream.newBuilder().build(); + ListStreamsResponse expectedResponse = + ListStreamsResponse.newBuilder() + .setNextPageToken("") + .addAllStreams(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListStreamsPagedResponse pagedListResponse = client.listStreams(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getStreamsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listStreamsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listStreams(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getStreamTest() throws Exception { + Stream expectedResponse = + Stream.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setSourceConfig(SourceConfig.newBuilder().build()) + .setDestinationConfig(DestinationConfig.newBuilder().build()) + .addAllErrors(new ArrayList()) + .setCustomerManagedEncryptionKey("customerManagedEncryptionKey-709617797") + .build(); + mockService.addResponse(expectedResponse); + + StreamName name = StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]"); + + Stream actualResponse = client.getStream(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getStreamExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + StreamName name = StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]"); + client.getStream(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getStreamTest2() throws Exception { + Stream expectedResponse = + Stream.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setSourceConfig(SourceConfig.newBuilder().build()) + .setDestinationConfig(DestinationConfig.newBuilder().build()) + .addAllErrors(new ArrayList()) + .setCustomerManagedEncryptionKey("customerManagedEncryptionKey-709617797") + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-3433/locations/location-3433/streams/stream-3433"; + + Stream actualResponse = client.getStream(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getStreamExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3433/locations/location-3433/streams/stream-3433"; + client.getStream(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createStreamTest() throws Exception { + Stream expectedResponse = + Stream.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setSourceConfig(SourceConfig.newBuilder().build()) + .setDestinationConfig(DestinationConfig.newBuilder().build()) + .addAllErrors(new ArrayList()) + .setCustomerManagedEncryptionKey("customerManagedEncryptionKey-709617797") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createStreamTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Stream stream = Stream.newBuilder().build(); + String streamId = "streamId1790933179"; + + Stream actualResponse = client.createStreamAsync(parent, stream, streamId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createStreamExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Stream stream = Stream.newBuilder().build(); + String streamId = "streamId1790933179"; + client.createStreamAsync(parent, stream, streamId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createStreamTest2() throws Exception { + Stream expectedResponse = + Stream.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setSourceConfig(SourceConfig.newBuilder().build()) + .setDestinationConfig(DestinationConfig.newBuilder().build()) + .addAllErrors(new ArrayList()) + .setCustomerManagedEncryptionKey("customerManagedEncryptionKey-709617797") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createStreamTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + Stream stream = Stream.newBuilder().build(); + String streamId = "streamId1790933179"; + + Stream actualResponse = client.createStreamAsync(parent, stream, streamId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createStreamExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + Stream stream = Stream.newBuilder().build(); + String streamId = "streamId1790933179"; + client.createStreamAsync(parent, stream, streamId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void updateStreamTest() throws Exception { + Stream expectedResponse = + Stream.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setSourceConfig(SourceConfig.newBuilder().build()) + .setDestinationConfig(DestinationConfig.newBuilder().build()) + .addAllErrors(new ArrayList()) + .setCustomerManagedEncryptionKey("customerManagedEncryptionKey-709617797") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateStreamTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + Stream stream = + Stream.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setSourceConfig(SourceConfig.newBuilder().build()) + .setDestinationConfig(DestinationConfig.newBuilder().build()) + .addAllErrors(new ArrayList()) + .setCustomerManagedEncryptionKey("customerManagedEncryptionKey-709617797") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Stream actualResponse = client.updateStreamAsync(stream, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateStreamExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Stream stream = + Stream.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setSourceConfig(SourceConfig.newBuilder().build()) + .setDestinationConfig(DestinationConfig.newBuilder().build()) + .addAllErrors(new ArrayList()) + .setCustomerManagedEncryptionKey("customerManagedEncryptionKey-709617797") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateStreamAsync(stream, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteStreamTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteStreamTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + StreamName name = StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]"); + + client.deleteStreamAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteStreamExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + StreamName name = StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]"); + client.deleteStreamAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteStreamTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteStreamTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-3433/locations/location-3433/streams/stream-3433"; + + client.deleteStreamAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteStreamExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3433/locations/location-3433/streams/stream-3433"; + client.deleteStreamAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getStreamObjectTest() throws Exception { + StreamObject expectedResponse = + StreamObject.newBuilder() + .setName( + StreamObjectName.of("[PROJECT]", "[LOCATION]", "[STREAM]", "[OBJECT]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDisplayName("displayName1714148973") + .addAllErrors(new ArrayList()) + .setBackfillJob(BackfillJob.newBuilder().build()) + .setSourceObject(SourceObjectIdentifier.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + StreamObjectName name = StreamObjectName.of("[PROJECT]", "[LOCATION]", "[STREAM]", "[OBJECT]"); + + StreamObject actualResponse = client.getStreamObject(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getStreamObjectExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + StreamObjectName name = + StreamObjectName.of("[PROJECT]", "[LOCATION]", "[STREAM]", "[OBJECT]"); + client.getStreamObject(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getStreamObjectTest2() throws Exception { + StreamObject expectedResponse = + StreamObject.newBuilder() + .setName( + StreamObjectName.of("[PROJECT]", "[LOCATION]", "[STREAM]", "[OBJECT]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDisplayName("displayName1714148973") + .addAllErrors(new ArrayList()) + .setBackfillJob(BackfillJob.newBuilder().build()) + .setSourceObject(SourceObjectIdentifier.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-6471/locations/location-6471/streams/stream-6471/objects/object-6471"; + + StreamObject actualResponse = client.getStreamObject(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getStreamObjectExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-6471/locations/location-6471/streams/stream-6471/objects/object-6471"; + client.getStreamObject(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void lookupStreamObjectTest() throws Exception { + StreamObject expectedResponse = + StreamObject.newBuilder() + .setName( + StreamObjectName.of("[PROJECT]", "[LOCATION]", "[STREAM]", "[OBJECT]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDisplayName("displayName1714148973") + .addAllErrors(new ArrayList()) + .setBackfillJob(BackfillJob.newBuilder().build()) + .setSourceObject(SourceObjectIdentifier.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + LookupStreamObjectRequest request = + LookupStreamObjectRequest.newBuilder() + .setParent(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setSourceObjectIdentifier(SourceObjectIdentifier.newBuilder().build()) + .build(); + + StreamObject actualResponse = client.lookupStreamObject(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void lookupStreamObjectExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LookupStreamObjectRequest request = + LookupStreamObjectRequest.newBuilder() + .setParent(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setSourceObjectIdentifier(SourceObjectIdentifier.newBuilder().build()) + .build(); + client.lookupStreamObject(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listStreamObjectsTest() throws Exception { + StreamObject responsesElement = StreamObject.newBuilder().build(); + ListStreamObjectsResponse expectedResponse = + ListStreamObjectsResponse.newBuilder() + .setNextPageToken("") + .addAllStreamObjects(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + StreamName parent = StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]"); + + ListStreamObjectsPagedResponse pagedListResponse = client.listStreamObjects(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getStreamObjectsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listStreamObjectsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + StreamName parent = StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]"); + client.listStreamObjects(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listStreamObjectsTest2() throws Exception { + StreamObject responsesElement = StreamObject.newBuilder().build(); + ListStreamObjectsResponse expectedResponse = + ListStreamObjectsResponse.newBuilder() + .setNextPageToken("") + .addAllStreamObjects(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-7224/locations/location-7224/streams/stream-7224"; + + ListStreamObjectsPagedResponse pagedListResponse = client.listStreamObjects(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getStreamObjectsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listStreamObjectsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-7224/locations/location-7224/streams/stream-7224"; + client.listStreamObjects(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void startBackfillJobTest() throws Exception { + StartBackfillJobResponse expectedResponse = + StartBackfillJobResponse.newBuilder().setObject(StreamObject.newBuilder().build()).build(); + mockService.addResponse(expectedResponse); + + StreamObjectName object = + StreamObjectName.of("[PROJECT]", "[LOCATION]", "[STREAM]", "[OBJECT]"); + + StartBackfillJobResponse actualResponse = client.startBackfillJob(object); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void startBackfillJobExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + StreamObjectName object = + StreamObjectName.of("[PROJECT]", "[LOCATION]", "[STREAM]", "[OBJECT]"); + client.startBackfillJob(object); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void startBackfillJobTest2() throws Exception { + StartBackfillJobResponse expectedResponse = + StartBackfillJobResponse.newBuilder().setObject(StreamObject.newBuilder().build()).build(); + mockService.addResponse(expectedResponse); + + String object = "projects/project-45/locations/location-45/streams/stream-45/objects/object-45"; + + StartBackfillJobResponse actualResponse = client.startBackfillJob(object); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void startBackfillJobExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String object = + "projects/project-45/locations/location-45/streams/stream-45/objects/object-45"; + client.startBackfillJob(object); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void stopBackfillJobTest() throws Exception { + StopBackfillJobResponse expectedResponse = + StopBackfillJobResponse.newBuilder().setObject(StreamObject.newBuilder().build()).build(); + mockService.addResponse(expectedResponse); + + StreamObjectName object = + StreamObjectName.of("[PROJECT]", "[LOCATION]", "[STREAM]", "[OBJECT]"); + + StopBackfillJobResponse actualResponse = client.stopBackfillJob(object); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void stopBackfillJobExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + StreamObjectName object = + StreamObjectName.of("[PROJECT]", "[LOCATION]", "[STREAM]", "[OBJECT]"); + client.stopBackfillJob(object); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void stopBackfillJobTest2() throws Exception { + StopBackfillJobResponse expectedResponse = + StopBackfillJobResponse.newBuilder().setObject(StreamObject.newBuilder().build()).build(); + mockService.addResponse(expectedResponse); + + String object = "projects/project-45/locations/location-45/streams/stream-45/objects/object-45"; + + StopBackfillJobResponse actualResponse = client.stopBackfillJob(object); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void stopBackfillJobExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String object = + "projects/project-45/locations/location-45/streams/stream-45/objects/object-45"; + client.stopBackfillJob(object); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void fetchStaticIpsTest() throws Exception { + String responsesElement = "responsesElement-318365110"; + FetchStaticIpsResponse expectedResponse = + FetchStaticIpsResponse.newBuilder() + .setNextPageToken("") + .addAllStaticIps(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName name = LocationName.of("[PROJECT]", "[LOCATION]"); + + FetchStaticIpsPagedResponse pagedListResponse = client.fetchStaticIps(name); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getStaticIpsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void fetchStaticIpsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName name = LocationName.of("[PROJECT]", "[LOCATION]"); + client.fetchStaticIps(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void fetchStaticIpsTest2() throws Exception { + String responsesElement = "responsesElement-318365110"; + FetchStaticIpsResponse expectedResponse = + FetchStaticIpsResponse.newBuilder() + .setNextPageToken("") + .addAllStaticIps(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-9062/locations/location-9062"; + + FetchStaticIpsPagedResponse pagedListResponse = client.fetchStaticIps(name); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getStaticIpsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void fetchStaticIpsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-9062/locations/location-9062"; + client.fetchStaticIps(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createPrivateConnectionTest() throws Exception { + PrivateConnection expectedResponse = + PrivateConnection.newBuilder() + .setName( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setError(Error.newBuilder().build()) + .setVpcPeeringConfig(VpcPeeringConfig.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createPrivateConnectionTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + PrivateConnection privateConnection = PrivateConnection.newBuilder().build(); + String privateConnectionId = "privateConnectionId-1926654532"; + + PrivateConnection actualResponse = + client.createPrivateConnectionAsync(parent, privateConnection, privateConnectionId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createPrivateConnectionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + PrivateConnection privateConnection = PrivateConnection.newBuilder().build(); + String privateConnectionId = "privateConnectionId-1926654532"; + client.createPrivateConnectionAsync(parent, privateConnection, privateConnectionId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createPrivateConnectionTest2() throws Exception { + PrivateConnection expectedResponse = + PrivateConnection.newBuilder() + .setName( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setError(Error.newBuilder().build()) + .setVpcPeeringConfig(VpcPeeringConfig.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createPrivateConnectionTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + PrivateConnection privateConnection = PrivateConnection.newBuilder().build(); + String privateConnectionId = "privateConnectionId-1926654532"; + + PrivateConnection actualResponse = + client.createPrivateConnectionAsync(parent, privateConnection, privateConnectionId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createPrivateConnectionExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + PrivateConnection privateConnection = PrivateConnection.newBuilder().build(); + String privateConnectionId = "privateConnectionId-1926654532"; + client.createPrivateConnectionAsync(parent, privateConnection, privateConnectionId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getPrivateConnectionTest() throws Exception { + PrivateConnection expectedResponse = + PrivateConnection.newBuilder() + .setName( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setError(Error.newBuilder().build()) + .setVpcPeeringConfig(VpcPeeringConfig.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PrivateConnectionName name = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + + PrivateConnection actualResponse = client.getPrivateConnection(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getPrivateConnectionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PrivateConnectionName name = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + client.getPrivateConnection(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPrivateConnectionTest2() throws Exception { + PrivateConnection expectedResponse = + PrivateConnection.newBuilder() + .setName( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setError(Error.newBuilder().build()) + .setVpcPeeringConfig(VpcPeeringConfig.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-9090/locations/location-9090/privateConnections/privateConnection-9090"; + + PrivateConnection actualResponse = client.getPrivateConnection(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getPrivateConnectionExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-9090/locations/location-9090/privateConnections/privateConnection-9090"; + client.getPrivateConnection(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listPrivateConnectionsTest() throws Exception { + PrivateConnection responsesElement = PrivateConnection.newBuilder().build(); + ListPrivateConnectionsResponse expectedResponse = + ListPrivateConnectionsResponse.newBuilder() + .setNextPageToken("") + .addAllPrivateConnections(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListPrivateConnectionsPagedResponse pagedListResponse = client.listPrivateConnections(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPrivateConnectionsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listPrivateConnectionsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listPrivateConnections(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listPrivateConnectionsTest2() throws Exception { + PrivateConnection responsesElement = PrivateConnection.newBuilder().build(); + ListPrivateConnectionsResponse expectedResponse = + ListPrivateConnectionsResponse.newBuilder() + .setNextPageToken("") + .addAllPrivateConnections(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListPrivateConnectionsPagedResponse pagedListResponse = client.listPrivateConnections(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPrivateConnectionsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listPrivateConnectionsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listPrivateConnections(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deletePrivateConnectionTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deletePrivateConnectionTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + PrivateConnectionName name = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + + client.deletePrivateConnectionAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deletePrivateConnectionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PrivateConnectionName name = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + client.deletePrivateConnectionAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deletePrivateConnectionTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deletePrivateConnectionTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-9090/locations/location-9090/privateConnections/privateConnection-9090"; + + client.deletePrivateConnectionAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deletePrivateConnectionExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-9090/locations/location-9090/privateConnections/privateConnection-9090"; + client.deletePrivateConnectionAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createRouteTest() throws Exception { + Route expectedResponse = + Route.newBuilder() + .setName( + RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setDestinationAddress("destinationAddress1736827910") + .setDestinationPort(1205298706) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createRouteTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + PrivateConnectionName parent = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + Route route = Route.newBuilder().build(); + String routeId = "routeId1385647428"; + + Route actualResponse = client.createRouteAsync(parent, route, routeId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createRouteExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PrivateConnectionName parent = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + Route route = Route.newBuilder().build(); + String routeId = "routeId1385647428"; + client.createRouteAsync(parent, route, routeId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createRouteTest2() throws Exception { + Route expectedResponse = + Route.newBuilder() + .setName( + RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setDestinationAddress("destinationAddress1736827910") + .setDestinationPort(1205298706) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createRouteTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = + "projects/project-9165/locations/location-9165/privateConnections/privateConnection-9165"; + Route route = Route.newBuilder().build(); + String routeId = "routeId1385647428"; + + Route actualResponse = client.createRouteAsync(parent, route, routeId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createRouteExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = + "projects/project-9165/locations/location-9165/privateConnections/privateConnection-9165"; + Route route = Route.newBuilder().build(); + String routeId = "routeId1385647428"; + client.createRouteAsync(parent, route, routeId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getRouteTest() throws Exception { + Route expectedResponse = + Route.newBuilder() + .setName( + RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setDestinationAddress("destinationAddress1736827910") + .setDestinationPort(1205298706) + .build(); + mockService.addResponse(expectedResponse); + + RouteName name = RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]"); + + Route actualResponse = client.getRoute(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getRouteExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RouteName name = RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]"); + client.getRoute(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getRouteTest2() throws Exception { + Route expectedResponse = + Route.newBuilder() + .setName( + RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setDestinationAddress("destinationAddress1736827910") + .setDestinationPort(1205298706) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-9342/locations/location-9342/privateConnections/privateConnection-9342/routes/route-9342"; + + Route actualResponse = client.getRoute(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getRouteExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-9342/locations/location-9342/privateConnections/privateConnection-9342/routes/route-9342"; + client.getRoute(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listRoutesTest() throws Exception { + Route responsesElement = Route.newBuilder().build(); + ListRoutesResponse expectedResponse = + ListRoutesResponse.newBuilder() + .setNextPageToken("") + .addAllRoutes(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + PrivateConnectionName parent = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + + ListRoutesPagedResponse pagedListResponse = client.listRoutes(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getRoutesList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listRoutesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PrivateConnectionName parent = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + client.listRoutes(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listRoutesTest2() throws Exception { + Route responsesElement = Route.newBuilder().build(); + ListRoutesResponse expectedResponse = + ListRoutesResponse.newBuilder() + .setNextPageToken("") + .addAllRoutes(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = + "projects/project-9165/locations/location-9165/privateConnections/privateConnection-9165"; + + ListRoutesPagedResponse pagedListResponse = client.listRoutes(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getRoutesList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listRoutesExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = + "projects/project-9165/locations/location-9165/privateConnections/privateConnection-9165"; + client.listRoutes(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteRouteTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteRouteTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RouteName name = RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]"); + + client.deleteRouteAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteRouteExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RouteName name = RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]"); + client.deleteRouteAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteRouteTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteRouteTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-9342/locations/location-9342/privateConnections/privateConnection-9342/routes/route-9342"; + + client.deleteRouteAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteRouteExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-9342/locations/location-9342/privateConnections/privateConnection-9342/routes/route-9342"; + client.deleteRouteAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/google-cloud-datastream/src/test/java/com/google/cloud/datastream/v1alpha1/DatastreamClientHttpJsonTest.java b/google-cloud-datastream/src/test/java/com/google/cloud/datastream/v1alpha1/DatastreamClientHttpJsonTest.java new file mode 100644 index 00000000..1c6e6125 --- /dev/null +++ b/google-cloud-datastream/src/test/java/com/google/cloud/datastream/v1alpha1/DatastreamClientHttpJsonTest.java @@ -0,0 +1,2127 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1; + +import static com.google.cloud.datastream.v1alpha1.DatastreamClient.FetchStaticIpsPagedResponse; +import static com.google.cloud.datastream.v1alpha1.DatastreamClient.ListConnectionProfilesPagedResponse; +import static com.google.cloud.datastream.v1alpha1.DatastreamClient.ListPrivateConnectionsPagedResponse; +import static com.google.cloud.datastream.v1alpha1.DatastreamClient.ListRoutesPagedResponse; +import static com.google.cloud.datastream.v1alpha1.DatastreamClient.ListStreamsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.datastream.v1alpha1.stub.HttpJsonDatastreamStub; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.Any; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class DatastreamClientHttpJsonTest { + private static MockHttpService mockService; + private static DatastreamClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonDatastreamStub.getMethodDescriptors(), DatastreamSettings.getDefaultEndpoint()); + DatastreamSettings settings = + DatastreamSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + DatastreamSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = DatastreamClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void listConnectionProfilesTest() throws Exception { + ConnectionProfile responsesElement = ConnectionProfile.newBuilder().build(); + ListConnectionProfilesResponse expectedResponse = + ListConnectionProfilesResponse.newBuilder() + .setNextPageToken("") + .addAllConnectionProfiles(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListConnectionProfilesPagedResponse pagedListResponse = client.listConnectionProfiles(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getConnectionProfilesList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listConnectionProfilesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listConnectionProfiles(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listConnectionProfilesTest2() throws Exception { + ConnectionProfile responsesElement = ConnectionProfile.newBuilder().build(); + ListConnectionProfilesResponse expectedResponse = + ListConnectionProfilesResponse.newBuilder() + .setNextPageToken("") + .addAllConnectionProfiles(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListConnectionProfilesPagedResponse pagedListResponse = client.listConnectionProfiles(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getConnectionProfilesList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listConnectionProfilesExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listConnectionProfiles(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getConnectionProfileTest() throws Exception { + ConnectionProfile expectedResponse = + ConnectionProfile.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .build(); + mockService.addResponse(expectedResponse); + + ConnectionProfileName name = + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]"); + + ConnectionProfile actualResponse = client.getConnectionProfile(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getConnectionProfileExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ConnectionProfileName name = + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]"); + client.getConnectionProfile(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getConnectionProfileTest2() throws Exception { + ConnectionProfile expectedResponse = + ConnectionProfile.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-9560/locations/location-9560/connectionProfiles/connectionProfile-9560"; + + ConnectionProfile actualResponse = client.getConnectionProfile(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getConnectionProfileExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-9560/locations/location-9560/connectionProfiles/connectionProfile-9560"; + client.getConnectionProfile(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createConnectionProfileTest() throws Exception { + ConnectionProfile expectedResponse = + ConnectionProfile.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createConnectionProfileTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + ConnectionProfile connectionProfile = ConnectionProfile.newBuilder().build(); + String connectionProfileId = "connectionProfileId597575526"; + + ConnectionProfile actualResponse = + client.createConnectionProfileAsync(parent, connectionProfile, connectionProfileId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createConnectionProfileExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + ConnectionProfile connectionProfile = ConnectionProfile.newBuilder().build(); + String connectionProfileId = "connectionProfileId597575526"; + client.createConnectionProfileAsync(parent, connectionProfile, connectionProfileId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createConnectionProfileTest2() throws Exception { + ConnectionProfile expectedResponse = + ConnectionProfile.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createConnectionProfileTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + ConnectionProfile connectionProfile = ConnectionProfile.newBuilder().build(); + String connectionProfileId = "connectionProfileId597575526"; + + ConnectionProfile actualResponse = + client.createConnectionProfileAsync(parent, connectionProfile, connectionProfileId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createConnectionProfileExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + ConnectionProfile connectionProfile = ConnectionProfile.newBuilder().build(); + String connectionProfileId = "connectionProfileId597575526"; + client.createConnectionProfileAsync(parent, connectionProfile, connectionProfileId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void updateConnectionProfileTest() throws Exception { + ConnectionProfile expectedResponse = + ConnectionProfile.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateConnectionProfileTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + ConnectionProfile connectionProfile = + ConnectionProfile.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + ConnectionProfile actualResponse = + client.updateConnectionProfileAsync(connectionProfile, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateConnectionProfileExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ConnectionProfile connectionProfile = + ConnectionProfile.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateConnectionProfileAsync(connectionProfile, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteConnectionProfileTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteConnectionProfileTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + ConnectionProfileName name = + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]"); + + client.deleteConnectionProfileAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteConnectionProfileExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ConnectionProfileName name = + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]"); + client.deleteConnectionProfileAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteConnectionProfileTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteConnectionProfileTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-9560/locations/location-9560/connectionProfiles/connectionProfile-9560"; + + client.deleteConnectionProfileAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteConnectionProfileExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-9560/locations/location-9560/connectionProfiles/connectionProfile-9560"; + client.deleteConnectionProfileAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void discoverConnectionProfileTest() throws Exception { + DiscoverConnectionProfileResponse expectedResponse = + DiscoverConnectionProfileResponse.newBuilder().build(); + mockService.addResponse(expectedResponse); + + DiscoverConnectionProfileRequest request = + DiscoverConnectionProfileRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + + DiscoverConnectionProfileResponse actualResponse = client.discoverConnectionProfile(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void discoverConnectionProfileExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + DiscoverConnectionProfileRequest request = + DiscoverConnectionProfileRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + client.discoverConnectionProfile(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listStreamsTest() throws Exception { + Stream responsesElement = Stream.newBuilder().build(); + ListStreamsResponse expectedResponse = + ListStreamsResponse.newBuilder() + .setNextPageToken("") + .addAllStreams(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListStreamsPagedResponse pagedListResponse = client.listStreams(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getStreamsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listStreamsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listStreams(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listStreamsTest2() throws Exception { + Stream responsesElement = Stream.newBuilder().build(); + ListStreamsResponse expectedResponse = + ListStreamsResponse.newBuilder() + .setNextPageToken("") + .addAllStreams(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListStreamsPagedResponse pagedListResponse = client.listStreams(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getStreamsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listStreamsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listStreams(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getStreamTest() throws Exception { + Stream expectedResponse = + Stream.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setSourceConfig(SourceConfig.newBuilder().build()) + .setDestinationConfig(DestinationConfig.newBuilder().build()) + .addAllErrors(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + StreamName name = StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]"); + + Stream actualResponse = client.getStream(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getStreamExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + StreamName name = StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]"); + client.getStream(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getStreamTest2() throws Exception { + Stream expectedResponse = + Stream.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setSourceConfig(SourceConfig.newBuilder().build()) + .setDestinationConfig(DestinationConfig.newBuilder().build()) + .addAllErrors(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-3433/locations/location-3433/streams/stream-3433"; + + Stream actualResponse = client.getStream(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getStreamExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3433/locations/location-3433/streams/stream-3433"; + client.getStream(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createStreamTest() throws Exception { + Stream expectedResponse = + Stream.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setSourceConfig(SourceConfig.newBuilder().build()) + .setDestinationConfig(DestinationConfig.newBuilder().build()) + .addAllErrors(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createStreamTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Stream stream = Stream.newBuilder().build(); + String streamId = "streamId1790933179"; + + Stream actualResponse = client.createStreamAsync(parent, stream, streamId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createStreamExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Stream stream = Stream.newBuilder().build(); + String streamId = "streamId1790933179"; + client.createStreamAsync(parent, stream, streamId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createStreamTest2() throws Exception { + Stream expectedResponse = + Stream.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setSourceConfig(SourceConfig.newBuilder().build()) + .setDestinationConfig(DestinationConfig.newBuilder().build()) + .addAllErrors(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createStreamTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + Stream stream = Stream.newBuilder().build(); + String streamId = "streamId1790933179"; + + Stream actualResponse = client.createStreamAsync(parent, stream, streamId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createStreamExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + Stream stream = Stream.newBuilder().build(); + String streamId = "streamId1790933179"; + client.createStreamAsync(parent, stream, streamId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void updateStreamTest() throws Exception { + Stream expectedResponse = + Stream.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setSourceConfig(SourceConfig.newBuilder().build()) + .setDestinationConfig(DestinationConfig.newBuilder().build()) + .addAllErrors(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateStreamTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + Stream stream = + Stream.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setSourceConfig(SourceConfig.newBuilder().build()) + .setDestinationConfig(DestinationConfig.newBuilder().build()) + .addAllErrors(new ArrayList()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Stream actualResponse = client.updateStreamAsync(stream, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateStreamExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Stream stream = + Stream.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setSourceConfig(SourceConfig.newBuilder().build()) + .setDestinationConfig(DestinationConfig.newBuilder().build()) + .addAllErrors(new ArrayList()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateStreamAsync(stream, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteStreamTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteStreamTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + StreamName name = StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]"); + + client.deleteStreamAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteStreamExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + StreamName name = StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]"); + client.deleteStreamAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteStreamTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteStreamTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-3433/locations/location-3433/streams/stream-3433"; + + client.deleteStreamAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteStreamExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3433/locations/location-3433/streams/stream-3433"; + client.deleteStreamAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void fetchErrorsTest() throws Exception { + FetchErrorsResponse expectedResponse = + FetchErrorsResponse.newBuilder().addAllErrors(new ArrayList()).build(); + Operation resultOperation = + Operation.newBuilder() + .setName("fetchErrorsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + FetchErrorsRequest request = + FetchErrorsRequest.newBuilder() + .setStream(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .build(); + + FetchErrorsResponse actualResponse = client.fetchErrorsAsync(request).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void fetchErrorsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + FetchErrorsRequest request = + FetchErrorsRequest.newBuilder() + .setStream(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .build(); + client.fetchErrorsAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void fetchStaticIpsTest() throws Exception { + String responsesElement = "responsesElement-318365110"; + FetchStaticIpsResponse expectedResponse = + FetchStaticIpsResponse.newBuilder() + .setNextPageToken("") + .addAllStaticIps(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName name = LocationName.of("[PROJECT]", "[LOCATION]"); + + FetchStaticIpsPagedResponse pagedListResponse = client.fetchStaticIps(name); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getStaticIpsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void fetchStaticIpsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName name = LocationName.of("[PROJECT]", "[LOCATION]"); + client.fetchStaticIps(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void fetchStaticIpsTest2() throws Exception { + String responsesElement = "responsesElement-318365110"; + FetchStaticIpsResponse expectedResponse = + FetchStaticIpsResponse.newBuilder() + .setNextPageToken("") + .addAllStaticIps(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-9062/locations/location-9062"; + + FetchStaticIpsPagedResponse pagedListResponse = client.fetchStaticIps(name); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getStaticIpsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void fetchStaticIpsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-9062/locations/location-9062"; + client.fetchStaticIps(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createPrivateConnectionTest() throws Exception { + PrivateConnection expectedResponse = + PrivateConnection.newBuilder() + .setName( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setError(Error.newBuilder().build()) + .setVpcPeeringConfig(VpcPeeringConfig.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createPrivateConnectionTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + PrivateConnection privateConnection = PrivateConnection.newBuilder().build(); + String privateConnectionId = "privateConnectionId-1926654532"; + + PrivateConnection actualResponse = + client.createPrivateConnectionAsync(parent, privateConnection, privateConnectionId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createPrivateConnectionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + PrivateConnection privateConnection = PrivateConnection.newBuilder().build(); + String privateConnectionId = "privateConnectionId-1926654532"; + client.createPrivateConnectionAsync(parent, privateConnection, privateConnectionId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createPrivateConnectionTest2() throws Exception { + PrivateConnection expectedResponse = + PrivateConnection.newBuilder() + .setName( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setError(Error.newBuilder().build()) + .setVpcPeeringConfig(VpcPeeringConfig.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createPrivateConnectionTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + PrivateConnection privateConnection = PrivateConnection.newBuilder().build(); + String privateConnectionId = "privateConnectionId-1926654532"; + + PrivateConnection actualResponse = + client.createPrivateConnectionAsync(parent, privateConnection, privateConnectionId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createPrivateConnectionExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + PrivateConnection privateConnection = PrivateConnection.newBuilder().build(); + String privateConnectionId = "privateConnectionId-1926654532"; + client.createPrivateConnectionAsync(parent, privateConnection, privateConnectionId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getPrivateConnectionTest() throws Exception { + PrivateConnection expectedResponse = + PrivateConnection.newBuilder() + .setName( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setError(Error.newBuilder().build()) + .setVpcPeeringConfig(VpcPeeringConfig.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PrivateConnectionName name = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + + PrivateConnection actualResponse = client.getPrivateConnection(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getPrivateConnectionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PrivateConnectionName name = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + client.getPrivateConnection(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPrivateConnectionTest2() throws Exception { + PrivateConnection expectedResponse = + PrivateConnection.newBuilder() + .setName( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setError(Error.newBuilder().build()) + .setVpcPeeringConfig(VpcPeeringConfig.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-9090/locations/location-9090/privateConnections/privateConnection-9090"; + + PrivateConnection actualResponse = client.getPrivateConnection(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getPrivateConnectionExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-9090/locations/location-9090/privateConnections/privateConnection-9090"; + client.getPrivateConnection(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listPrivateConnectionsTest() throws Exception { + PrivateConnection responsesElement = PrivateConnection.newBuilder().build(); + ListPrivateConnectionsResponse expectedResponse = + ListPrivateConnectionsResponse.newBuilder() + .setNextPageToken("") + .addAllPrivateConnections(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListPrivateConnectionsPagedResponse pagedListResponse = client.listPrivateConnections(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPrivateConnectionsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listPrivateConnectionsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listPrivateConnections(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listPrivateConnectionsTest2() throws Exception { + PrivateConnection responsesElement = PrivateConnection.newBuilder().build(); + ListPrivateConnectionsResponse expectedResponse = + ListPrivateConnectionsResponse.newBuilder() + .setNextPageToken("") + .addAllPrivateConnections(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListPrivateConnectionsPagedResponse pagedListResponse = client.listPrivateConnections(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPrivateConnectionsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listPrivateConnectionsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listPrivateConnections(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deletePrivateConnectionTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deletePrivateConnectionTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + PrivateConnectionName name = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + + client.deletePrivateConnectionAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deletePrivateConnectionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PrivateConnectionName name = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + client.deletePrivateConnectionAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deletePrivateConnectionTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deletePrivateConnectionTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-9090/locations/location-9090/privateConnections/privateConnection-9090"; + + client.deletePrivateConnectionAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deletePrivateConnectionExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-9090/locations/location-9090/privateConnections/privateConnection-9090"; + client.deletePrivateConnectionAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createRouteTest() throws Exception { + Route expectedResponse = + Route.newBuilder() + .setName( + RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setDestinationAddress("destinationAddress1736827910") + .setDestinationPort(1205298706) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createRouteTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + PrivateConnectionName parent = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + Route route = Route.newBuilder().build(); + String routeId = "routeId1385647428"; + + Route actualResponse = client.createRouteAsync(parent, route, routeId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createRouteExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PrivateConnectionName parent = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + Route route = Route.newBuilder().build(); + String routeId = "routeId1385647428"; + client.createRouteAsync(parent, route, routeId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createRouteTest2() throws Exception { + Route expectedResponse = + Route.newBuilder() + .setName( + RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setDestinationAddress("destinationAddress1736827910") + .setDestinationPort(1205298706) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createRouteTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = + "projects/project-9165/locations/location-9165/privateConnections/privateConnection-9165"; + Route route = Route.newBuilder().build(); + String routeId = "routeId1385647428"; + + Route actualResponse = client.createRouteAsync(parent, route, routeId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createRouteExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = + "projects/project-9165/locations/location-9165/privateConnections/privateConnection-9165"; + Route route = Route.newBuilder().build(); + String routeId = "routeId1385647428"; + client.createRouteAsync(parent, route, routeId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getRouteTest() throws Exception { + Route expectedResponse = + Route.newBuilder() + .setName( + RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setDestinationAddress("destinationAddress1736827910") + .setDestinationPort(1205298706) + .build(); + mockService.addResponse(expectedResponse); + + RouteName name = RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]"); + + Route actualResponse = client.getRoute(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getRouteExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RouteName name = RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]"); + client.getRoute(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getRouteTest2() throws Exception { + Route expectedResponse = + Route.newBuilder() + .setName( + RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDisplayName("displayName1714148973") + .setDestinationAddress("destinationAddress1736827910") + .setDestinationPort(1205298706) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-9342/locations/location-9342/privateConnections/privateConnection-9342/routes/route-9342"; + + Route actualResponse = client.getRoute(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getRouteExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-9342/locations/location-9342/privateConnections/privateConnection-9342/routes/route-9342"; + client.getRoute(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listRoutesTest() throws Exception { + Route responsesElement = Route.newBuilder().build(); + ListRoutesResponse expectedResponse = + ListRoutesResponse.newBuilder() + .setNextPageToken("") + .addAllRoutes(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + PrivateConnectionName parent = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + + ListRoutesPagedResponse pagedListResponse = client.listRoutes(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getRoutesList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listRoutesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PrivateConnectionName parent = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + client.listRoutes(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listRoutesTest2() throws Exception { + Route responsesElement = Route.newBuilder().build(); + ListRoutesResponse expectedResponse = + ListRoutesResponse.newBuilder() + .setNextPageToken("") + .addAllRoutes(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = + "projects/project-9165/locations/location-9165/privateConnections/privateConnection-9165"; + + ListRoutesPagedResponse pagedListResponse = client.listRoutes(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getRoutesList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listRoutesExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = + "projects/project-9165/locations/location-9165/privateConnections/privateConnection-9165"; + client.listRoutes(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteRouteTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteRouteTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RouteName name = RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]"); + + client.deleteRouteAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteRouteExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RouteName name = RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]"); + client.deleteRouteAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteRouteTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteRouteTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-9342/locations/location-9342/privateConnections/privateConnection-9342/routes/route-9342"; + + client.deleteRouteAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteRouteExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-9342/locations/location-9342/privateConnections/privateConnection-9342/routes/route-9342"; + client.deleteRouteAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } +} diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..0eafde96 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.DatastreamSettings; +import com.google.cloud.datastream.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DatastreamSettings datastreamSettings = + DatastreamSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + DatastreamClient datastreamClient = DatastreamClient.create(datastreamSettings); + } +} +// [END datastream_v1_generated_datastreamclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000..906399c2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_create_setcredentialsprovider1_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.DatastreamSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DatastreamSettings datastreamSettings = + DatastreamSettings.newBuilder() + .setTransportChannelProvider( + DatastreamSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + DatastreamClient datastreamClient = DatastreamClient.create(datastreamSettings); + } +} +// [END datastream_v1_generated_datastreamclient_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..8640c529 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_create_setendpoint_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.DatastreamSettings; +import com.google.cloud.datastream.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DatastreamSettings datastreamSettings = + DatastreamSettings.newBuilder().setEndpoint(myEndpoint).build(); + DatastreamClient datastreamClient = DatastreamClient.create(datastreamSettings); + } +} +// [END datastream_v1_generated_datastreamclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/AsyncCreateConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/AsyncCreateConnectionProfile.java new file mode 100644 index 00000000..9ae734c7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/AsyncCreateConnectionProfile.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_createconnectionprofile_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.ConnectionProfile; +import com.google.cloud.datastream.v1.CreateConnectionProfileRequest; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateConnectionProfile { + + public static void main(String[] args) throws Exception { + asyncCreateConnectionProfile(); + } + + public static void asyncCreateConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreateConnectionProfileRequest request = + CreateConnectionProfileRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setConnectionProfileId("connectionProfileId597575526") + .setConnectionProfile(ConnectionProfile.newBuilder().build()) + .setRequestId("requestId693933066") + .setValidateOnly(true) + .setForce(true) + .build(); + ApiFuture future = + datastreamClient.createConnectionProfileCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_createconnectionprofile_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/AsyncCreateConnectionProfileLRO.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/AsyncCreateConnectionProfileLRO.java new file mode 100644 index 00000000..12bb2a4d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/AsyncCreateConnectionProfileLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_createconnectionprofile_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.datastream.v1.ConnectionProfile; +import com.google.cloud.datastream.v1.CreateConnectionProfileRequest; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; +import com.google.cloud.datastream.v1.OperationMetadata; + +public class AsyncCreateConnectionProfileLRO { + + public static void main(String[] args) throws Exception { + asyncCreateConnectionProfileLRO(); + } + + public static void asyncCreateConnectionProfileLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreateConnectionProfileRequest request = + CreateConnectionProfileRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setConnectionProfileId("connectionProfileId597575526") + .setConnectionProfile(ConnectionProfile.newBuilder().build()) + .setRequestId("requestId693933066") + .setValidateOnly(true) + .setForce(true) + .build(); + OperationFuture future = + datastreamClient.createConnectionProfileOperationCallable().futureCall(request); + // Do something. + ConnectionProfile response = future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_createconnectionprofile_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfile.java new file mode 100644 index 00000000..aec1f731 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfile.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_createconnectionprofile_sync] +import com.google.cloud.datastream.v1.ConnectionProfile; +import com.google.cloud.datastream.v1.CreateConnectionProfileRequest; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; + +public class SyncCreateConnectionProfile { + + public static void main(String[] args) throws Exception { + syncCreateConnectionProfile(); + } + + public static void syncCreateConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreateConnectionProfileRequest request = + CreateConnectionProfileRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setConnectionProfileId("connectionProfileId597575526") + .setConnectionProfile(ConnectionProfile.newBuilder().build()) + .setRequestId("requestId693933066") + .setValidateOnly(true) + .setForce(true) + .build(); + ConnectionProfile response = datastreamClient.createConnectionProfileAsync(request).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_createconnectionprofile_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileLocationnameConnectionprofileString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileLocationnameConnectionprofileString.java new file mode 100644 index 00000000..0ac05ae8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileLocationnameConnectionprofileString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START +// datastream_v1_generated_datastreamclient_createconnectionprofile_locationnameconnectionprofilestring_sync] +import com.google.cloud.datastream.v1.ConnectionProfile; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; + +public class SyncCreateConnectionProfileLocationnameConnectionprofileString { + + public static void main(String[] args) throws Exception { + syncCreateConnectionProfileLocationnameConnectionprofileString(); + } + + public static void syncCreateConnectionProfileLocationnameConnectionprofileString() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + ConnectionProfile connectionProfile = ConnectionProfile.newBuilder().build(); + String connectionProfileId = "connectionProfileId597575526"; + ConnectionProfile response = + datastreamClient + .createConnectionProfileAsync(parent, connectionProfile, connectionProfileId) + .get(); + } + } +} +// [END +// datastream_v1_generated_datastreamclient_createconnectionprofile_locationnameconnectionprofilestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileStringConnectionprofileString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileStringConnectionprofileString.java new file mode 100644 index 00000000..6a94c620 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileStringConnectionprofileString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START +// datastream_v1_generated_datastreamclient_createconnectionprofile_stringconnectionprofilestring_sync] +import com.google.cloud.datastream.v1.ConnectionProfile; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; + +public class SyncCreateConnectionProfileStringConnectionprofileString { + + public static void main(String[] args) throws Exception { + syncCreateConnectionProfileStringConnectionprofileString(); + } + + public static void syncCreateConnectionProfileStringConnectionprofileString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + ConnectionProfile connectionProfile = ConnectionProfile.newBuilder().build(); + String connectionProfileId = "connectionProfileId597575526"; + ConnectionProfile response = + datastreamClient + .createConnectionProfileAsync(parent, connectionProfile, connectionProfileId) + .get(); + } + } +} +// [END +// datastream_v1_generated_datastreamclient_createconnectionprofile_stringconnectionprofilestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/AsyncCreatePrivateConnection.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/AsyncCreatePrivateConnection.java new file mode 100644 index 00000000..43946d2f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/AsyncCreatePrivateConnection.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_createprivateconnection_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.CreatePrivateConnectionRequest; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; +import com.google.cloud.datastream.v1.PrivateConnection; +import com.google.longrunning.Operation; + +public class AsyncCreatePrivateConnection { + + public static void main(String[] args) throws Exception { + asyncCreatePrivateConnection(); + } + + public static void asyncCreatePrivateConnection() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreatePrivateConnectionRequest request = + CreatePrivateConnectionRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPrivateConnectionId("privateConnectionId-1926654532") + .setPrivateConnection(PrivateConnection.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + datastreamClient.createPrivateConnectionCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_createprivateconnection_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/AsyncCreatePrivateConnectionLRO.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/AsyncCreatePrivateConnectionLRO.java new file mode 100644 index 00000000..b724fffc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/AsyncCreatePrivateConnectionLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_createprivateconnection_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.datastream.v1.CreatePrivateConnectionRequest; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; +import com.google.cloud.datastream.v1.OperationMetadata; +import com.google.cloud.datastream.v1.PrivateConnection; + +public class AsyncCreatePrivateConnectionLRO { + + public static void main(String[] args) throws Exception { + asyncCreatePrivateConnectionLRO(); + } + + public static void asyncCreatePrivateConnectionLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreatePrivateConnectionRequest request = + CreatePrivateConnectionRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPrivateConnectionId("privateConnectionId-1926654532") + .setPrivateConnection(PrivateConnection.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + datastreamClient.createPrivateConnectionOperationCallable().futureCall(request); + // Do something. + PrivateConnection response = future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_createprivateconnection_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/SyncCreatePrivateConnection.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/SyncCreatePrivateConnection.java new file mode 100644 index 00000000..2fa654b1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/SyncCreatePrivateConnection.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_createprivateconnection_sync] +import com.google.cloud.datastream.v1.CreatePrivateConnectionRequest; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; +import com.google.cloud.datastream.v1.PrivateConnection; + +public class SyncCreatePrivateConnection { + + public static void main(String[] args) throws Exception { + syncCreatePrivateConnection(); + } + + public static void syncCreatePrivateConnection() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreatePrivateConnectionRequest request = + CreatePrivateConnectionRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPrivateConnectionId("privateConnectionId-1926654532") + .setPrivateConnection(PrivateConnection.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + PrivateConnection response = datastreamClient.createPrivateConnectionAsync(request).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_createprivateconnection_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionLocationnamePrivateconnectionString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionLocationnamePrivateconnectionString.java new file mode 100644 index 00000000..746b16b8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionLocationnamePrivateconnectionString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START +// datastream_v1_generated_datastreamclient_createprivateconnection_locationnameprivateconnectionstring_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; +import com.google.cloud.datastream.v1.PrivateConnection; + +public class SyncCreatePrivateConnectionLocationnamePrivateconnectionString { + + public static void main(String[] args) throws Exception { + syncCreatePrivateConnectionLocationnamePrivateconnectionString(); + } + + public static void syncCreatePrivateConnectionLocationnamePrivateconnectionString() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + PrivateConnection privateConnection = PrivateConnection.newBuilder().build(); + String privateConnectionId = "privateConnectionId-1926654532"; + PrivateConnection response = + datastreamClient + .createPrivateConnectionAsync(parent, privateConnection, privateConnectionId) + .get(); + } + } +} +// [END +// datastream_v1_generated_datastreamclient_createprivateconnection_locationnameprivateconnectionstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionStringPrivateconnectionString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionStringPrivateconnectionString.java new file mode 100644 index 00000000..328819c6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionStringPrivateconnectionString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START +// datastream_v1_generated_datastreamclient_createprivateconnection_stringprivateconnectionstring_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; +import com.google.cloud.datastream.v1.PrivateConnection; + +public class SyncCreatePrivateConnectionStringPrivateconnectionString { + + public static void main(String[] args) throws Exception { + syncCreatePrivateConnectionStringPrivateconnectionString(); + } + + public static void syncCreatePrivateConnectionStringPrivateconnectionString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + PrivateConnection privateConnection = PrivateConnection.newBuilder().build(); + String privateConnectionId = "privateConnectionId-1926654532"; + PrivateConnection response = + datastreamClient + .createPrivateConnectionAsync(parent, privateConnection, privateConnectionId) + .get(); + } + } +} +// [END +// datastream_v1_generated_datastreamclient_createprivateconnection_stringprivateconnectionstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/AsyncCreateRoute.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/AsyncCreateRoute.java new file mode 100644 index 00000000..aa6ae727 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/AsyncCreateRoute.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_createroute_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.CreateRouteRequest; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.PrivateConnectionName; +import com.google.cloud.datastream.v1.Route; +import com.google.longrunning.Operation; + +public class AsyncCreateRoute { + + public static void main(String[] args) throws Exception { + asyncCreateRoute(); + } + + public static void asyncCreateRoute() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreateRouteRequest request = + CreateRouteRequest.newBuilder() + .setParent( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setRouteId("routeId1385647428") + .setRoute(Route.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = datastreamClient.createRouteCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_createroute_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/AsyncCreateRouteLRO.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/AsyncCreateRouteLRO.java new file mode 100644 index 00000000..32f2c602 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/AsyncCreateRouteLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_createroute_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.datastream.v1.CreateRouteRequest; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.OperationMetadata; +import com.google.cloud.datastream.v1.PrivateConnectionName; +import com.google.cloud.datastream.v1.Route; + +public class AsyncCreateRouteLRO { + + public static void main(String[] args) throws Exception { + asyncCreateRouteLRO(); + } + + public static void asyncCreateRouteLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreateRouteRequest request = + CreateRouteRequest.newBuilder() + .setParent( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setRouteId("routeId1385647428") + .setRoute(Route.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + datastreamClient.createRouteOperationCallable().futureCall(request); + // Do something. + Route response = future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_createroute_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/SyncCreateRoute.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/SyncCreateRoute.java new file mode 100644 index 00000000..a68f373a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/SyncCreateRoute.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_createroute_sync] +import com.google.cloud.datastream.v1.CreateRouteRequest; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.PrivateConnectionName; +import com.google.cloud.datastream.v1.Route; + +public class SyncCreateRoute { + + public static void main(String[] args) throws Exception { + syncCreateRoute(); + } + + public static void syncCreateRoute() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreateRouteRequest request = + CreateRouteRequest.newBuilder() + .setParent( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setRouteId("routeId1385647428") + .setRoute(Route.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + Route response = datastreamClient.createRouteAsync(request).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_createroute_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/SyncCreateRoutePrivateconnectionnameRouteString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/SyncCreateRoutePrivateconnectionnameRouteString.java new file mode 100644 index 00000000..e11b4ec7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/SyncCreateRoutePrivateconnectionnameRouteString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START +// datastream_v1_generated_datastreamclient_createroute_privateconnectionnameroutestring_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.PrivateConnectionName; +import com.google.cloud.datastream.v1.Route; + +public class SyncCreateRoutePrivateconnectionnameRouteString { + + public static void main(String[] args) throws Exception { + syncCreateRoutePrivateconnectionnameRouteString(); + } + + public static void syncCreateRoutePrivateconnectionnameRouteString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + PrivateConnectionName parent = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + Route route = Route.newBuilder().build(); + String routeId = "routeId1385647428"; + Route response = datastreamClient.createRouteAsync(parent, route, routeId).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_createroute_privateconnectionnameroutestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/SyncCreateRouteStringRouteString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/SyncCreateRouteStringRouteString.java new file mode 100644 index 00000000..c1be72c3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/SyncCreateRouteStringRouteString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_createroute_stringroutestring_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.PrivateConnectionName; +import com.google.cloud.datastream.v1.Route; + +public class SyncCreateRouteStringRouteString { + + public static void main(String[] args) throws Exception { + syncCreateRouteStringRouteString(); + } + + public static void syncCreateRouteStringRouteString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String parent = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]").toString(); + Route route = Route.newBuilder().build(); + String routeId = "routeId1385647428"; + Route response = datastreamClient.createRouteAsync(parent, route, routeId).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_createroute_stringroutestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createstream/AsyncCreateStream.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createstream/AsyncCreateStream.java new file mode 100644 index 00000000..ab1777ce --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createstream/AsyncCreateStream.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_createstream_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.CreateStreamRequest; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; +import com.google.cloud.datastream.v1.Stream; +import com.google.longrunning.Operation; + +public class AsyncCreateStream { + + public static void main(String[] args) throws Exception { + asyncCreateStream(); + } + + public static void asyncCreateStream() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreateStreamRequest request = + CreateStreamRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setStreamId("streamId1790933179") + .setStream(Stream.newBuilder().build()) + .setRequestId("requestId693933066") + .setValidateOnly(true) + .setForce(true) + .build(); + ApiFuture future = datastreamClient.createStreamCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_createstream_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createstream/AsyncCreateStreamLRO.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createstream/AsyncCreateStreamLRO.java new file mode 100644 index 00000000..c59f8c2c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createstream/AsyncCreateStreamLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_createstream_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.datastream.v1.CreateStreamRequest; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; +import com.google.cloud.datastream.v1.OperationMetadata; +import com.google.cloud.datastream.v1.Stream; + +public class AsyncCreateStreamLRO { + + public static void main(String[] args) throws Exception { + asyncCreateStreamLRO(); + } + + public static void asyncCreateStreamLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreateStreamRequest request = + CreateStreamRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setStreamId("streamId1790933179") + .setStream(Stream.newBuilder().build()) + .setRequestId("requestId693933066") + .setValidateOnly(true) + .setForce(true) + .build(); + OperationFuture future = + datastreamClient.createStreamOperationCallable().futureCall(request); + // Do something. + Stream response = future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_createstream_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createstream/SyncCreateStream.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createstream/SyncCreateStream.java new file mode 100644 index 00000000..25b32190 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createstream/SyncCreateStream.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_createstream_sync] +import com.google.cloud.datastream.v1.CreateStreamRequest; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; +import com.google.cloud.datastream.v1.Stream; + +public class SyncCreateStream { + + public static void main(String[] args) throws Exception { + syncCreateStream(); + } + + public static void syncCreateStream() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreateStreamRequest request = + CreateStreamRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setStreamId("streamId1790933179") + .setStream(Stream.newBuilder().build()) + .setRequestId("requestId693933066") + .setValidateOnly(true) + .setForce(true) + .build(); + Stream response = datastreamClient.createStreamAsync(request).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_createstream_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createstream/SyncCreateStreamLocationnameStreamString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createstream/SyncCreateStreamLocationnameStreamString.java new file mode 100644 index 00000000..e60e857d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createstream/SyncCreateStreamLocationnameStreamString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_createstream_locationnamestreamstring_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; +import com.google.cloud.datastream.v1.Stream; + +public class SyncCreateStreamLocationnameStreamString { + + public static void main(String[] args) throws Exception { + syncCreateStreamLocationnameStreamString(); + } + + public static void syncCreateStreamLocationnameStreamString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Stream stream = Stream.newBuilder().build(); + String streamId = "streamId1790933179"; + Stream response = datastreamClient.createStreamAsync(parent, stream, streamId).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_createstream_locationnamestreamstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createstream/SyncCreateStreamStringStreamString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createstream/SyncCreateStreamStringStreamString.java new file mode 100644 index 00000000..39aca78d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createstream/SyncCreateStreamStringStreamString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_createstream_stringstreamstring_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; +import com.google.cloud.datastream.v1.Stream; + +public class SyncCreateStreamStringStreamString { + + public static void main(String[] args) throws Exception { + syncCreateStreamStringStreamString(); + } + + public static void syncCreateStreamStringStreamString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Stream stream = Stream.newBuilder().build(); + String streamId = "streamId1790933179"; + Stream response = datastreamClient.createStreamAsync(parent, stream, streamId).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_createstream_stringstreamstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/AsyncDeleteConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/AsyncDeleteConnectionProfile.java new file mode 100644 index 00000000..32b47d6c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/AsyncDeleteConnectionProfile.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_deleteconnectionprofile_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.ConnectionProfileName; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.DeleteConnectionProfileRequest; +import com.google.longrunning.Operation; + +public class AsyncDeleteConnectionProfile { + + public static void main(String[] args) throws Exception { + asyncDeleteConnectionProfile(); + } + + public static void asyncDeleteConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeleteConnectionProfileRequest request = + DeleteConnectionProfileRequest.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + datastreamClient.deleteConnectionProfileCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_deleteconnectionprofile_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/AsyncDeleteConnectionProfileLRO.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/AsyncDeleteConnectionProfileLRO.java new file mode 100644 index 00000000..65283206 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/AsyncDeleteConnectionProfileLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_deleteconnectionprofile_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.datastream.v1.ConnectionProfileName; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.DeleteConnectionProfileRequest; +import com.google.cloud.datastream.v1.OperationMetadata; +import com.google.protobuf.Empty; + +public class AsyncDeleteConnectionProfileLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteConnectionProfileLRO(); + } + + public static void asyncDeleteConnectionProfileLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeleteConnectionProfileRequest request = + DeleteConnectionProfileRequest.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + datastreamClient.deleteConnectionProfileOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_deleteconnectionprofile_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfile.java new file mode 100644 index 00000000..210bb5f4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfile.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_deleteconnectionprofile_sync] +import com.google.cloud.datastream.v1.ConnectionProfileName; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.DeleteConnectionProfileRequest; + +public class SyncDeleteConnectionProfile { + + public static void main(String[] args) throws Exception { + syncDeleteConnectionProfile(); + } + + public static void syncDeleteConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeleteConnectionProfileRequest request = + DeleteConnectionProfileRequest.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .setRequestId("requestId693933066") + .build(); + datastreamClient.deleteConnectionProfileAsync(request).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_deleteconnectionprofile_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileConnectionprofilename.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileConnectionprofilename.java new file mode 100644 index 00000000..db92d4a4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileConnectionprofilename.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START +// datastream_v1_generated_datastreamclient_deleteconnectionprofile_connectionprofilename_sync] +import com.google.cloud.datastream.v1.ConnectionProfileName; +import com.google.cloud.datastream.v1.DatastreamClient; + +public class SyncDeleteConnectionProfileConnectionprofilename { + + public static void main(String[] args) throws Exception { + syncDeleteConnectionProfileConnectionprofilename(); + } + + public static void syncDeleteConnectionProfileConnectionprofilename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ConnectionProfileName name = + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]"); + datastreamClient.deleteConnectionProfileAsync(name).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_deleteconnectionprofile_connectionprofilename_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileString.java new file mode 100644 index 00000000..08d48415 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_deleteconnectionprofile_string_sync] +import com.google.cloud.datastream.v1.ConnectionProfileName; +import com.google.cloud.datastream.v1.DatastreamClient; + +public class SyncDeleteConnectionProfileString { + + public static void main(String[] args) throws Exception { + syncDeleteConnectionProfileString(); + } + + public static void syncDeleteConnectionProfileString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String name = + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]").toString(); + datastreamClient.deleteConnectionProfileAsync(name).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_deleteconnectionprofile_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/AsyncDeletePrivateConnection.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/AsyncDeletePrivateConnection.java new file mode 100644 index 00000000..db22b7e3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/AsyncDeletePrivateConnection.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_deleteprivateconnection_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.DeletePrivateConnectionRequest; +import com.google.cloud.datastream.v1.PrivateConnectionName; +import com.google.longrunning.Operation; + +public class AsyncDeletePrivateConnection { + + public static void main(String[] args) throws Exception { + asyncDeletePrivateConnection(); + } + + public static void asyncDeletePrivateConnection() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeletePrivateConnectionRequest request = + DeletePrivateConnectionRequest.newBuilder() + .setName( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setRequestId("requestId693933066") + .setForce(true) + .build(); + ApiFuture future = + datastreamClient.deletePrivateConnectionCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_deleteprivateconnection_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/AsyncDeletePrivateConnectionLRO.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/AsyncDeletePrivateConnectionLRO.java new file mode 100644 index 00000000..19e2d59c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/AsyncDeletePrivateConnectionLRO.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_deleteprivateconnection_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.DeletePrivateConnectionRequest; +import com.google.cloud.datastream.v1.OperationMetadata; +import com.google.cloud.datastream.v1.PrivateConnectionName; +import com.google.protobuf.Empty; + +public class AsyncDeletePrivateConnectionLRO { + + public static void main(String[] args) throws Exception { + asyncDeletePrivateConnectionLRO(); + } + + public static void asyncDeletePrivateConnectionLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeletePrivateConnectionRequest request = + DeletePrivateConnectionRequest.newBuilder() + .setName( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setRequestId("requestId693933066") + .setForce(true) + .build(); + OperationFuture future = + datastreamClient.deletePrivateConnectionOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_deleteprivateconnection_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnection.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnection.java new file mode 100644 index 00000000..73cbde96 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnection.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_deleteprivateconnection_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.DeletePrivateConnectionRequest; +import com.google.cloud.datastream.v1.PrivateConnectionName; + +public class SyncDeletePrivateConnection { + + public static void main(String[] args) throws Exception { + syncDeletePrivateConnection(); + } + + public static void syncDeletePrivateConnection() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeletePrivateConnectionRequest request = + DeletePrivateConnectionRequest.newBuilder() + .setName( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setRequestId("requestId693933066") + .setForce(true) + .build(); + datastreamClient.deletePrivateConnectionAsync(request).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_deleteprivateconnection_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionPrivateconnectionname.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionPrivateconnectionname.java new file mode 100644 index 00000000..ae0b9dfd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionPrivateconnectionname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START +// datastream_v1_generated_datastreamclient_deleteprivateconnection_privateconnectionname_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.PrivateConnectionName; + +public class SyncDeletePrivateConnectionPrivateconnectionname { + + public static void main(String[] args) throws Exception { + syncDeletePrivateConnectionPrivateconnectionname(); + } + + public static void syncDeletePrivateConnectionPrivateconnectionname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + PrivateConnectionName name = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + datastreamClient.deletePrivateConnectionAsync(name).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_deleteprivateconnection_privateconnectionname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionString.java new file mode 100644 index 00000000..323cae74 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_deleteprivateconnection_string_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.PrivateConnectionName; + +public class SyncDeletePrivateConnectionString { + + public static void main(String[] args) throws Exception { + syncDeletePrivateConnectionString(); + } + + public static void syncDeletePrivateConnectionString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String name = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]").toString(); + datastreamClient.deletePrivateConnectionAsync(name).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_deleteprivateconnection_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/AsyncDeleteRoute.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/AsyncDeleteRoute.java new file mode 100644 index 00000000..285d305e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/AsyncDeleteRoute.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_deleteroute_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.DeleteRouteRequest; +import com.google.cloud.datastream.v1.RouteName; +import com.google.longrunning.Operation; + +public class AsyncDeleteRoute { + + public static void main(String[] args) throws Exception { + asyncDeleteRoute(); + } + + public static void asyncDeleteRoute() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeleteRouteRequest request = + DeleteRouteRequest.newBuilder() + .setName( + RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]") + .toString()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = datastreamClient.deleteRouteCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_deleteroute_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/AsyncDeleteRouteLRO.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/AsyncDeleteRouteLRO.java new file mode 100644 index 00000000..c726dec0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/AsyncDeleteRouteLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_deleteroute_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.DeleteRouteRequest; +import com.google.cloud.datastream.v1.OperationMetadata; +import com.google.cloud.datastream.v1.RouteName; +import com.google.protobuf.Empty; + +public class AsyncDeleteRouteLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteRouteLRO(); + } + + public static void asyncDeleteRouteLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeleteRouteRequest request = + DeleteRouteRequest.newBuilder() + .setName( + RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]") + .toString()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + datastreamClient.deleteRouteOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_deleteroute_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRoute.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRoute.java new file mode 100644 index 00000000..787f642e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRoute.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_deleteroute_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.DeleteRouteRequest; +import com.google.cloud.datastream.v1.RouteName; + +public class SyncDeleteRoute { + + public static void main(String[] args) throws Exception { + syncDeleteRoute(); + } + + public static void syncDeleteRoute() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeleteRouteRequest request = + DeleteRouteRequest.newBuilder() + .setName( + RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]") + .toString()) + .setRequestId("requestId693933066") + .build(); + datastreamClient.deleteRouteAsync(request).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_deleteroute_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRouteRoutename.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRouteRoutename.java new file mode 100644 index 00000000..b0869a1e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRouteRoutename.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_deleteroute_routename_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.RouteName; + +public class SyncDeleteRouteRoutename { + + public static void main(String[] args) throws Exception { + syncDeleteRouteRoutename(); + } + + public static void syncDeleteRouteRoutename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + RouteName name = RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]"); + datastreamClient.deleteRouteAsync(name).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_deleteroute_routename_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRouteString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRouteString.java new file mode 100644 index 00000000..3d19d0e2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRouteString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_deleteroute_string_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.RouteName; + +public class SyncDeleteRouteString { + + public static void main(String[] args) throws Exception { + syncDeleteRouteString(); + } + + public static void syncDeleteRouteString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String name = + RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]").toString(); + datastreamClient.deleteRouteAsync(name).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_deleteroute_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/AsyncDeleteStream.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/AsyncDeleteStream.java new file mode 100644 index 00000000..bf37999c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/AsyncDeleteStream.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_deletestream_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.DeleteStreamRequest; +import com.google.cloud.datastream.v1.StreamName; +import com.google.longrunning.Operation; + +public class AsyncDeleteStream { + + public static void main(String[] args) throws Exception { + asyncDeleteStream(); + } + + public static void asyncDeleteStream() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeleteStreamRequest request = + DeleteStreamRequest.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = datastreamClient.deleteStreamCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_deletestream_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/AsyncDeleteStreamLRO.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/AsyncDeleteStreamLRO.java new file mode 100644 index 00000000..84948620 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/AsyncDeleteStreamLRO.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_deletestream_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.DeleteStreamRequest; +import com.google.cloud.datastream.v1.OperationMetadata; +import com.google.cloud.datastream.v1.StreamName; +import com.google.protobuf.Empty; + +public class AsyncDeleteStreamLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteStreamLRO(); + } + + public static void asyncDeleteStreamLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeleteStreamRequest request = + DeleteStreamRequest.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + datastreamClient.deleteStreamOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_deletestream_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStream.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStream.java new file mode 100644 index 00000000..488c49f2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStream.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_deletestream_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.DeleteStreamRequest; +import com.google.cloud.datastream.v1.StreamName; + +public class SyncDeleteStream { + + public static void main(String[] args) throws Exception { + syncDeleteStream(); + } + + public static void syncDeleteStream() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeleteStreamRequest request = + DeleteStreamRequest.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setRequestId("requestId693933066") + .build(); + datastreamClient.deleteStreamAsync(request).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_deletestream_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStreamStreamname.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStreamStreamname.java new file mode 100644 index 00000000..856057b3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStreamStreamname.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_deletestream_streamname_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.StreamName; + +public class SyncDeleteStreamStreamname { + + public static void main(String[] args) throws Exception { + syncDeleteStreamStreamname(); + } + + public static void syncDeleteStreamStreamname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + StreamName name = StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]"); + datastreamClient.deleteStreamAsync(name).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_deletestream_streamname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStreamString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStreamString.java new file mode 100644 index 00000000..4b1e9b45 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStreamString.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_deletestream_string_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.StreamName; + +public class SyncDeleteStreamString { + + public static void main(String[] args) throws Exception { + syncDeleteStreamString(); + } + + public static void syncDeleteStreamString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String name = StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString(); + datastreamClient.deleteStreamAsync(name).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_deletestream_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/discoverconnectionprofile/AsyncDiscoverConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/discoverconnectionprofile/AsyncDiscoverConnectionProfile.java new file mode 100644 index 00000000..c2769682 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/discoverconnectionprofile/AsyncDiscoverConnectionProfile.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_discoverconnectionprofile_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.DiscoverConnectionProfileRequest; +import com.google.cloud.datastream.v1.DiscoverConnectionProfileResponse; +import com.google.cloud.datastream.v1.LocationName; + +public class AsyncDiscoverConnectionProfile { + + public static void main(String[] args) throws Exception { + asyncDiscoverConnectionProfile(); + } + + public static void asyncDiscoverConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DiscoverConnectionProfileRequest request = + DiscoverConnectionProfileRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + datastreamClient.discoverConnectionProfileCallable().futureCall(request); + // Do something. + DiscoverConnectionProfileResponse response = future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_discoverconnectionprofile_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/discoverconnectionprofile/SyncDiscoverConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/discoverconnectionprofile/SyncDiscoverConnectionProfile.java new file mode 100644 index 00000000..e73cf7bd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/discoverconnectionprofile/SyncDiscoverConnectionProfile.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_discoverconnectionprofile_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.DiscoverConnectionProfileRequest; +import com.google.cloud.datastream.v1.DiscoverConnectionProfileResponse; +import com.google.cloud.datastream.v1.LocationName; + +public class SyncDiscoverConnectionProfile { + + public static void main(String[] args) throws Exception { + syncDiscoverConnectionProfile(); + } + + public static void syncDiscoverConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DiscoverConnectionProfileRequest request = + DiscoverConnectionProfileRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + DiscoverConnectionProfileResponse response = + datastreamClient.discoverConnectionProfile(request); + } + } +} +// [END datastream_v1_generated_datastreamclient_discoverconnectionprofile_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/fetchstaticips/AsyncFetchStaticIps.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/fetchstaticips/AsyncFetchStaticIps.java new file mode 100644 index 00000000..c0a4c5c8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/fetchstaticips/AsyncFetchStaticIps.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_fetchstaticips_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.FetchStaticIpsRequest; +import com.google.cloud.datastream.v1.LocationName; + +public class AsyncFetchStaticIps { + + public static void main(String[] args) throws Exception { + asyncFetchStaticIps(); + } + + public static void asyncFetchStaticIps() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + FetchStaticIpsRequest request = + FetchStaticIpsRequest.newBuilder() + .setName(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = datastreamClient.fetchStaticIpsPagedCallable().futureCall(request); + // Do something. + for (String element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_fetchstaticips_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/fetchstaticips/AsyncFetchStaticIpsPaged.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/fetchstaticips/AsyncFetchStaticIpsPaged.java new file mode 100644 index 00000000..6bab8dcd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/fetchstaticips/AsyncFetchStaticIpsPaged.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_fetchstaticips_paged_async] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.FetchStaticIpsRequest; +import com.google.cloud.datastream.v1.FetchStaticIpsResponse; +import com.google.cloud.datastream.v1.LocationName; +import com.google.common.base.Strings; + +public class AsyncFetchStaticIpsPaged { + + public static void main(String[] args) throws Exception { + asyncFetchStaticIpsPaged(); + } + + public static void asyncFetchStaticIpsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + FetchStaticIpsRequest request = + FetchStaticIpsRequest.newBuilder() + .setName(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + FetchStaticIpsResponse response = datastreamClient.fetchStaticIpsCallable().call(request); + for (String element : response.getStaticIpsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END datastream_v1_generated_datastreamclient_fetchstaticips_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/fetchstaticips/SyncFetchStaticIps.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/fetchstaticips/SyncFetchStaticIps.java new file mode 100644 index 00000000..24182d94 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/fetchstaticips/SyncFetchStaticIps.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_fetchstaticips_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.FetchStaticIpsRequest; +import com.google.cloud.datastream.v1.LocationName; + +public class SyncFetchStaticIps { + + public static void main(String[] args) throws Exception { + syncFetchStaticIps(); + } + + public static void syncFetchStaticIps() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + FetchStaticIpsRequest request = + FetchStaticIpsRequest.newBuilder() + .setName(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (String element : datastreamClient.fetchStaticIps(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_fetchstaticips_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/fetchstaticips/SyncFetchStaticIpsLocationname.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/fetchstaticips/SyncFetchStaticIpsLocationname.java new file mode 100644 index 00000000..e21b2bc1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/fetchstaticips/SyncFetchStaticIpsLocationname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_fetchstaticips_locationname_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; + +public class SyncFetchStaticIpsLocationname { + + public static void main(String[] args) throws Exception { + syncFetchStaticIpsLocationname(); + } + + public static void syncFetchStaticIpsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + LocationName name = LocationName.of("[PROJECT]", "[LOCATION]"); + for (String element : datastreamClient.fetchStaticIps(name).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_fetchstaticips_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/fetchstaticips/SyncFetchStaticIpsString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/fetchstaticips/SyncFetchStaticIpsString.java new file mode 100644 index 00000000..2ca638da --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/fetchstaticips/SyncFetchStaticIpsString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_fetchstaticips_string_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; + +public class SyncFetchStaticIpsString { + + public static void main(String[] args) throws Exception { + syncFetchStaticIpsString(); + } + + public static void syncFetchStaticIpsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String name = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (String element : datastreamClient.fetchStaticIps(name).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_fetchstaticips_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getconnectionprofile/AsyncGetConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getconnectionprofile/AsyncGetConnectionProfile.java new file mode 100644 index 00000000..4da46211 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getconnectionprofile/AsyncGetConnectionProfile.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_getconnectionprofile_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.ConnectionProfile; +import com.google.cloud.datastream.v1.ConnectionProfileName; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.GetConnectionProfileRequest; + +public class AsyncGetConnectionProfile { + + public static void main(String[] args) throws Exception { + asyncGetConnectionProfile(); + } + + public static void asyncGetConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + GetConnectionProfileRequest request = + GetConnectionProfileRequest.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .build(); + ApiFuture future = + datastreamClient.getConnectionProfileCallable().futureCall(request); + // Do something. + ConnectionProfile response = future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_getconnectionprofile_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getconnectionprofile/SyncGetConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getconnectionprofile/SyncGetConnectionProfile.java new file mode 100644 index 00000000..b1761319 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getconnectionprofile/SyncGetConnectionProfile.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_getconnectionprofile_sync] +import com.google.cloud.datastream.v1.ConnectionProfile; +import com.google.cloud.datastream.v1.ConnectionProfileName; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.GetConnectionProfileRequest; + +public class SyncGetConnectionProfile { + + public static void main(String[] args) throws Exception { + syncGetConnectionProfile(); + } + + public static void syncGetConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + GetConnectionProfileRequest request = + GetConnectionProfileRequest.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .build(); + ConnectionProfile response = datastreamClient.getConnectionProfile(request); + } + } +} +// [END datastream_v1_generated_datastreamclient_getconnectionprofile_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getconnectionprofile/SyncGetConnectionProfileConnectionprofilename.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getconnectionprofile/SyncGetConnectionProfileConnectionprofilename.java new file mode 100644 index 00000000..9780d6e2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getconnectionprofile/SyncGetConnectionProfileConnectionprofilename.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_getconnectionprofile_connectionprofilename_sync] +import com.google.cloud.datastream.v1.ConnectionProfile; +import com.google.cloud.datastream.v1.ConnectionProfileName; +import com.google.cloud.datastream.v1.DatastreamClient; + +public class SyncGetConnectionProfileConnectionprofilename { + + public static void main(String[] args) throws Exception { + syncGetConnectionProfileConnectionprofilename(); + } + + public static void syncGetConnectionProfileConnectionprofilename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ConnectionProfileName name = + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]"); + ConnectionProfile response = datastreamClient.getConnectionProfile(name); + } + } +} +// [END datastream_v1_generated_datastreamclient_getconnectionprofile_connectionprofilename_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getconnectionprofile/SyncGetConnectionProfileString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getconnectionprofile/SyncGetConnectionProfileString.java new file mode 100644 index 00000000..b8bc07c6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getconnectionprofile/SyncGetConnectionProfileString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_getconnectionprofile_string_sync] +import com.google.cloud.datastream.v1.ConnectionProfile; +import com.google.cloud.datastream.v1.ConnectionProfileName; +import com.google.cloud.datastream.v1.DatastreamClient; + +public class SyncGetConnectionProfileString { + + public static void main(String[] args) throws Exception { + syncGetConnectionProfileString(); + } + + public static void syncGetConnectionProfileString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String name = + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]").toString(); + ConnectionProfile response = datastreamClient.getConnectionProfile(name); + } + } +} +// [END datastream_v1_generated_datastreamclient_getconnectionprofile_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getlocation/AsyncGetLocation.java new file mode 100644 index 00000000..28b0338e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = datastreamClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getlocation/SyncGetLocation.java new file mode 100644 index 00000000..d1facc9e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_getlocation_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = datastreamClient.getLocation(request); + } + } +} +// [END datastream_v1_generated_datastreamclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getprivateconnection/AsyncGetPrivateConnection.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getprivateconnection/AsyncGetPrivateConnection.java new file mode 100644 index 00000000..779f5233 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getprivateconnection/AsyncGetPrivateConnection.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_getprivateconnection_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.GetPrivateConnectionRequest; +import com.google.cloud.datastream.v1.PrivateConnection; +import com.google.cloud.datastream.v1.PrivateConnectionName; + +public class AsyncGetPrivateConnection { + + public static void main(String[] args) throws Exception { + asyncGetPrivateConnection(); + } + + public static void asyncGetPrivateConnection() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + GetPrivateConnectionRequest request = + GetPrivateConnectionRequest.newBuilder() + .setName( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .build(); + ApiFuture future = + datastreamClient.getPrivateConnectionCallable().futureCall(request); + // Do something. + PrivateConnection response = future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_getprivateconnection_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getprivateconnection/SyncGetPrivateConnection.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getprivateconnection/SyncGetPrivateConnection.java new file mode 100644 index 00000000..d915695f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getprivateconnection/SyncGetPrivateConnection.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_getprivateconnection_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.GetPrivateConnectionRequest; +import com.google.cloud.datastream.v1.PrivateConnection; +import com.google.cloud.datastream.v1.PrivateConnectionName; + +public class SyncGetPrivateConnection { + + public static void main(String[] args) throws Exception { + syncGetPrivateConnection(); + } + + public static void syncGetPrivateConnection() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + GetPrivateConnectionRequest request = + GetPrivateConnectionRequest.newBuilder() + .setName( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .build(); + PrivateConnection response = datastreamClient.getPrivateConnection(request); + } + } +} +// [END datastream_v1_generated_datastreamclient_getprivateconnection_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getprivateconnection/SyncGetPrivateConnectionPrivateconnectionname.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getprivateconnection/SyncGetPrivateConnectionPrivateconnectionname.java new file mode 100644 index 00000000..7cdd509b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getprivateconnection/SyncGetPrivateConnectionPrivateconnectionname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_getprivateconnection_privateconnectionname_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.PrivateConnection; +import com.google.cloud.datastream.v1.PrivateConnectionName; + +public class SyncGetPrivateConnectionPrivateconnectionname { + + public static void main(String[] args) throws Exception { + syncGetPrivateConnectionPrivateconnectionname(); + } + + public static void syncGetPrivateConnectionPrivateconnectionname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + PrivateConnectionName name = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + PrivateConnection response = datastreamClient.getPrivateConnection(name); + } + } +} +// [END datastream_v1_generated_datastreamclient_getprivateconnection_privateconnectionname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getprivateconnection/SyncGetPrivateConnectionString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getprivateconnection/SyncGetPrivateConnectionString.java new file mode 100644 index 00000000..1d174f19 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getprivateconnection/SyncGetPrivateConnectionString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_getprivateconnection_string_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.PrivateConnection; +import com.google.cloud.datastream.v1.PrivateConnectionName; + +public class SyncGetPrivateConnectionString { + + public static void main(String[] args) throws Exception { + syncGetPrivateConnectionString(); + } + + public static void syncGetPrivateConnectionString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String name = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]").toString(); + PrivateConnection response = datastreamClient.getPrivateConnection(name); + } + } +} +// [END datastream_v1_generated_datastreamclient_getprivateconnection_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getroute/AsyncGetRoute.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getroute/AsyncGetRoute.java new file mode 100644 index 00000000..e097c40c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getroute/AsyncGetRoute.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_getroute_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.GetRouteRequest; +import com.google.cloud.datastream.v1.Route; +import com.google.cloud.datastream.v1.RouteName; + +public class AsyncGetRoute { + + public static void main(String[] args) throws Exception { + asyncGetRoute(); + } + + public static void asyncGetRoute() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + GetRouteRequest request = + GetRouteRequest.newBuilder() + .setName( + RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]") + .toString()) + .build(); + ApiFuture future = datastreamClient.getRouteCallable().futureCall(request); + // Do something. + Route response = future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_getroute_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getroute/SyncGetRoute.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getroute/SyncGetRoute.java new file mode 100644 index 00000000..280732e6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getroute/SyncGetRoute.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_getroute_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.GetRouteRequest; +import com.google.cloud.datastream.v1.Route; +import com.google.cloud.datastream.v1.RouteName; + +public class SyncGetRoute { + + public static void main(String[] args) throws Exception { + syncGetRoute(); + } + + public static void syncGetRoute() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + GetRouteRequest request = + GetRouteRequest.newBuilder() + .setName( + RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]") + .toString()) + .build(); + Route response = datastreamClient.getRoute(request); + } + } +} +// [END datastream_v1_generated_datastreamclient_getroute_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getroute/SyncGetRouteRoutename.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getroute/SyncGetRouteRoutename.java new file mode 100644 index 00000000..1c36a7eb --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getroute/SyncGetRouteRoutename.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_getroute_routename_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.Route; +import com.google.cloud.datastream.v1.RouteName; + +public class SyncGetRouteRoutename { + + public static void main(String[] args) throws Exception { + syncGetRouteRoutename(); + } + + public static void syncGetRouteRoutename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + RouteName name = RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]"); + Route response = datastreamClient.getRoute(name); + } + } +} +// [END datastream_v1_generated_datastreamclient_getroute_routename_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getroute/SyncGetRouteString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getroute/SyncGetRouteString.java new file mode 100644 index 00000000..4883ed96 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getroute/SyncGetRouteString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_getroute_string_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.Route; +import com.google.cloud.datastream.v1.RouteName; + +public class SyncGetRouteString { + + public static void main(String[] args) throws Exception { + syncGetRouteString(); + } + + public static void syncGetRouteString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String name = + RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]").toString(); + Route response = datastreamClient.getRoute(name); + } + } +} +// [END datastream_v1_generated_datastreamclient_getroute_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstream/AsyncGetStream.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstream/AsyncGetStream.java new file mode 100644 index 00000000..7bbc3ad9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstream/AsyncGetStream.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_getstream_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.GetStreamRequest; +import com.google.cloud.datastream.v1.Stream; +import com.google.cloud.datastream.v1.StreamName; + +public class AsyncGetStream { + + public static void main(String[] args) throws Exception { + asyncGetStream(); + } + + public static void asyncGetStream() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + GetStreamRequest request = + GetStreamRequest.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .build(); + ApiFuture future = datastreamClient.getStreamCallable().futureCall(request); + // Do something. + Stream response = future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_getstream_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstream/SyncGetStream.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstream/SyncGetStream.java new file mode 100644 index 00000000..e06c26cc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstream/SyncGetStream.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_getstream_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.GetStreamRequest; +import com.google.cloud.datastream.v1.Stream; +import com.google.cloud.datastream.v1.StreamName; + +public class SyncGetStream { + + public static void main(String[] args) throws Exception { + syncGetStream(); + } + + public static void syncGetStream() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + GetStreamRequest request = + GetStreamRequest.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .build(); + Stream response = datastreamClient.getStream(request); + } + } +} +// [END datastream_v1_generated_datastreamclient_getstream_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstream/SyncGetStreamStreamname.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstream/SyncGetStreamStreamname.java new file mode 100644 index 00000000..64ed4175 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstream/SyncGetStreamStreamname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_getstream_streamname_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.Stream; +import com.google.cloud.datastream.v1.StreamName; + +public class SyncGetStreamStreamname { + + public static void main(String[] args) throws Exception { + syncGetStreamStreamname(); + } + + public static void syncGetStreamStreamname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + StreamName name = StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]"); + Stream response = datastreamClient.getStream(name); + } + } +} +// [END datastream_v1_generated_datastreamclient_getstream_streamname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstream/SyncGetStreamString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstream/SyncGetStreamString.java new file mode 100644 index 00000000..c8d12068 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstream/SyncGetStreamString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_getstream_string_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.Stream; +import com.google.cloud.datastream.v1.StreamName; + +public class SyncGetStreamString { + + public static void main(String[] args) throws Exception { + syncGetStreamString(); + } + + public static void syncGetStreamString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String name = StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString(); + Stream response = datastreamClient.getStream(name); + } + } +} +// [END datastream_v1_generated_datastreamclient_getstream_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstreamobject/AsyncGetStreamObject.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstreamobject/AsyncGetStreamObject.java new file mode 100644 index 00000000..e57ba704 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstreamobject/AsyncGetStreamObject.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_getstreamobject_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.GetStreamObjectRequest; +import com.google.cloud.datastream.v1.StreamObject; +import com.google.cloud.datastream.v1.StreamObjectName; + +public class AsyncGetStreamObject { + + public static void main(String[] args) throws Exception { + asyncGetStreamObject(); + } + + public static void asyncGetStreamObject() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + GetStreamObjectRequest request = + GetStreamObjectRequest.newBuilder() + .setName( + StreamObjectName.of("[PROJECT]", "[LOCATION]", "[STREAM]", "[OBJECT]").toString()) + .build(); + ApiFuture future = + datastreamClient.getStreamObjectCallable().futureCall(request); + // Do something. + StreamObject response = future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_getstreamobject_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstreamobject/SyncGetStreamObject.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstreamobject/SyncGetStreamObject.java new file mode 100644 index 00000000..daadad9e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstreamobject/SyncGetStreamObject.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_getstreamobject_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.GetStreamObjectRequest; +import com.google.cloud.datastream.v1.StreamObject; +import com.google.cloud.datastream.v1.StreamObjectName; + +public class SyncGetStreamObject { + + public static void main(String[] args) throws Exception { + syncGetStreamObject(); + } + + public static void syncGetStreamObject() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + GetStreamObjectRequest request = + GetStreamObjectRequest.newBuilder() + .setName( + StreamObjectName.of("[PROJECT]", "[LOCATION]", "[STREAM]", "[OBJECT]").toString()) + .build(); + StreamObject response = datastreamClient.getStreamObject(request); + } + } +} +// [END datastream_v1_generated_datastreamclient_getstreamobject_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstreamobject/SyncGetStreamObjectStreamobjectname.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstreamobject/SyncGetStreamObjectStreamobjectname.java new file mode 100644 index 00000000..80a1d92e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstreamobject/SyncGetStreamObjectStreamobjectname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_getstreamobject_streamobjectname_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.StreamObject; +import com.google.cloud.datastream.v1.StreamObjectName; + +public class SyncGetStreamObjectStreamobjectname { + + public static void main(String[] args) throws Exception { + syncGetStreamObjectStreamobjectname(); + } + + public static void syncGetStreamObjectStreamobjectname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + StreamObjectName name = + StreamObjectName.of("[PROJECT]", "[LOCATION]", "[STREAM]", "[OBJECT]"); + StreamObject response = datastreamClient.getStreamObject(name); + } + } +} +// [END datastream_v1_generated_datastreamclient_getstreamobject_streamobjectname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstreamobject/SyncGetStreamObjectString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstreamobject/SyncGetStreamObjectString.java new file mode 100644 index 00000000..a4cd70cb --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/getstreamobject/SyncGetStreamObjectString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_getstreamobject_string_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.StreamObject; +import com.google.cloud.datastream.v1.StreamObjectName; + +public class SyncGetStreamObjectString { + + public static void main(String[] args) throws Exception { + syncGetStreamObjectString(); + } + + public static void syncGetStreamObjectString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String name = + StreamObjectName.of("[PROJECT]", "[LOCATION]", "[STREAM]", "[OBJECT]").toString(); + StreamObject response = datastreamClient.getStreamObject(name); + } + } +} +// [END datastream_v1_generated_datastreamclient_getstreamobject_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listconnectionprofiles/AsyncListConnectionProfiles.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listconnectionprofiles/AsyncListConnectionProfiles.java new file mode 100644 index 00000000..f280bd8e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listconnectionprofiles/AsyncListConnectionProfiles.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_listconnectionprofiles_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.ConnectionProfile; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.ListConnectionProfilesRequest; +import com.google.cloud.datastream.v1.LocationName; + +public class AsyncListConnectionProfiles { + + public static void main(String[] args) throws Exception { + asyncListConnectionProfiles(); + } + + public static void asyncListConnectionProfiles() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListConnectionProfilesRequest request = + ListConnectionProfilesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + datastreamClient.listConnectionProfilesPagedCallable().futureCall(request); + // Do something. + for (ConnectionProfile element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_listconnectionprofiles_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listconnectionprofiles/AsyncListConnectionProfilesPaged.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listconnectionprofiles/AsyncListConnectionProfilesPaged.java new file mode 100644 index 00000000..8ab4f567 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listconnectionprofiles/AsyncListConnectionProfilesPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_listconnectionprofiles_paged_async] +import com.google.cloud.datastream.v1.ConnectionProfile; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.ListConnectionProfilesRequest; +import com.google.cloud.datastream.v1.ListConnectionProfilesResponse; +import com.google.cloud.datastream.v1.LocationName; +import com.google.common.base.Strings; + +public class AsyncListConnectionProfilesPaged { + + public static void main(String[] args) throws Exception { + asyncListConnectionProfilesPaged(); + } + + public static void asyncListConnectionProfilesPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListConnectionProfilesRequest request = + ListConnectionProfilesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListConnectionProfilesResponse response = + datastreamClient.listConnectionProfilesCallable().call(request); + for (ConnectionProfile element : response.getConnectionProfilesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END datastream_v1_generated_datastreamclient_listconnectionprofiles_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listconnectionprofiles/SyncListConnectionProfiles.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listconnectionprofiles/SyncListConnectionProfiles.java new file mode 100644 index 00000000..d079891c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listconnectionprofiles/SyncListConnectionProfiles.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_listconnectionprofiles_sync] +import com.google.cloud.datastream.v1.ConnectionProfile; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.ListConnectionProfilesRequest; +import com.google.cloud.datastream.v1.LocationName; + +public class SyncListConnectionProfiles { + + public static void main(String[] args) throws Exception { + syncListConnectionProfiles(); + } + + public static void syncListConnectionProfiles() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListConnectionProfilesRequest request = + ListConnectionProfilesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (ConnectionProfile element : + datastreamClient.listConnectionProfiles(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_listconnectionprofiles_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listconnectionprofiles/SyncListConnectionProfilesLocationname.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listconnectionprofiles/SyncListConnectionProfilesLocationname.java new file mode 100644 index 00000000..2e2c71aa --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listconnectionprofiles/SyncListConnectionProfilesLocationname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_listconnectionprofiles_locationname_sync] +import com.google.cloud.datastream.v1.ConnectionProfile; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; + +public class SyncListConnectionProfilesLocationname { + + public static void main(String[] args) throws Exception { + syncListConnectionProfilesLocationname(); + } + + public static void syncListConnectionProfilesLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (ConnectionProfile element : + datastreamClient.listConnectionProfiles(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_listconnectionprofiles_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listconnectionprofiles/SyncListConnectionProfilesString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listconnectionprofiles/SyncListConnectionProfilesString.java new file mode 100644 index 00000000..5996bf5a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listconnectionprofiles/SyncListConnectionProfilesString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_listconnectionprofiles_string_sync] +import com.google.cloud.datastream.v1.ConnectionProfile; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; + +public class SyncListConnectionProfilesString { + + public static void main(String[] args) throws Exception { + syncListConnectionProfilesString(); + } + + public static void syncListConnectionProfilesString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (ConnectionProfile element : + datastreamClient.listConnectionProfiles(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_listconnectionprofiles_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listlocations/AsyncListLocations.java new file mode 100644 index 00000000..668593a6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listlocations/AsyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + datastreamClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 00000000..70ddb1b5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_listlocations_paged_async] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = datastreamClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END datastream_v1_generated_datastreamclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listlocations/SyncListLocations.java new file mode 100644 index 00000000..cc4a6212 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_listlocations_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : datastreamClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listprivateconnections/AsyncListPrivateConnections.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listprivateconnections/AsyncListPrivateConnections.java new file mode 100644 index 00000000..e5d8b3ca --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listprivateconnections/AsyncListPrivateConnections.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_listprivateconnections_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.ListPrivateConnectionsRequest; +import com.google.cloud.datastream.v1.LocationName; +import com.google.cloud.datastream.v1.PrivateConnection; + +public class AsyncListPrivateConnections { + + public static void main(String[] args) throws Exception { + asyncListPrivateConnections(); + } + + public static void asyncListPrivateConnections() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListPrivateConnectionsRequest request = + ListPrivateConnectionsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + datastreamClient.listPrivateConnectionsPagedCallable().futureCall(request); + // Do something. + for (PrivateConnection element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_listprivateconnections_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listprivateconnections/AsyncListPrivateConnectionsPaged.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listprivateconnections/AsyncListPrivateConnectionsPaged.java new file mode 100644 index 00000000..6491deb9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listprivateconnections/AsyncListPrivateConnectionsPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_listprivateconnections_paged_async] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.ListPrivateConnectionsRequest; +import com.google.cloud.datastream.v1.ListPrivateConnectionsResponse; +import com.google.cloud.datastream.v1.LocationName; +import com.google.cloud.datastream.v1.PrivateConnection; +import com.google.common.base.Strings; + +public class AsyncListPrivateConnectionsPaged { + + public static void main(String[] args) throws Exception { + asyncListPrivateConnectionsPaged(); + } + + public static void asyncListPrivateConnectionsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListPrivateConnectionsRequest request = + ListPrivateConnectionsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListPrivateConnectionsResponse response = + datastreamClient.listPrivateConnectionsCallable().call(request); + for (PrivateConnection element : response.getPrivateConnectionsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END datastream_v1_generated_datastreamclient_listprivateconnections_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listprivateconnections/SyncListPrivateConnections.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listprivateconnections/SyncListPrivateConnections.java new file mode 100644 index 00000000..d8a36ff7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listprivateconnections/SyncListPrivateConnections.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_listprivateconnections_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.ListPrivateConnectionsRequest; +import com.google.cloud.datastream.v1.LocationName; +import com.google.cloud.datastream.v1.PrivateConnection; + +public class SyncListPrivateConnections { + + public static void main(String[] args) throws Exception { + syncListPrivateConnections(); + } + + public static void syncListPrivateConnections() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListPrivateConnectionsRequest request = + ListPrivateConnectionsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (PrivateConnection element : + datastreamClient.listPrivateConnections(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_listprivateconnections_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listprivateconnections/SyncListPrivateConnectionsLocationname.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listprivateconnections/SyncListPrivateConnectionsLocationname.java new file mode 100644 index 00000000..9cb479c1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listprivateconnections/SyncListPrivateConnectionsLocationname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_listprivateconnections_locationname_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; +import com.google.cloud.datastream.v1.PrivateConnection; + +public class SyncListPrivateConnectionsLocationname { + + public static void main(String[] args) throws Exception { + syncListPrivateConnectionsLocationname(); + } + + public static void syncListPrivateConnectionsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (PrivateConnection element : + datastreamClient.listPrivateConnections(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_listprivateconnections_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listprivateconnections/SyncListPrivateConnectionsString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listprivateconnections/SyncListPrivateConnectionsString.java new file mode 100644 index 00000000..c9d2fdab --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listprivateconnections/SyncListPrivateConnectionsString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_listprivateconnections_string_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; +import com.google.cloud.datastream.v1.PrivateConnection; + +public class SyncListPrivateConnectionsString { + + public static void main(String[] args) throws Exception { + syncListPrivateConnectionsString(); + } + + public static void syncListPrivateConnectionsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (PrivateConnection element : + datastreamClient.listPrivateConnections(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_listprivateconnections_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listroutes/AsyncListRoutes.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listroutes/AsyncListRoutes.java new file mode 100644 index 00000000..2b5296c1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listroutes/AsyncListRoutes.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_listroutes_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.ListRoutesRequest; +import com.google.cloud.datastream.v1.PrivateConnectionName; +import com.google.cloud.datastream.v1.Route; + +public class AsyncListRoutes { + + public static void main(String[] args) throws Exception { + asyncListRoutes(); + } + + public static void asyncListRoutes() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListRoutesRequest request = + ListRoutesRequest.newBuilder() + .setParent( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = datastreamClient.listRoutesPagedCallable().futureCall(request); + // Do something. + for (Route element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_listroutes_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listroutes/AsyncListRoutesPaged.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listroutes/AsyncListRoutesPaged.java new file mode 100644 index 00000000..553ea725 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listroutes/AsyncListRoutesPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_listroutes_paged_async] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.ListRoutesRequest; +import com.google.cloud.datastream.v1.ListRoutesResponse; +import com.google.cloud.datastream.v1.PrivateConnectionName; +import com.google.cloud.datastream.v1.Route; +import com.google.common.base.Strings; + +public class AsyncListRoutesPaged { + + public static void main(String[] args) throws Exception { + asyncListRoutesPaged(); + } + + public static void asyncListRoutesPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListRoutesRequest request = + ListRoutesRequest.newBuilder() + .setParent( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListRoutesResponse response = datastreamClient.listRoutesCallable().call(request); + for (Route element : response.getRoutesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END datastream_v1_generated_datastreamclient_listroutes_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listroutes/SyncListRoutes.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listroutes/SyncListRoutes.java new file mode 100644 index 00000000..e99df138 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listroutes/SyncListRoutes.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_listroutes_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.ListRoutesRequest; +import com.google.cloud.datastream.v1.PrivateConnectionName; +import com.google.cloud.datastream.v1.Route; + +public class SyncListRoutes { + + public static void main(String[] args) throws Exception { + syncListRoutes(); + } + + public static void syncListRoutes() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListRoutesRequest request = + ListRoutesRequest.newBuilder() + .setParent( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (Route element : datastreamClient.listRoutes(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_listroutes_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listroutes/SyncListRoutesPrivateconnectionname.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listroutes/SyncListRoutesPrivateconnectionname.java new file mode 100644 index 00000000..80797e38 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listroutes/SyncListRoutesPrivateconnectionname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_listroutes_privateconnectionname_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.PrivateConnectionName; +import com.google.cloud.datastream.v1.Route; + +public class SyncListRoutesPrivateconnectionname { + + public static void main(String[] args) throws Exception { + syncListRoutesPrivateconnectionname(); + } + + public static void syncListRoutesPrivateconnectionname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + PrivateConnectionName parent = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + for (Route element : datastreamClient.listRoutes(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_listroutes_privateconnectionname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listroutes/SyncListRoutesString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listroutes/SyncListRoutesString.java new file mode 100644 index 00000000..d117db5c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/listroutes/SyncListRoutesString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_listroutes_string_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.PrivateConnectionName; +import com.google.cloud.datastream.v1.Route; + +public class SyncListRoutesString { + + public static void main(String[] args) throws Exception { + syncListRoutesString(); + } + + public static void syncListRoutesString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String parent = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]").toString(); + for (Route element : datastreamClient.listRoutes(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_listroutes_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreamobjects/AsyncListStreamObjects.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreamobjects/AsyncListStreamObjects.java new file mode 100644 index 00000000..43c870b3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreamobjects/AsyncListStreamObjects.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_liststreamobjects_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.ListStreamObjectsRequest; +import com.google.cloud.datastream.v1.StreamName; +import com.google.cloud.datastream.v1.StreamObject; + +public class AsyncListStreamObjects { + + public static void main(String[] args) throws Exception { + asyncListStreamObjects(); + } + + public static void asyncListStreamObjects() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListStreamObjectsRequest request = + ListStreamObjectsRequest.newBuilder() + .setParent(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + datastreamClient.listStreamObjectsPagedCallable().futureCall(request); + // Do something. + for (StreamObject element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_liststreamobjects_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreamobjects/AsyncListStreamObjectsPaged.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreamobjects/AsyncListStreamObjectsPaged.java new file mode 100644 index 00000000..feb745d7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreamobjects/AsyncListStreamObjectsPaged.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_liststreamobjects_paged_async] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.ListStreamObjectsRequest; +import com.google.cloud.datastream.v1.ListStreamObjectsResponse; +import com.google.cloud.datastream.v1.StreamName; +import com.google.cloud.datastream.v1.StreamObject; +import com.google.common.base.Strings; + +public class AsyncListStreamObjectsPaged { + + public static void main(String[] args) throws Exception { + asyncListStreamObjectsPaged(); + } + + public static void asyncListStreamObjectsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListStreamObjectsRequest request = + ListStreamObjectsRequest.newBuilder() + .setParent(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListStreamObjectsResponse response = + datastreamClient.listStreamObjectsCallable().call(request); + for (StreamObject element : response.getStreamObjectsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END datastream_v1_generated_datastreamclient_liststreamobjects_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreamobjects/SyncListStreamObjects.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreamobjects/SyncListStreamObjects.java new file mode 100644 index 00000000..1d63125d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreamobjects/SyncListStreamObjects.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_liststreamobjects_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.ListStreamObjectsRequest; +import com.google.cloud.datastream.v1.StreamName; +import com.google.cloud.datastream.v1.StreamObject; + +public class SyncListStreamObjects { + + public static void main(String[] args) throws Exception { + syncListStreamObjects(); + } + + public static void syncListStreamObjects() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListStreamObjectsRequest request = + ListStreamObjectsRequest.newBuilder() + .setParent(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (StreamObject element : datastreamClient.listStreamObjects(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_liststreamobjects_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreamobjects/SyncListStreamObjectsStreamname.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreamobjects/SyncListStreamObjectsStreamname.java new file mode 100644 index 00000000..89146b80 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreamobjects/SyncListStreamObjectsStreamname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_liststreamobjects_streamname_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.StreamName; +import com.google.cloud.datastream.v1.StreamObject; + +public class SyncListStreamObjectsStreamname { + + public static void main(String[] args) throws Exception { + syncListStreamObjectsStreamname(); + } + + public static void syncListStreamObjectsStreamname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + StreamName parent = StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]"); + for (StreamObject element : datastreamClient.listStreamObjects(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_liststreamobjects_streamname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreamobjects/SyncListStreamObjectsString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreamobjects/SyncListStreamObjectsString.java new file mode 100644 index 00000000..5b120a87 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreamobjects/SyncListStreamObjectsString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_liststreamobjects_string_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.StreamName; +import com.google.cloud.datastream.v1.StreamObject; + +public class SyncListStreamObjectsString { + + public static void main(String[] args) throws Exception { + syncListStreamObjectsString(); + } + + public static void syncListStreamObjectsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String parent = StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString(); + for (StreamObject element : datastreamClient.listStreamObjects(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_liststreamobjects_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreams/AsyncListStreams.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreams/AsyncListStreams.java new file mode 100644 index 00000000..642de506 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreams/AsyncListStreams.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_liststreams_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.ListStreamsRequest; +import com.google.cloud.datastream.v1.LocationName; +import com.google.cloud.datastream.v1.Stream; + +public class AsyncListStreams { + + public static void main(String[] args) throws Exception { + asyncListStreams(); + } + + public static void asyncListStreams() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListStreamsRequest request = + ListStreamsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = datastreamClient.listStreamsPagedCallable().futureCall(request); + // Do something. + for (Stream element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_liststreams_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreams/AsyncListStreamsPaged.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreams/AsyncListStreamsPaged.java new file mode 100644 index 00000000..bf9d9a53 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreams/AsyncListStreamsPaged.java @@ -0,0 +1,60 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_liststreams_paged_async] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.ListStreamsRequest; +import com.google.cloud.datastream.v1.ListStreamsResponse; +import com.google.cloud.datastream.v1.LocationName; +import com.google.cloud.datastream.v1.Stream; +import com.google.common.base.Strings; + +public class AsyncListStreamsPaged { + + public static void main(String[] args) throws Exception { + asyncListStreamsPaged(); + } + + public static void asyncListStreamsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListStreamsRequest request = + ListStreamsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListStreamsResponse response = datastreamClient.listStreamsCallable().call(request); + for (Stream element : response.getStreamsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END datastream_v1_generated_datastreamclient_liststreams_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreams/SyncListStreams.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreams/SyncListStreams.java new file mode 100644 index 00000000..cfda6260 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreams/SyncListStreams.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_liststreams_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.ListStreamsRequest; +import com.google.cloud.datastream.v1.LocationName; +import com.google.cloud.datastream.v1.Stream; + +public class SyncListStreams { + + public static void main(String[] args) throws Exception { + syncListStreams(); + } + + public static void syncListStreams() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListStreamsRequest request = + ListStreamsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (Stream element : datastreamClient.listStreams(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_liststreams_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreams/SyncListStreamsLocationname.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreams/SyncListStreamsLocationname.java new file mode 100644 index 00000000..2731f0e3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreams/SyncListStreamsLocationname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_liststreams_locationname_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; +import com.google.cloud.datastream.v1.Stream; + +public class SyncListStreamsLocationname { + + public static void main(String[] args) throws Exception { + syncListStreamsLocationname(); + } + + public static void syncListStreamsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Stream element : datastreamClient.listStreams(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_liststreams_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreams/SyncListStreamsString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreams/SyncListStreamsString.java new file mode 100644 index 00000000..699f3380 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/liststreams/SyncListStreamsString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_liststreams_string_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LocationName; +import com.google.cloud.datastream.v1.Stream; + +public class SyncListStreamsString { + + public static void main(String[] args) throws Exception { + syncListStreamsString(); + } + + public static void syncListStreamsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Stream element : datastreamClient.listStreams(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1_generated_datastreamclient_liststreams_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/lookupstreamobject/AsyncLookupStreamObject.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/lookupstreamobject/AsyncLookupStreamObject.java new file mode 100644 index 00000000..326c6cc3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/lookupstreamobject/AsyncLookupStreamObject.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_lookupstreamobject_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LookupStreamObjectRequest; +import com.google.cloud.datastream.v1.SourceObjectIdentifier; +import com.google.cloud.datastream.v1.StreamName; +import com.google.cloud.datastream.v1.StreamObject; + +public class AsyncLookupStreamObject { + + public static void main(String[] args) throws Exception { + asyncLookupStreamObject(); + } + + public static void asyncLookupStreamObject() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + LookupStreamObjectRequest request = + LookupStreamObjectRequest.newBuilder() + .setParent(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setSourceObjectIdentifier(SourceObjectIdentifier.newBuilder().build()) + .build(); + ApiFuture future = + datastreamClient.lookupStreamObjectCallable().futureCall(request); + // Do something. + StreamObject response = future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_lookupstreamobject_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/lookupstreamobject/SyncLookupStreamObject.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/lookupstreamobject/SyncLookupStreamObject.java new file mode 100644 index 00000000..0a6c1d0f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/lookupstreamobject/SyncLookupStreamObject.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_lookupstreamobject_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.LookupStreamObjectRequest; +import com.google.cloud.datastream.v1.SourceObjectIdentifier; +import com.google.cloud.datastream.v1.StreamName; +import com.google.cloud.datastream.v1.StreamObject; + +public class SyncLookupStreamObject { + + public static void main(String[] args) throws Exception { + syncLookupStreamObject(); + } + + public static void syncLookupStreamObject() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + LookupStreamObjectRequest request = + LookupStreamObjectRequest.newBuilder() + .setParent(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setSourceObjectIdentifier(SourceObjectIdentifier.newBuilder().build()) + .build(); + StreamObject response = datastreamClient.lookupStreamObject(request); + } + } +} +// [END datastream_v1_generated_datastreamclient_lookupstreamobject_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/startbackfilljob/AsyncStartBackfillJob.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/startbackfilljob/AsyncStartBackfillJob.java new file mode 100644 index 00000000..68e69127 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/startbackfilljob/AsyncStartBackfillJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_startbackfilljob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.StartBackfillJobRequest; +import com.google.cloud.datastream.v1.StartBackfillJobResponse; +import com.google.cloud.datastream.v1.StreamObjectName; + +public class AsyncStartBackfillJob { + + public static void main(String[] args) throws Exception { + asyncStartBackfillJob(); + } + + public static void asyncStartBackfillJob() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + StartBackfillJobRequest request = + StartBackfillJobRequest.newBuilder() + .setObject( + StreamObjectName.of("[PROJECT]", "[LOCATION]", "[STREAM]", "[OBJECT]").toString()) + .build(); + ApiFuture future = + datastreamClient.startBackfillJobCallable().futureCall(request); + // Do something. + StartBackfillJobResponse response = future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_startbackfilljob_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/startbackfilljob/SyncStartBackfillJob.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/startbackfilljob/SyncStartBackfillJob.java new file mode 100644 index 00000000..344cfc60 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/startbackfilljob/SyncStartBackfillJob.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_startbackfilljob_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.StartBackfillJobRequest; +import com.google.cloud.datastream.v1.StartBackfillJobResponse; +import com.google.cloud.datastream.v1.StreamObjectName; + +public class SyncStartBackfillJob { + + public static void main(String[] args) throws Exception { + syncStartBackfillJob(); + } + + public static void syncStartBackfillJob() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + StartBackfillJobRequest request = + StartBackfillJobRequest.newBuilder() + .setObject( + StreamObjectName.of("[PROJECT]", "[LOCATION]", "[STREAM]", "[OBJECT]").toString()) + .build(); + StartBackfillJobResponse response = datastreamClient.startBackfillJob(request); + } + } +} +// [END datastream_v1_generated_datastreamclient_startbackfilljob_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/startbackfilljob/SyncStartBackfillJobStreamobjectname.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/startbackfilljob/SyncStartBackfillJobStreamobjectname.java new file mode 100644 index 00000000..d170df66 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/startbackfilljob/SyncStartBackfillJobStreamobjectname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_startbackfilljob_streamobjectname_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.StartBackfillJobResponse; +import com.google.cloud.datastream.v1.StreamObjectName; + +public class SyncStartBackfillJobStreamobjectname { + + public static void main(String[] args) throws Exception { + syncStartBackfillJobStreamobjectname(); + } + + public static void syncStartBackfillJobStreamobjectname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + StreamObjectName object = + StreamObjectName.of("[PROJECT]", "[LOCATION]", "[STREAM]", "[OBJECT]"); + StartBackfillJobResponse response = datastreamClient.startBackfillJob(object); + } + } +} +// [END datastream_v1_generated_datastreamclient_startbackfilljob_streamobjectname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/startbackfilljob/SyncStartBackfillJobString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/startbackfilljob/SyncStartBackfillJobString.java new file mode 100644 index 00000000..41e84816 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/startbackfilljob/SyncStartBackfillJobString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_startbackfilljob_string_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.StartBackfillJobResponse; +import com.google.cloud.datastream.v1.StreamObjectName; + +public class SyncStartBackfillJobString { + + public static void main(String[] args) throws Exception { + syncStartBackfillJobString(); + } + + public static void syncStartBackfillJobString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String object = + StreamObjectName.of("[PROJECT]", "[LOCATION]", "[STREAM]", "[OBJECT]").toString(); + StartBackfillJobResponse response = datastreamClient.startBackfillJob(object); + } + } +} +// [END datastream_v1_generated_datastreamclient_startbackfilljob_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/stopbackfilljob/AsyncStopBackfillJob.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/stopbackfilljob/AsyncStopBackfillJob.java new file mode 100644 index 00000000..fc6003fa --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/stopbackfilljob/AsyncStopBackfillJob.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_stopbackfilljob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.StopBackfillJobRequest; +import com.google.cloud.datastream.v1.StopBackfillJobResponse; +import com.google.cloud.datastream.v1.StreamObjectName; + +public class AsyncStopBackfillJob { + + public static void main(String[] args) throws Exception { + asyncStopBackfillJob(); + } + + public static void asyncStopBackfillJob() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + StopBackfillJobRequest request = + StopBackfillJobRequest.newBuilder() + .setObject( + StreamObjectName.of("[PROJECT]", "[LOCATION]", "[STREAM]", "[OBJECT]").toString()) + .build(); + ApiFuture future = + datastreamClient.stopBackfillJobCallable().futureCall(request); + // Do something. + StopBackfillJobResponse response = future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_stopbackfilljob_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/stopbackfilljob/SyncStopBackfillJob.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/stopbackfilljob/SyncStopBackfillJob.java new file mode 100644 index 00000000..5d748754 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/stopbackfilljob/SyncStopBackfillJob.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_stopbackfilljob_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.StopBackfillJobRequest; +import com.google.cloud.datastream.v1.StopBackfillJobResponse; +import com.google.cloud.datastream.v1.StreamObjectName; + +public class SyncStopBackfillJob { + + public static void main(String[] args) throws Exception { + syncStopBackfillJob(); + } + + public static void syncStopBackfillJob() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + StopBackfillJobRequest request = + StopBackfillJobRequest.newBuilder() + .setObject( + StreamObjectName.of("[PROJECT]", "[LOCATION]", "[STREAM]", "[OBJECT]").toString()) + .build(); + StopBackfillJobResponse response = datastreamClient.stopBackfillJob(request); + } + } +} +// [END datastream_v1_generated_datastreamclient_stopbackfilljob_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/stopbackfilljob/SyncStopBackfillJobStreamobjectname.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/stopbackfilljob/SyncStopBackfillJobStreamobjectname.java new file mode 100644 index 00000000..aab47b17 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/stopbackfilljob/SyncStopBackfillJobStreamobjectname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_stopbackfilljob_streamobjectname_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.StopBackfillJobResponse; +import com.google.cloud.datastream.v1.StreamObjectName; + +public class SyncStopBackfillJobStreamobjectname { + + public static void main(String[] args) throws Exception { + syncStopBackfillJobStreamobjectname(); + } + + public static void syncStopBackfillJobStreamobjectname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + StreamObjectName object = + StreamObjectName.of("[PROJECT]", "[LOCATION]", "[STREAM]", "[OBJECT]"); + StopBackfillJobResponse response = datastreamClient.stopBackfillJob(object); + } + } +} +// [END datastream_v1_generated_datastreamclient_stopbackfilljob_streamobjectname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/stopbackfilljob/SyncStopBackfillJobString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/stopbackfilljob/SyncStopBackfillJobString.java new file mode 100644 index 00000000..af1d4233 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/stopbackfilljob/SyncStopBackfillJobString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_stopbackfilljob_string_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.StopBackfillJobResponse; +import com.google.cloud.datastream.v1.StreamObjectName; + +public class SyncStopBackfillJobString { + + public static void main(String[] args) throws Exception { + syncStopBackfillJobString(); + } + + public static void syncStopBackfillJobString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String object = + StreamObjectName.of("[PROJECT]", "[LOCATION]", "[STREAM]", "[OBJECT]").toString(); + StopBackfillJobResponse response = datastreamClient.stopBackfillJob(object); + } + } +} +// [END datastream_v1_generated_datastreamclient_stopbackfilljob_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updateconnectionprofile/AsyncUpdateConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updateconnectionprofile/AsyncUpdateConnectionProfile.java new file mode 100644 index 00000000..ba59f850 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updateconnectionprofile/AsyncUpdateConnectionProfile.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_updateconnectionprofile_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.ConnectionProfile; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.UpdateConnectionProfileRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateConnectionProfile { + + public static void main(String[] args) throws Exception { + asyncUpdateConnectionProfile(); + } + + public static void asyncUpdateConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + UpdateConnectionProfileRequest request = + UpdateConnectionProfileRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setConnectionProfile(ConnectionProfile.newBuilder().build()) + .setRequestId("requestId693933066") + .setValidateOnly(true) + .setForce(true) + .build(); + ApiFuture future = + datastreamClient.updateConnectionProfileCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_updateconnectionprofile_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updateconnectionprofile/AsyncUpdateConnectionProfileLRO.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updateconnectionprofile/AsyncUpdateConnectionProfileLRO.java new file mode 100644 index 00000000..ee25d636 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updateconnectionprofile/AsyncUpdateConnectionProfileLRO.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_updateconnectionprofile_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.datastream.v1.ConnectionProfile; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.OperationMetadata; +import com.google.cloud.datastream.v1.UpdateConnectionProfileRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateConnectionProfileLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateConnectionProfileLRO(); + } + + public static void asyncUpdateConnectionProfileLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + UpdateConnectionProfileRequest request = + UpdateConnectionProfileRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setConnectionProfile(ConnectionProfile.newBuilder().build()) + .setRequestId("requestId693933066") + .setValidateOnly(true) + .setForce(true) + .build(); + OperationFuture future = + datastreamClient.updateConnectionProfileOperationCallable().futureCall(request); + // Do something. + ConnectionProfile response = future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_updateconnectionprofile_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfile.java new file mode 100644 index 00000000..e83322c9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfile.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_updateconnectionprofile_sync] +import com.google.cloud.datastream.v1.ConnectionProfile; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.UpdateConnectionProfileRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateConnectionProfile { + + public static void main(String[] args) throws Exception { + syncUpdateConnectionProfile(); + } + + public static void syncUpdateConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + UpdateConnectionProfileRequest request = + UpdateConnectionProfileRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setConnectionProfile(ConnectionProfile.newBuilder().build()) + .setRequestId("requestId693933066") + .setValidateOnly(true) + .setForce(true) + .build(); + ConnectionProfile response = datastreamClient.updateConnectionProfileAsync(request).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_updateconnectionprofile_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfileConnectionprofileFieldmask.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfileConnectionprofileFieldmask.java new file mode 100644 index 00000000..82d2f69b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfileConnectionprofileFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START +// datastream_v1_generated_datastreamclient_updateconnectionprofile_connectionprofilefieldmask_sync] +import com.google.cloud.datastream.v1.ConnectionProfile; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateConnectionProfileConnectionprofileFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateConnectionProfileConnectionprofileFieldmask(); + } + + public static void syncUpdateConnectionProfileConnectionprofileFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ConnectionProfile connectionProfile = ConnectionProfile.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + ConnectionProfile response = + datastreamClient.updateConnectionProfileAsync(connectionProfile, updateMask).get(); + } + } +} +// [END +// datastream_v1_generated_datastreamclient_updateconnectionprofile_connectionprofilefieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updatestream/AsyncUpdateStream.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updatestream/AsyncUpdateStream.java new file mode 100644 index 00000000..ac391b69 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updatestream/AsyncUpdateStream.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_updatestream_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.Stream; +import com.google.cloud.datastream.v1.UpdateStreamRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateStream { + + public static void main(String[] args) throws Exception { + asyncUpdateStream(); + } + + public static void asyncUpdateStream() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + UpdateStreamRequest request = + UpdateStreamRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setStream(Stream.newBuilder().build()) + .setRequestId("requestId693933066") + .setValidateOnly(true) + .setForce(true) + .build(); + ApiFuture future = datastreamClient.updateStreamCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_updatestream_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updatestream/AsyncUpdateStreamLRO.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updatestream/AsyncUpdateStreamLRO.java new file mode 100644 index 00000000..dfaf286c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updatestream/AsyncUpdateStreamLRO.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_updatestream_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.OperationMetadata; +import com.google.cloud.datastream.v1.Stream; +import com.google.cloud.datastream.v1.UpdateStreamRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateStreamLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateStreamLRO(); + } + + public static void asyncUpdateStreamLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + UpdateStreamRequest request = + UpdateStreamRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setStream(Stream.newBuilder().build()) + .setRequestId("requestId693933066") + .setValidateOnly(true) + .setForce(true) + .build(); + OperationFuture future = + datastreamClient.updateStreamOperationCallable().futureCall(request); + // Do something. + Stream response = future.get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_updatestream_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updatestream/SyncUpdateStream.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updatestream/SyncUpdateStream.java new file mode 100644 index 00000000..13b35c87 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updatestream/SyncUpdateStream.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_updatestream_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.Stream; +import com.google.cloud.datastream.v1.UpdateStreamRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateStream { + + public static void main(String[] args) throws Exception { + syncUpdateStream(); + } + + public static void syncUpdateStream() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + UpdateStreamRequest request = + UpdateStreamRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setStream(Stream.newBuilder().build()) + .setRequestId("requestId693933066") + .setValidateOnly(true) + .setForce(true) + .build(); + Stream response = datastreamClient.updateStreamAsync(request).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_updatestream_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updatestream/SyncUpdateStreamStreamFieldmask.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updatestream/SyncUpdateStreamStreamFieldmask.java new file mode 100644 index 00000000..00f5dfd4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updatestream/SyncUpdateStreamStreamFieldmask.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamclient_updatestream_streamfieldmask_sync] +import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.cloud.datastream.v1.Stream; +import com.google.protobuf.FieldMask; + +public class SyncUpdateStreamStreamFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateStreamStreamFieldmask(); + } + + public static void syncUpdateStreamStreamFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + Stream stream = Stream.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Stream response = datastreamClient.updateStreamAsync(stream, updateMask).get(); + } + } +} +// [END datastream_v1_generated_datastreamclient_updatestream_streamfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamsettings/getconnectionprofile/SyncGetConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamsettings/getconnectionprofile/SyncGetConnectionProfile.java new file mode 100644 index 00000000..2f9eb9e8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamsettings/getconnectionprofile/SyncGetConnectionProfile.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.samples; + +// [START datastream_v1_generated_datastreamsettings_getconnectionprofile_sync] +import com.google.cloud.datastream.v1.DatastreamSettings; +import java.time.Duration; + +public class SyncGetConnectionProfile { + + public static void main(String[] args) throws Exception { + syncGetConnectionProfile(); + } + + public static void syncGetConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DatastreamSettings.Builder datastreamSettingsBuilder = DatastreamSettings.newBuilder(); + datastreamSettingsBuilder + .getConnectionProfileSettings() + .setRetrySettings( + datastreamSettingsBuilder + .getConnectionProfileSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + DatastreamSettings datastreamSettings = datastreamSettingsBuilder.build(); + } +} +// [END datastream_v1_generated_datastreamsettings_getconnectionprofile_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/stub/datastreamstubsettings/getconnectionprofile/SyncGetConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1/stub/datastreamstubsettings/getconnectionprofile/SyncGetConnectionProfile.java new file mode 100644 index 00000000..9e86dfda --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/stub/datastreamstubsettings/getconnectionprofile/SyncGetConnectionProfile.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1.stub.samples; + +// [START datastream_v1_generated_datastreamstubsettings_getconnectionprofile_sync] +import com.google.cloud.datastream.v1.stub.DatastreamStubSettings; +import java.time.Duration; + +public class SyncGetConnectionProfile { + + public static void main(String[] args) throws Exception { + syncGetConnectionProfile(); + } + + public static void syncGetConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DatastreamStubSettings.Builder datastreamSettingsBuilder = DatastreamStubSettings.newBuilder(); + datastreamSettingsBuilder + .getConnectionProfileSettings() + .setRetrySettings( + datastreamSettingsBuilder + .getConnectionProfileSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + DatastreamStubSettings datastreamSettings = datastreamSettingsBuilder.build(); + } +} +// [END datastream_v1_generated_datastreamstubsettings_getconnectionprofile_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..154ec306 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.DatastreamSettings; +import com.google.cloud.datastream.v1alpha1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DatastreamSettings datastreamSettings = + DatastreamSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + DatastreamClient datastreamClient = DatastreamClient.create(datastreamSettings); + } +} +// [END datastream_v1alpha1_generated_datastreamclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000..04dbdc70 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_create_setcredentialsprovider1_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.DatastreamSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DatastreamSettings datastreamSettings = + DatastreamSettings.newBuilder() + .setTransportChannelProvider( + DatastreamSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + DatastreamClient datastreamClient = DatastreamClient.create(datastreamSettings); + } +} +// [END datastream_v1alpha1_generated_datastreamclient_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..a3d6a834 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_create_setendpoint_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.DatastreamSettings; +import com.google.cloud.datastream.v1alpha1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DatastreamSettings datastreamSettings = + DatastreamSettings.newBuilder().setEndpoint(myEndpoint).build(); + DatastreamClient datastreamClient = DatastreamClient.create(datastreamSettings); + } +} +// [END datastream_v1alpha1_generated_datastreamclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/AsyncCreateConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/AsyncCreateConnectionProfile.java new file mode 100644 index 00000000..ec27fdb7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/AsyncCreateConnectionProfile.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_createconnectionprofile_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1alpha1.ConnectionProfile; +import com.google.cloud.datastream.v1alpha1.CreateConnectionProfileRequest; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateConnectionProfile { + + public static void main(String[] args) throws Exception { + asyncCreateConnectionProfile(); + } + + public static void asyncCreateConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreateConnectionProfileRequest request = + CreateConnectionProfileRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setConnectionProfileId("connectionProfileId597575526") + .setConnectionProfile(ConnectionProfile.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + datastreamClient.createConnectionProfileCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_createconnectionprofile_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/AsyncCreateConnectionProfileLRO.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/AsyncCreateConnectionProfileLRO.java new file mode 100644 index 00000000..e4d95f53 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/AsyncCreateConnectionProfileLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_createconnectionprofile_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.datastream.v1alpha1.ConnectionProfile; +import com.google.cloud.datastream.v1alpha1.CreateConnectionProfileRequest; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.cloud.datastream.v1alpha1.OperationMetadata; + +public class AsyncCreateConnectionProfileLRO { + + public static void main(String[] args) throws Exception { + asyncCreateConnectionProfileLRO(); + } + + public static void asyncCreateConnectionProfileLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreateConnectionProfileRequest request = + CreateConnectionProfileRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setConnectionProfileId("connectionProfileId597575526") + .setConnectionProfile(ConnectionProfile.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + datastreamClient.createConnectionProfileOperationCallable().futureCall(request); + // Do something. + ConnectionProfile response = future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_createconnectionprofile_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfile.java new file mode 100644 index 00000000..4ce1011a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfile.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_createconnectionprofile_sync] +import com.google.cloud.datastream.v1alpha1.ConnectionProfile; +import com.google.cloud.datastream.v1alpha1.CreateConnectionProfileRequest; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; + +public class SyncCreateConnectionProfile { + + public static void main(String[] args) throws Exception { + syncCreateConnectionProfile(); + } + + public static void syncCreateConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreateConnectionProfileRequest request = + CreateConnectionProfileRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setConnectionProfileId("connectionProfileId597575526") + .setConnectionProfile(ConnectionProfile.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ConnectionProfile response = datastreamClient.createConnectionProfileAsync(request).get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_createconnectionprofile_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileLocationnameConnectionprofileString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileLocationnameConnectionprofileString.java new file mode 100644 index 00000000..8428a0f3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileLocationnameConnectionprofileString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START +// datastream_v1alpha1_generated_datastreamclient_createconnectionprofile_locationnameconnectionprofilestring_sync] +import com.google.cloud.datastream.v1alpha1.ConnectionProfile; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; + +public class SyncCreateConnectionProfileLocationnameConnectionprofileString { + + public static void main(String[] args) throws Exception { + syncCreateConnectionProfileLocationnameConnectionprofileString(); + } + + public static void syncCreateConnectionProfileLocationnameConnectionprofileString() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + ConnectionProfile connectionProfile = ConnectionProfile.newBuilder().build(); + String connectionProfileId = "connectionProfileId597575526"; + ConnectionProfile response = + datastreamClient + .createConnectionProfileAsync(parent, connectionProfile, connectionProfileId) + .get(); + } + } +} +// [END +// datastream_v1alpha1_generated_datastreamclient_createconnectionprofile_locationnameconnectionprofilestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileStringConnectionprofileString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileStringConnectionprofileString.java new file mode 100644 index 00000000..9c9bed05 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileStringConnectionprofileString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START +// datastream_v1alpha1_generated_datastreamclient_createconnectionprofile_stringconnectionprofilestring_sync] +import com.google.cloud.datastream.v1alpha1.ConnectionProfile; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; + +public class SyncCreateConnectionProfileStringConnectionprofileString { + + public static void main(String[] args) throws Exception { + syncCreateConnectionProfileStringConnectionprofileString(); + } + + public static void syncCreateConnectionProfileStringConnectionprofileString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + ConnectionProfile connectionProfile = ConnectionProfile.newBuilder().build(); + String connectionProfileId = "connectionProfileId597575526"; + ConnectionProfile response = + datastreamClient + .createConnectionProfileAsync(parent, connectionProfile, connectionProfileId) + .get(); + } + } +} +// [END +// datastream_v1alpha1_generated_datastreamclient_createconnectionprofile_stringconnectionprofilestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/AsyncCreatePrivateConnection.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/AsyncCreatePrivateConnection.java new file mode 100644 index 00000000..6890a35d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/AsyncCreatePrivateConnection.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_createprivateconnection_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1alpha1.CreatePrivateConnectionRequest; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.cloud.datastream.v1alpha1.PrivateConnection; +import com.google.longrunning.Operation; + +public class AsyncCreatePrivateConnection { + + public static void main(String[] args) throws Exception { + asyncCreatePrivateConnection(); + } + + public static void asyncCreatePrivateConnection() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreatePrivateConnectionRequest request = + CreatePrivateConnectionRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPrivateConnectionId("privateConnectionId-1926654532") + .setPrivateConnection(PrivateConnection.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + datastreamClient.createPrivateConnectionCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_createprivateconnection_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/AsyncCreatePrivateConnectionLRO.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/AsyncCreatePrivateConnectionLRO.java new file mode 100644 index 00000000..02990337 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/AsyncCreatePrivateConnectionLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_createprivateconnection_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.datastream.v1alpha1.CreatePrivateConnectionRequest; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.cloud.datastream.v1alpha1.OperationMetadata; +import com.google.cloud.datastream.v1alpha1.PrivateConnection; + +public class AsyncCreatePrivateConnectionLRO { + + public static void main(String[] args) throws Exception { + asyncCreatePrivateConnectionLRO(); + } + + public static void asyncCreatePrivateConnectionLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreatePrivateConnectionRequest request = + CreatePrivateConnectionRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPrivateConnectionId("privateConnectionId-1926654532") + .setPrivateConnection(PrivateConnection.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + datastreamClient.createPrivateConnectionOperationCallable().futureCall(request); + // Do something. + PrivateConnection response = future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_createprivateconnection_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/SyncCreatePrivateConnection.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/SyncCreatePrivateConnection.java new file mode 100644 index 00000000..c5235abb --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/SyncCreatePrivateConnection.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_createprivateconnection_sync] +import com.google.cloud.datastream.v1alpha1.CreatePrivateConnectionRequest; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.cloud.datastream.v1alpha1.PrivateConnection; + +public class SyncCreatePrivateConnection { + + public static void main(String[] args) throws Exception { + syncCreatePrivateConnection(); + } + + public static void syncCreatePrivateConnection() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreatePrivateConnectionRequest request = + CreatePrivateConnectionRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPrivateConnectionId("privateConnectionId-1926654532") + .setPrivateConnection(PrivateConnection.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + PrivateConnection response = datastreamClient.createPrivateConnectionAsync(request).get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_createprivateconnection_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionLocationnamePrivateconnectionString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionLocationnamePrivateconnectionString.java new file mode 100644 index 00000000..75b5668d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionLocationnamePrivateconnectionString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START +// datastream_v1alpha1_generated_datastreamclient_createprivateconnection_locationnameprivateconnectionstring_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.cloud.datastream.v1alpha1.PrivateConnection; + +public class SyncCreatePrivateConnectionLocationnamePrivateconnectionString { + + public static void main(String[] args) throws Exception { + syncCreatePrivateConnectionLocationnamePrivateconnectionString(); + } + + public static void syncCreatePrivateConnectionLocationnamePrivateconnectionString() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + PrivateConnection privateConnection = PrivateConnection.newBuilder().build(); + String privateConnectionId = "privateConnectionId-1926654532"; + PrivateConnection response = + datastreamClient + .createPrivateConnectionAsync(parent, privateConnection, privateConnectionId) + .get(); + } + } +} +// [END +// datastream_v1alpha1_generated_datastreamclient_createprivateconnection_locationnameprivateconnectionstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionStringPrivateconnectionString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionStringPrivateconnectionString.java new file mode 100644 index 00000000..629cb8ad --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionStringPrivateconnectionString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START +// datastream_v1alpha1_generated_datastreamclient_createprivateconnection_stringprivateconnectionstring_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.cloud.datastream.v1alpha1.PrivateConnection; + +public class SyncCreatePrivateConnectionStringPrivateconnectionString { + + public static void main(String[] args) throws Exception { + syncCreatePrivateConnectionStringPrivateconnectionString(); + } + + public static void syncCreatePrivateConnectionStringPrivateconnectionString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + PrivateConnection privateConnection = PrivateConnection.newBuilder().build(); + String privateConnectionId = "privateConnectionId-1926654532"; + PrivateConnection response = + datastreamClient + .createPrivateConnectionAsync(parent, privateConnection, privateConnectionId) + .get(); + } + } +} +// [END +// datastream_v1alpha1_generated_datastreamclient_createprivateconnection_stringprivateconnectionstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/AsyncCreateRoute.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/AsyncCreateRoute.java new file mode 100644 index 00000000..1e6a07be --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/AsyncCreateRoute.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_createroute_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1alpha1.CreateRouteRequest; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; +import com.google.cloud.datastream.v1alpha1.Route; +import com.google.longrunning.Operation; + +public class AsyncCreateRoute { + + public static void main(String[] args) throws Exception { + asyncCreateRoute(); + } + + public static void asyncCreateRoute() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreateRouteRequest request = + CreateRouteRequest.newBuilder() + .setParent( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setRouteId("routeId1385647428") + .setRoute(Route.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = datastreamClient.createRouteCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_createroute_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/AsyncCreateRouteLRO.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/AsyncCreateRouteLRO.java new file mode 100644 index 00000000..fcb10e9d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/AsyncCreateRouteLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_createroute_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.datastream.v1alpha1.CreateRouteRequest; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.OperationMetadata; +import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; +import com.google.cloud.datastream.v1alpha1.Route; + +public class AsyncCreateRouteLRO { + + public static void main(String[] args) throws Exception { + asyncCreateRouteLRO(); + } + + public static void asyncCreateRouteLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreateRouteRequest request = + CreateRouteRequest.newBuilder() + .setParent( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setRouteId("routeId1385647428") + .setRoute(Route.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + datastreamClient.createRouteOperationCallable().futureCall(request); + // Do something. + Route response = future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_createroute_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/SyncCreateRoute.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/SyncCreateRoute.java new file mode 100644 index 00000000..012c1a62 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/SyncCreateRoute.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_createroute_sync] +import com.google.cloud.datastream.v1alpha1.CreateRouteRequest; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; +import com.google.cloud.datastream.v1alpha1.Route; + +public class SyncCreateRoute { + + public static void main(String[] args) throws Exception { + syncCreateRoute(); + } + + public static void syncCreateRoute() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreateRouteRequest request = + CreateRouteRequest.newBuilder() + .setParent( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setRouteId("routeId1385647428") + .setRoute(Route.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + Route response = datastreamClient.createRouteAsync(request).get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_createroute_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/SyncCreateRoutePrivateconnectionnameRouteString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/SyncCreateRoutePrivateconnectionnameRouteString.java new file mode 100644 index 00000000..7af1ee5a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/SyncCreateRoutePrivateconnectionnameRouteString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START +// datastream_v1alpha1_generated_datastreamclient_createroute_privateconnectionnameroutestring_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; +import com.google.cloud.datastream.v1alpha1.Route; + +public class SyncCreateRoutePrivateconnectionnameRouteString { + + public static void main(String[] args) throws Exception { + syncCreateRoutePrivateconnectionnameRouteString(); + } + + public static void syncCreateRoutePrivateconnectionnameRouteString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + PrivateConnectionName parent = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + Route route = Route.newBuilder().build(); + String routeId = "routeId1385647428"; + Route response = datastreamClient.createRouteAsync(parent, route, routeId).get(); + } + } +} +// [END +// datastream_v1alpha1_generated_datastreamclient_createroute_privateconnectionnameroutestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/SyncCreateRouteStringRouteString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/SyncCreateRouteStringRouteString.java new file mode 100644 index 00000000..0f73a337 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/SyncCreateRouteStringRouteString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_createroute_stringroutestring_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; +import com.google.cloud.datastream.v1alpha1.Route; + +public class SyncCreateRouteStringRouteString { + + public static void main(String[] args) throws Exception { + syncCreateRouteStringRouteString(); + } + + public static void syncCreateRouteStringRouteString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String parent = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]").toString(); + Route route = Route.newBuilder().build(); + String routeId = "routeId1385647428"; + Route response = datastreamClient.createRouteAsync(parent, route, routeId).get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_createroute_stringroutestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createstream/AsyncCreateStream.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createstream/AsyncCreateStream.java new file mode 100644 index 00000000..a787d4ef --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createstream/AsyncCreateStream.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_createstream_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1alpha1.CreateStreamRequest; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.cloud.datastream.v1alpha1.Stream; +import com.google.longrunning.Operation; + +public class AsyncCreateStream { + + public static void main(String[] args) throws Exception { + asyncCreateStream(); + } + + public static void asyncCreateStream() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreateStreamRequest request = + CreateStreamRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setStreamId("streamId1790933179") + .setStream(Stream.newBuilder().build()) + .setRequestId("requestId693933066") + .setValidateOnly(true) + .setForce(true) + .build(); + ApiFuture future = datastreamClient.createStreamCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_createstream_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createstream/AsyncCreateStreamLRO.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createstream/AsyncCreateStreamLRO.java new file mode 100644 index 00000000..78833470 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createstream/AsyncCreateStreamLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_createstream_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.datastream.v1alpha1.CreateStreamRequest; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.cloud.datastream.v1alpha1.OperationMetadata; +import com.google.cloud.datastream.v1alpha1.Stream; + +public class AsyncCreateStreamLRO { + + public static void main(String[] args) throws Exception { + asyncCreateStreamLRO(); + } + + public static void asyncCreateStreamLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreateStreamRequest request = + CreateStreamRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setStreamId("streamId1790933179") + .setStream(Stream.newBuilder().build()) + .setRequestId("requestId693933066") + .setValidateOnly(true) + .setForce(true) + .build(); + OperationFuture future = + datastreamClient.createStreamOperationCallable().futureCall(request); + // Do something. + Stream response = future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_createstream_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createstream/SyncCreateStream.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createstream/SyncCreateStream.java new file mode 100644 index 00000000..b84a3b17 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createstream/SyncCreateStream.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_createstream_sync] +import com.google.cloud.datastream.v1alpha1.CreateStreamRequest; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.cloud.datastream.v1alpha1.Stream; + +public class SyncCreateStream { + + public static void main(String[] args) throws Exception { + syncCreateStream(); + } + + public static void syncCreateStream() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + CreateStreamRequest request = + CreateStreamRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setStreamId("streamId1790933179") + .setStream(Stream.newBuilder().build()) + .setRequestId("requestId693933066") + .setValidateOnly(true) + .setForce(true) + .build(); + Stream response = datastreamClient.createStreamAsync(request).get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_createstream_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createstream/SyncCreateStreamLocationnameStreamString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createstream/SyncCreateStreamLocationnameStreamString.java new file mode 100644 index 00000000..eeb716d5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createstream/SyncCreateStreamLocationnameStreamString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_createstream_locationnamestreamstring_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.cloud.datastream.v1alpha1.Stream; + +public class SyncCreateStreamLocationnameStreamString { + + public static void main(String[] args) throws Exception { + syncCreateStreamLocationnameStreamString(); + } + + public static void syncCreateStreamLocationnameStreamString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Stream stream = Stream.newBuilder().build(); + String streamId = "streamId1790933179"; + Stream response = datastreamClient.createStreamAsync(parent, stream, streamId).get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_createstream_locationnamestreamstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createstream/SyncCreateStreamStringStreamString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createstream/SyncCreateStreamStringStreamString.java new file mode 100644 index 00000000..00fbfea6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createstream/SyncCreateStreamStringStreamString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_createstream_stringstreamstring_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.cloud.datastream.v1alpha1.Stream; + +public class SyncCreateStreamStringStreamString { + + public static void main(String[] args) throws Exception { + syncCreateStreamStringStreamString(); + } + + public static void syncCreateStreamStringStreamString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Stream stream = Stream.newBuilder().build(); + String streamId = "streamId1790933179"; + Stream response = datastreamClient.createStreamAsync(parent, stream, streamId).get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_createstream_stringstreamstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/AsyncDeleteConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/AsyncDeleteConnectionProfile.java new file mode 100644 index 00000000..fc438bdb --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/AsyncDeleteConnectionProfile.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_deleteconnectionprofile_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1alpha1.ConnectionProfileName; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.DeleteConnectionProfileRequest; +import com.google.longrunning.Operation; + +public class AsyncDeleteConnectionProfile { + + public static void main(String[] args) throws Exception { + asyncDeleteConnectionProfile(); + } + + public static void asyncDeleteConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeleteConnectionProfileRequest request = + DeleteConnectionProfileRequest.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + datastreamClient.deleteConnectionProfileCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_deleteconnectionprofile_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/AsyncDeleteConnectionProfileLRO.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/AsyncDeleteConnectionProfileLRO.java new file mode 100644 index 00000000..6484b9fc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/AsyncDeleteConnectionProfileLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_deleteconnectionprofile_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.datastream.v1alpha1.ConnectionProfileName; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.DeleteConnectionProfileRequest; +import com.google.cloud.datastream.v1alpha1.OperationMetadata; +import com.google.protobuf.Empty; + +public class AsyncDeleteConnectionProfileLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteConnectionProfileLRO(); + } + + public static void asyncDeleteConnectionProfileLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeleteConnectionProfileRequest request = + DeleteConnectionProfileRequest.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + datastreamClient.deleteConnectionProfileOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_deleteconnectionprofile_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfile.java new file mode 100644 index 00000000..050e4b65 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfile.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_deleteconnectionprofile_sync] +import com.google.cloud.datastream.v1alpha1.ConnectionProfileName; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.DeleteConnectionProfileRequest; + +public class SyncDeleteConnectionProfile { + + public static void main(String[] args) throws Exception { + syncDeleteConnectionProfile(); + } + + public static void syncDeleteConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeleteConnectionProfileRequest request = + DeleteConnectionProfileRequest.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .setRequestId("requestId693933066") + .build(); + datastreamClient.deleteConnectionProfileAsync(request).get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_deleteconnectionprofile_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileConnectionprofilename.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileConnectionprofilename.java new file mode 100644 index 00000000..59770783 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileConnectionprofilename.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START +// datastream_v1alpha1_generated_datastreamclient_deleteconnectionprofile_connectionprofilename_sync] +import com.google.cloud.datastream.v1alpha1.ConnectionProfileName; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; + +public class SyncDeleteConnectionProfileConnectionprofilename { + + public static void main(String[] args) throws Exception { + syncDeleteConnectionProfileConnectionprofilename(); + } + + public static void syncDeleteConnectionProfileConnectionprofilename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ConnectionProfileName name = + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]"); + datastreamClient.deleteConnectionProfileAsync(name).get(); + } + } +} +// [END +// datastream_v1alpha1_generated_datastreamclient_deleteconnectionprofile_connectionprofilename_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileString.java new file mode 100644 index 00000000..3779bf27 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_deleteconnectionprofile_string_sync] +import com.google.cloud.datastream.v1alpha1.ConnectionProfileName; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; + +public class SyncDeleteConnectionProfileString { + + public static void main(String[] args) throws Exception { + syncDeleteConnectionProfileString(); + } + + public static void syncDeleteConnectionProfileString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String name = + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]").toString(); + datastreamClient.deleteConnectionProfileAsync(name).get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_deleteconnectionprofile_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/AsyncDeletePrivateConnection.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/AsyncDeletePrivateConnection.java new file mode 100644 index 00000000..df006ec0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/AsyncDeletePrivateConnection.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_deleteprivateconnection_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.DeletePrivateConnectionRequest; +import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; +import com.google.longrunning.Operation; + +public class AsyncDeletePrivateConnection { + + public static void main(String[] args) throws Exception { + asyncDeletePrivateConnection(); + } + + public static void asyncDeletePrivateConnection() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeletePrivateConnectionRequest request = + DeletePrivateConnectionRequest.newBuilder() + .setName( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setRequestId("requestId693933066") + .setForce(true) + .build(); + ApiFuture future = + datastreamClient.deletePrivateConnectionCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_deleteprivateconnection_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/AsyncDeletePrivateConnectionLRO.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/AsyncDeletePrivateConnectionLRO.java new file mode 100644 index 00000000..70c7d8ec --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/AsyncDeletePrivateConnectionLRO.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_deleteprivateconnection_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.DeletePrivateConnectionRequest; +import com.google.cloud.datastream.v1alpha1.OperationMetadata; +import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; +import com.google.protobuf.Empty; + +public class AsyncDeletePrivateConnectionLRO { + + public static void main(String[] args) throws Exception { + asyncDeletePrivateConnectionLRO(); + } + + public static void asyncDeletePrivateConnectionLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeletePrivateConnectionRequest request = + DeletePrivateConnectionRequest.newBuilder() + .setName( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setRequestId("requestId693933066") + .setForce(true) + .build(); + OperationFuture future = + datastreamClient.deletePrivateConnectionOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_deleteprivateconnection_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnection.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnection.java new file mode 100644 index 00000000..777c577e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnection.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_deleteprivateconnection_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.DeletePrivateConnectionRequest; +import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; + +public class SyncDeletePrivateConnection { + + public static void main(String[] args) throws Exception { + syncDeletePrivateConnection(); + } + + public static void syncDeletePrivateConnection() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeletePrivateConnectionRequest request = + DeletePrivateConnectionRequest.newBuilder() + .setName( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setRequestId("requestId693933066") + .setForce(true) + .build(); + datastreamClient.deletePrivateConnectionAsync(request).get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_deleteprivateconnection_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionPrivateconnectionname.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionPrivateconnectionname.java new file mode 100644 index 00000000..e913623f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionPrivateconnectionname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START +// datastream_v1alpha1_generated_datastreamclient_deleteprivateconnection_privateconnectionname_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; + +public class SyncDeletePrivateConnectionPrivateconnectionname { + + public static void main(String[] args) throws Exception { + syncDeletePrivateConnectionPrivateconnectionname(); + } + + public static void syncDeletePrivateConnectionPrivateconnectionname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + PrivateConnectionName name = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + datastreamClient.deletePrivateConnectionAsync(name).get(); + } + } +} +// [END +// datastream_v1alpha1_generated_datastreamclient_deleteprivateconnection_privateconnectionname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionString.java new file mode 100644 index 00000000..b2e0d571 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_deleteprivateconnection_string_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; + +public class SyncDeletePrivateConnectionString { + + public static void main(String[] args) throws Exception { + syncDeletePrivateConnectionString(); + } + + public static void syncDeletePrivateConnectionString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String name = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]").toString(); + datastreamClient.deletePrivateConnectionAsync(name).get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_deleteprivateconnection_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/AsyncDeleteRoute.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/AsyncDeleteRoute.java new file mode 100644 index 00000000..eb0c7836 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/AsyncDeleteRoute.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_deleteroute_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.DeleteRouteRequest; +import com.google.cloud.datastream.v1alpha1.RouteName; +import com.google.longrunning.Operation; + +public class AsyncDeleteRoute { + + public static void main(String[] args) throws Exception { + asyncDeleteRoute(); + } + + public static void asyncDeleteRoute() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeleteRouteRequest request = + DeleteRouteRequest.newBuilder() + .setName( + RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]") + .toString()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = datastreamClient.deleteRouteCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_deleteroute_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/AsyncDeleteRouteLRO.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/AsyncDeleteRouteLRO.java new file mode 100644 index 00000000..8d2e9955 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/AsyncDeleteRouteLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_deleteroute_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.DeleteRouteRequest; +import com.google.cloud.datastream.v1alpha1.OperationMetadata; +import com.google.cloud.datastream.v1alpha1.RouteName; +import com.google.protobuf.Empty; + +public class AsyncDeleteRouteLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteRouteLRO(); + } + + public static void asyncDeleteRouteLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeleteRouteRequest request = + DeleteRouteRequest.newBuilder() + .setName( + RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]") + .toString()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + datastreamClient.deleteRouteOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_deleteroute_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRoute.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRoute.java new file mode 100644 index 00000000..eb15f13e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRoute.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_deleteroute_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.DeleteRouteRequest; +import com.google.cloud.datastream.v1alpha1.RouteName; + +public class SyncDeleteRoute { + + public static void main(String[] args) throws Exception { + syncDeleteRoute(); + } + + public static void syncDeleteRoute() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeleteRouteRequest request = + DeleteRouteRequest.newBuilder() + .setName( + RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]") + .toString()) + .setRequestId("requestId693933066") + .build(); + datastreamClient.deleteRouteAsync(request).get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_deleteroute_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRouteRoutename.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRouteRoutename.java new file mode 100644 index 00000000..008a0673 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRouteRoutename.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_deleteroute_routename_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.RouteName; + +public class SyncDeleteRouteRoutename { + + public static void main(String[] args) throws Exception { + syncDeleteRouteRoutename(); + } + + public static void syncDeleteRouteRoutename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + RouteName name = RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]"); + datastreamClient.deleteRouteAsync(name).get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_deleteroute_routename_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRouteString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRouteString.java new file mode 100644 index 00000000..2c0237dd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRouteString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_deleteroute_string_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.RouteName; + +public class SyncDeleteRouteString { + + public static void main(String[] args) throws Exception { + syncDeleteRouteString(); + } + + public static void syncDeleteRouteString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String name = + RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]").toString(); + datastreamClient.deleteRouteAsync(name).get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_deleteroute_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/AsyncDeleteStream.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/AsyncDeleteStream.java new file mode 100644 index 00000000..9ee548c6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/AsyncDeleteStream.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_deletestream_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.DeleteStreamRequest; +import com.google.cloud.datastream.v1alpha1.StreamName; +import com.google.longrunning.Operation; + +public class AsyncDeleteStream { + + public static void main(String[] args) throws Exception { + asyncDeleteStream(); + } + + public static void asyncDeleteStream() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeleteStreamRequest request = + DeleteStreamRequest.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = datastreamClient.deleteStreamCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_deletestream_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/AsyncDeleteStreamLRO.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/AsyncDeleteStreamLRO.java new file mode 100644 index 00000000..3f821411 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/AsyncDeleteStreamLRO.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_deletestream_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.DeleteStreamRequest; +import com.google.cloud.datastream.v1alpha1.OperationMetadata; +import com.google.cloud.datastream.v1alpha1.StreamName; +import com.google.protobuf.Empty; + +public class AsyncDeleteStreamLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteStreamLRO(); + } + + public static void asyncDeleteStreamLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeleteStreamRequest request = + DeleteStreamRequest.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + datastreamClient.deleteStreamOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_deletestream_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStream.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStream.java new file mode 100644 index 00000000..0a113f3f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStream.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_deletestream_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.DeleteStreamRequest; +import com.google.cloud.datastream.v1alpha1.StreamName; + +public class SyncDeleteStream { + + public static void main(String[] args) throws Exception { + syncDeleteStream(); + } + + public static void syncDeleteStream() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DeleteStreamRequest request = + DeleteStreamRequest.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .setRequestId("requestId693933066") + .build(); + datastreamClient.deleteStreamAsync(request).get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_deletestream_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStreamStreamname.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStreamStreamname.java new file mode 100644 index 00000000..4793ce72 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStreamStreamname.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_deletestream_streamname_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.StreamName; + +public class SyncDeleteStreamStreamname { + + public static void main(String[] args) throws Exception { + syncDeleteStreamStreamname(); + } + + public static void syncDeleteStreamStreamname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + StreamName name = StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]"); + datastreamClient.deleteStreamAsync(name).get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_deletestream_streamname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStreamString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStreamString.java new file mode 100644 index 00000000..c3a15b3c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStreamString.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_deletestream_string_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.StreamName; + +public class SyncDeleteStreamString { + + public static void main(String[] args) throws Exception { + syncDeleteStreamString(); + } + + public static void syncDeleteStreamString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String name = StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString(); + datastreamClient.deleteStreamAsync(name).get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_deletestream_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/discoverconnectionprofile/AsyncDiscoverConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/discoverconnectionprofile/AsyncDiscoverConnectionProfile.java new file mode 100644 index 00000000..512417df --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/discoverconnectionprofile/AsyncDiscoverConnectionProfile.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_discoverconnectionprofile_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileRequest; +import com.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileResponse; +import com.google.cloud.datastream.v1alpha1.LocationName; + +public class AsyncDiscoverConnectionProfile { + + public static void main(String[] args) throws Exception { + asyncDiscoverConnectionProfile(); + } + + public static void asyncDiscoverConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DiscoverConnectionProfileRequest request = + DiscoverConnectionProfileRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + datastreamClient.discoverConnectionProfileCallable().futureCall(request); + // Do something. + DiscoverConnectionProfileResponse response = future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_discoverconnectionprofile_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/discoverconnectionprofile/SyncDiscoverConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/discoverconnectionprofile/SyncDiscoverConnectionProfile.java new file mode 100644 index 00000000..94125893 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/discoverconnectionprofile/SyncDiscoverConnectionProfile.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_discoverconnectionprofile_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileRequest; +import com.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileResponse; +import com.google.cloud.datastream.v1alpha1.LocationName; + +public class SyncDiscoverConnectionProfile { + + public static void main(String[] args) throws Exception { + syncDiscoverConnectionProfile(); + } + + public static void syncDiscoverConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + DiscoverConnectionProfileRequest request = + DiscoverConnectionProfileRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + DiscoverConnectionProfileResponse response = + datastreamClient.discoverConnectionProfile(request); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_discoverconnectionprofile_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetcherrors/AsyncFetchErrors.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetcherrors/AsyncFetchErrors.java new file mode 100644 index 00000000..5db14c50 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetcherrors/AsyncFetchErrors.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_fetcherrors_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.FetchErrorsRequest; +import com.google.cloud.datastream.v1alpha1.StreamName; +import com.google.longrunning.Operation; + +public class AsyncFetchErrors { + + public static void main(String[] args) throws Exception { + asyncFetchErrors(); + } + + public static void asyncFetchErrors() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + FetchErrorsRequest request = + FetchErrorsRequest.newBuilder() + .setStream(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .build(); + ApiFuture future = datastreamClient.fetchErrorsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_fetcherrors_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetcherrors/AsyncFetchErrorsLRO.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetcherrors/AsyncFetchErrorsLRO.java new file mode 100644 index 00000000..a072d0f1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetcherrors/AsyncFetchErrorsLRO.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_fetcherrors_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.FetchErrorsRequest; +import com.google.cloud.datastream.v1alpha1.FetchErrorsResponse; +import com.google.cloud.datastream.v1alpha1.OperationMetadata; +import com.google.cloud.datastream.v1alpha1.StreamName; + +public class AsyncFetchErrorsLRO { + + public static void main(String[] args) throws Exception { + asyncFetchErrorsLRO(); + } + + public static void asyncFetchErrorsLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + FetchErrorsRequest request = + FetchErrorsRequest.newBuilder() + .setStream(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .build(); + OperationFuture future = + datastreamClient.fetchErrorsOperationCallable().futureCall(request); + // Do something. + FetchErrorsResponse response = future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_fetcherrors_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetcherrors/SyncFetchErrors.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetcherrors/SyncFetchErrors.java new file mode 100644 index 00000000..b857ec59 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetcherrors/SyncFetchErrors.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_fetcherrors_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.FetchErrorsRequest; +import com.google.cloud.datastream.v1alpha1.FetchErrorsResponse; +import com.google.cloud.datastream.v1alpha1.StreamName; + +public class SyncFetchErrors { + + public static void main(String[] args) throws Exception { + syncFetchErrors(); + } + + public static void syncFetchErrors() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + FetchErrorsRequest request = + FetchErrorsRequest.newBuilder() + .setStream(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .build(); + FetchErrorsResponse response = datastreamClient.fetchErrorsAsync(request).get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_fetcherrors_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetchstaticips/AsyncFetchStaticIps.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetchstaticips/AsyncFetchStaticIps.java new file mode 100644 index 00000000..102c7dc0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetchstaticips/AsyncFetchStaticIps.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_fetchstaticips_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest; +import com.google.cloud.datastream.v1alpha1.LocationName; + +public class AsyncFetchStaticIps { + + public static void main(String[] args) throws Exception { + asyncFetchStaticIps(); + } + + public static void asyncFetchStaticIps() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + FetchStaticIpsRequest request = + FetchStaticIpsRequest.newBuilder() + .setName(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = datastreamClient.fetchStaticIpsPagedCallable().futureCall(request); + // Do something. + for (String element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_fetchstaticips_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetchstaticips/AsyncFetchStaticIpsPaged.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetchstaticips/AsyncFetchStaticIpsPaged.java new file mode 100644 index 00000000..987e3df1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetchstaticips/AsyncFetchStaticIpsPaged.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_fetchstaticips_paged_async] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest; +import com.google.cloud.datastream.v1alpha1.FetchStaticIpsResponse; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.common.base.Strings; + +public class AsyncFetchStaticIpsPaged { + + public static void main(String[] args) throws Exception { + asyncFetchStaticIpsPaged(); + } + + public static void asyncFetchStaticIpsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + FetchStaticIpsRequest request = + FetchStaticIpsRequest.newBuilder() + .setName(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + FetchStaticIpsResponse response = datastreamClient.fetchStaticIpsCallable().call(request); + for (String element : response.getStaticIpsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_fetchstaticips_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetchstaticips/SyncFetchStaticIps.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetchstaticips/SyncFetchStaticIps.java new file mode 100644 index 00000000..c6c548d4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetchstaticips/SyncFetchStaticIps.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_fetchstaticips_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest; +import com.google.cloud.datastream.v1alpha1.LocationName; + +public class SyncFetchStaticIps { + + public static void main(String[] args) throws Exception { + syncFetchStaticIps(); + } + + public static void syncFetchStaticIps() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + FetchStaticIpsRequest request = + FetchStaticIpsRequest.newBuilder() + .setName(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (String element : datastreamClient.fetchStaticIps(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_fetchstaticips_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetchstaticips/SyncFetchStaticIpsLocationname.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetchstaticips/SyncFetchStaticIpsLocationname.java new file mode 100644 index 00000000..40bd3c3c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetchstaticips/SyncFetchStaticIpsLocationname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_fetchstaticips_locationname_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; + +public class SyncFetchStaticIpsLocationname { + + public static void main(String[] args) throws Exception { + syncFetchStaticIpsLocationname(); + } + + public static void syncFetchStaticIpsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + LocationName name = LocationName.of("[PROJECT]", "[LOCATION]"); + for (String element : datastreamClient.fetchStaticIps(name).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_fetchstaticips_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetchstaticips/SyncFetchStaticIpsString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetchstaticips/SyncFetchStaticIpsString.java new file mode 100644 index 00000000..3cd71199 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/fetchstaticips/SyncFetchStaticIpsString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_fetchstaticips_string_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; + +public class SyncFetchStaticIpsString { + + public static void main(String[] args) throws Exception { + syncFetchStaticIpsString(); + } + + public static void syncFetchStaticIpsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String name = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (String element : datastreamClient.fetchStaticIps(name).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_fetchstaticips_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getconnectionprofile/AsyncGetConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getconnectionprofile/AsyncGetConnectionProfile.java new file mode 100644 index 00000000..83d2546e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getconnectionprofile/AsyncGetConnectionProfile.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_getconnectionprofile_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1alpha1.ConnectionProfile; +import com.google.cloud.datastream.v1alpha1.ConnectionProfileName; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.GetConnectionProfileRequest; + +public class AsyncGetConnectionProfile { + + public static void main(String[] args) throws Exception { + asyncGetConnectionProfile(); + } + + public static void asyncGetConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + GetConnectionProfileRequest request = + GetConnectionProfileRequest.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .build(); + ApiFuture future = + datastreamClient.getConnectionProfileCallable().futureCall(request); + // Do something. + ConnectionProfile response = future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_getconnectionprofile_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getconnectionprofile/SyncGetConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getconnectionprofile/SyncGetConnectionProfile.java new file mode 100644 index 00000000..55ecdc49 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getconnectionprofile/SyncGetConnectionProfile.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_getconnectionprofile_sync] +import com.google.cloud.datastream.v1alpha1.ConnectionProfile; +import com.google.cloud.datastream.v1alpha1.ConnectionProfileName; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.GetConnectionProfileRequest; + +public class SyncGetConnectionProfile { + + public static void main(String[] args) throws Exception { + syncGetConnectionProfile(); + } + + public static void syncGetConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + GetConnectionProfileRequest request = + GetConnectionProfileRequest.newBuilder() + .setName( + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") + .toString()) + .build(); + ConnectionProfile response = datastreamClient.getConnectionProfile(request); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_getconnectionprofile_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getconnectionprofile/SyncGetConnectionProfileConnectionprofilename.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getconnectionprofile/SyncGetConnectionProfileConnectionprofilename.java new file mode 100644 index 00000000..030da00a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getconnectionprofile/SyncGetConnectionProfileConnectionprofilename.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START +// datastream_v1alpha1_generated_datastreamclient_getconnectionprofile_connectionprofilename_sync] +import com.google.cloud.datastream.v1alpha1.ConnectionProfile; +import com.google.cloud.datastream.v1alpha1.ConnectionProfileName; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; + +public class SyncGetConnectionProfileConnectionprofilename { + + public static void main(String[] args) throws Exception { + syncGetConnectionProfileConnectionprofilename(); + } + + public static void syncGetConnectionProfileConnectionprofilename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ConnectionProfileName name = + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]"); + ConnectionProfile response = datastreamClient.getConnectionProfile(name); + } + } +} +// [END +// datastream_v1alpha1_generated_datastreamclient_getconnectionprofile_connectionprofilename_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getconnectionprofile/SyncGetConnectionProfileString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getconnectionprofile/SyncGetConnectionProfileString.java new file mode 100644 index 00000000..53d0981a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getconnectionprofile/SyncGetConnectionProfileString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_getconnectionprofile_string_sync] +import com.google.cloud.datastream.v1alpha1.ConnectionProfile; +import com.google.cloud.datastream.v1alpha1.ConnectionProfileName; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; + +public class SyncGetConnectionProfileString { + + public static void main(String[] args) throws Exception { + syncGetConnectionProfileString(); + } + + public static void syncGetConnectionProfileString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String name = + ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]").toString(); + ConnectionProfile response = datastreamClient.getConnectionProfile(name); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_getconnectionprofile_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getprivateconnection/AsyncGetPrivateConnection.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getprivateconnection/AsyncGetPrivateConnection.java new file mode 100644 index 00000000..e676f393 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getprivateconnection/AsyncGetPrivateConnection.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_getprivateconnection_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.GetPrivateConnectionRequest; +import com.google.cloud.datastream.v1alpha1.PrivateConnection; +import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; + +public class AsyncGetPrivateConnection { + + public static void main(String[] args) throws Exception { + asyncGetPrivateConnection(); + } + + public static void asyncGetPrivateConnection() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + GetPrivateConnectionRequest request = + GetPrivateConnectionRequest.newBuilder() + .setName( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .build(); + ApiFuture future = + datastreamClient.getPrivateConnectionCallable().futureCall(request); + // Do something. + PrivateConnection response = future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_getprivateconnection_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getprivateconnection/SyncGetPrivateConnection.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getprivateconnection/SyncGetPrivateConnection.java new file mode 100644 index 00000000..517d136c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getprivateconnection/SyncGetPrivateConnection.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_getprivateconnection_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.GetPrivateConnectionRequest; +import com.google.cloud.datastream.v1alpha1.PrivateConnection; +import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; + +public class SyncGetPrivateConnection { + + public static void main(String[] args) throws Exception { + syncGetPrivateConnection(); + } + + public static void syncGetPrivateConnection() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + GetPrivateConnectionRequest request = + GetPrivateConnectionRequest.newBuilder() + .setName( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .build(); + PrivateConnection response = datastreamClient.getPrivateConnection(request); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_getprivateconnection_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getprivateconnection/SyncGetPrivateConnectionPrivateconnectionname.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getprivateconnection/SyncGetPrivateConnectionPrivateconnectionname.java new file mode 100644 index 00000000..664c7cab --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getprivateconnection/SyncGetPrivateConnectionPrivateconnectionname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START +// datastream_v1alpha1_generated_datastreamclient_getprivateconnection_privateconnectionname_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.PrivateConnection; +import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; + +public class SyncGetPrivateConnectionPrivateconnectionname { + + public static void main(String[] args) throws Exception { + syncGetPrivateConnectionPrivateconnectionname(); + } + + public static void syncGetPrivateConnectionPrivateconnectionname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + PrivateConnectionName name = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + PrivateConnection response = datastreamClient.getPrivateConnection(name); + } + } +} +// [END +// datastream_v1alpha1_generated_datastreamclient_getprivateconnection_privateconnectionname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getprivateconnection/SyncGetPrivateConnectionString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getprivateconnection/SyncGetPrivateConnectionString.java new file mode 100644 index 00000000..3c5dc0fa --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getprivateconnection/SyncGetPrivateConnectionString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_getprivateconnection_string_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.PrivateConnection; +import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; + +public class SyncGetPrivateConnectionString { + + public static void main(String[] args) throws Exception { + syncGetPrivateConnectionString(); + } + + public static void syncGetPrivateConnectionString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String name = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]").toString(); + PrivateConnection response = datastreamClient.getPrivateConnection(name); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_getprivateconnection_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getroute/AsyncGetRoute.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getroute/AsyncGetRoute.java new file mode 100644 index 00000000..8c4be667 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getroute/AsyncGetRoute.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_getroute_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.GetRouteRequest; +import com.google.cloud.datastream.v1alpha1.Route; +import com.google.cloud.datastream.v1alpha1.RouteName; + +public class AsyncGetRoute { + + public static void main(String[] args) throws Exception { + asyncGetRoute(); + } + + public static void asyncGetRoute() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + GetRouteRequest request = + GetRouteRequest.newBuilder() + .setName( + RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]") + .toString()) + .build(); + ApiFuture future = datastreamClient.getRouteCallable().futureCall(request); + // Do something. + Route response = future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_getroute_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getroute/SyncGetRoute.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getroute/SyncGetRoute.java new file mode 100644 index 00000000..33a59dad --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getroute/SyncGetRoute.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_getroute_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.GetRouteRequest; +import com.google.cloud.datastream.v1alpha1.Route; +import com.google.cloud.datastream.v1alpha1.RouteName; + +public class SyncGetRoute { + + public static void main(String[] args) throws Exception { + syncGetRoute(); + } + + public static void syncGetRoute() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + GetRouteRequest request = + GetRouteRequest.newBuilder() + .setName( + RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]") + .toString()) + .build(); + Route response = datastreamClient.getRoute(request); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_getroute_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getroute/SyncGetRouteRoutename.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getroute/SyncGetRouteRoutename.java new file mode 100644 index 00000000..4262e81c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getroute/SyncGetRouteRoutename.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_getroute_routename_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.Route; +import com.google.cloud.datastream.v1alpha1.RouteName; + +public class SyncGetRouteRoutename { + + public static void main(String[] args) throws Exception { + syncGetRouteRoutename(); + } + + public static void syncGetRouteRoutename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + RouteName name = RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]"); + Route response = datastreamClient.getRoute(name); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_getroute_routename_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getroute/SyncGetRouteString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getroute/SyncGetRouteString.java new file mode 100644 index 00000000..78329ed0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getroute/SyncGetRouteString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_getroute_string_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.Route; +import com.google.cloud.datastream.v1alpha1.RouteName; + +public class SyncGetRouteString { + + public static void main(String[] args) throws Exception { + syncGetRouteString(); + } + + public static void syncGetRouteString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String name = + RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]").toString(); + Route response = datastreamClient.getRoute(name); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_getroute_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getstream/AsyncGetStream.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getstream/AsyncGetStream.java new file mode 100644 index 00000000..6fe89312 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getstream/AsyncGetStream.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_getstream_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.GetStreamRequest; +import com.google.cloud.datastream.v1alpha1.Stream; +import com.google.cloud.datastream.v1alpha1.StreamName; + +public class AsyncGetStream { + + public static void main(String[] args) throws Exception { + asyncGetStream(); + } + + public static void asyncGetStream() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + GetStreamRequest request = + GetStreamRequest.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .build(); + ApiFuture future = datastreamClient.getStreamCallable().futureCall(request); + // Do something. + Stream response = future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_getstream_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getstream/SyncGetStream.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getstream/SyncGetStream.java new file mode 100644 index 00000000..d1f9b4c1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getstream/SyncGetStream.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_getstream_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.GetStreamRequest; +import com.google.cloud.datastream.v1alpha1.Stream; +import com.google.cloud.datastream.v1alpha1.StreamName; + +public class SyncGetStream { + + public static void main(String[] args) throws Exception { + syncGetStream(); + } + + public static void syncGetStream() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + GetStreamRequest request = + GetStreamRequest.newBuilder() + .setName(StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString()) + .build(); + Stream response = datastreamClient.getStream(request); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_getstream_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getstream/SyncGetStreamStreamname.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getstream/SyncGetStreamStreamname.java new file mode 100644 index 00000000..e7892230 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getstream/SyncGetStreamStreamname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_getstream_streamname_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.Stream; +import com.google.cloud.datastream.v1alpha1.StreamName; + +public class SyncGetStreamStreamname { + + public static void main(String[] args) throws Exception { + syncGetStreamStreamname(); + } + + public static void syncGetStreamStreamname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + StreamName name = StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]"); + Stream response = datastreamClient.getStream(name); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_getstream_streamname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getstream/SyncGetStreamString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getstream/SyncGetStreamString.java new file mode 100644 index 00000000..b57272a0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getstream/SyncGetStreamString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_getstream_string_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.Stream; +import com.google.cloud.datastream.v1alpha1.StreamName; + +public class SyncGetStreamString { + + public static void main(String[] args) throws Exception { + syncGetStreamString(); + } + + public static void syncGetStreamString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String name = StreamName.of("[PROJECT]", "[LOCATION]", "[STREAM]").toString(); + Stream response = datastreamClient.getStream(name); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_getstream_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listconnectionprofiles/AsyncListConnectionProfiles.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listconnectionprofiles/AsyncListConnectionProfiles.java new file mode 100644 index 00000000..c518319f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listconnectionprofiles/AsyncListConnectionProfiles.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_listconnectionprofiles_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1alpha1.ConnectionProfile; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest; +import com.google.cloud.datastream.v1alpha1.LocationName; + +public class AsyncListConnectionProfiles { + + public static void main(String[] args) throws Exception { + asyncListConnectionProfiles(); + } + + public static void asyncListConnectionProfiles() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListConnectionProfilesRequest request = + ListConnectionProfilesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + datastreamClient.listConnectionProfilesPagedCallable().futureCall(request); + // Do something. + for (ConnectionProfile element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_listconnectionprofiles_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listconnectionprofiles/AsyncListConnectionProfilesPaged.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listconnectionprofiles/AsyncListConnectionProfilesPaged.java new file mode 100644 index 00000000..a5b205e7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listconnectionprofiles/AsyncListConnectionProfilesPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_listconnectionprofiles_paged_async] +import com.google.cloud.datastream.v1alpha1.ConnectionProfile; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest; +import com.google.cloud.datastream.v1alpha1.ListConnectionProfilesResponse; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.common.base.Strings; + +public class AsyncListConnectionProfilesPaged { + + public static void main(String[] args) throws Exception { + asyncListConnectionProfilesPaged(); + } + + public static void asyncListConnectionProfilesPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListConnectionProfilesRequest request = + ListConnectionProfilesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListConnectionProfilesResponse response = + datastreamClient.listConnectionProfilesCallable().call(request); + for (ConnectionProfile element : response.getConnectionProfilesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_listconnectionprofiles_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listconnectionprofiles/SyncListConnectionProfiles.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listconnectionprofiles/SyncListConnectionProfiles.java new file mode 100644 index 00000000..b09d38ff --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listconnectionprofiles/SyncListConnectionProfiles.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_listconnectionprofiles_sync] +import com.google.cloud.datastream.v1alpha1.ConnectionProfile; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest; +import com.google.cloud.datastream.v1alpha1.LocationName; + +public class SyncListConnectionProfiles { + + public static void main(String[] args) throws Exception { + syncListConnectionProfiles(); + } + + public static void syncListConnectionProfiles() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListConnectionProfilesRequest request = + ListConnectionProfilesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (ConnectionProfile element : + datastreamClient.listConnectionProfiles(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_listconnectionprofiles_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listconnectionprofiles/SyncListConnectionProfilesLocationname.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listconnectionprofiles/SyncListConnectionProfilesLocationname.java new file mode 100644 index 00000000..e239e6d7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listconnectionprofiles/SyncListConnectionProfilesLocationname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_listconnectionprofiles_locationname_sync] +import com.google.cloud.datastream.v1alpha1.ConnectionProfile; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; + +public class SyncListConnectionProfilesLocationname { + + public static void main(String[] args) throws Exception { + syncListConnectionProfilesLocationname(); + } + + public static void syncListConnectionProfilesLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (ConnectionProfile element : + datastreamClient.listConnectionProfiles(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_listconnectionprofiles_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listconnectionprofiles/SyncListConnectionProfilesString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listconnectionprofiles/SyncListConnectionProfilesString.java new file mode 100644 index 00000000..8ff8cdd1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listconnectionprofiles/SyncListConnectionProfilesString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_listconnectionprofiles_string_sync] +import com.google.cloud.datastream.v1alpha1.ConnectionProfile; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; + +public class SyncListConnectionProfilesString { + + public static void main(String[] args) throws Exception { + syncListConnectionProfilesString(); + } + + public static void syncListConnectionProfilesString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (ConnectionProfile element : + datastreamClient.listConnectionProfiles(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_listconnectionprofiles_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listprivateconnections/AsyncListPrivateConnections.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listprivateconnections/AsyncListPrivateConnections.java new file mode 100644 index 00000000..fbb140c3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listprivateconnections/AsyncListPrivateConnections.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_listprivateconnections_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.cloud.datastream.v1alpha1.PrivateConnection; + +public class AsyncListPrivateConnections { + + public static void main(String[] args) throws Exception { + asyncListPrivateConnections(); + } + + public static void asyncListPrivateConnections() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListPrivateConnectionsRequest request = + ListPrivateConnectionsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + datastreamClient.listPrivateConnectionsPagedCallable().futureCall(request); + // Do something. + for (PrivateConnection element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_listprivateconnections_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listprivateconnections/AsyncListPrivateConnectionsPaged.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listprivateconnections/AsyncListPrivateConnectionsPaged.java new file mode 100644 index 00000000..2aa1535b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listprivateconnections/AsyncListPrivateConnectionsPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_listprivateconnections_paged_async] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest; +import com.google.cloud.datastream.v1alpha1.ListPrivateConnectionsResponse; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.cloud.datastream.v1alpha1.PrivateConnection; +import com.google.common.base.Strings; + +public class AsyncListPrivateConnectionsPaged { + + public static void main(String[] args) throws Exception { + asyncListPrivateConnectionsPaged(); + } + + public static void asyncListPrivateConnectionsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListPrivateConnectionsRequest request = + ListPrivateConnectionsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListPrivateConnectionsResponse response = + datastreamClient.listPrivateConnectionsCallable().call(request); + for (PrivateConnection element : response.getPrivateConnectionsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_listprivateconnections_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listprivateconnections/SyncListPrivateConnections.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listprivateconnections/SyncListPrivateConnections.java new file mode 100644 index 00000000..28591e76 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listprivateconnections/SyncListPrivateConnections.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_listprivateconnections_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.cloud.datastream.v1alpha1.PrivateConnection; + +public class SyncListPrivateConnections { + + public static void main(String[] args) throws Exception { + syncListPrivateConnections(); + } + + public static void syncListPrivateConnections() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListPrivateConnectionsRequest request = + ListPrivateConnectionsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (PrivateConnection element : + datastreamClient.listPrivateConnections(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_listprivateconnections_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listprivateconnections/SyncListPrivateConnectionsLocationname.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listprivateconnections/SyncListPrivateConnectionsLocationname.java new file mode 100644 index 00000000..557830f5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listprivateconnections/SyncListPrivateConnectionsLocationname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_listprivateconnections_locationname_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.cloud.datastream.v1alpha1.PrivateConnection; + +public class SyncListPrivateConnectionsLocationname { + + public static void main(String[] args) throws Exception { + syncListPrivateConnectionsLocationname(); + } + + public static void syncListPrivateConnectionsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (PrivateConnection element : + datastreamClient.listPrivateConnections(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_listprivateconnections_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listprivateconnections/SyncListPrivateConnectionsString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listprivateconnections/SyncListPrivateConnectionsString.java new file mode 100644 index 00000000..57ef891f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listprivateconnections/SyncListPrivateConnectionsString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_listprivateconnections_string_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.cloud.datastream.v1alpha1.PrivateConnection; + +public class SyncListPrivateConnectionsString { + + public static void main(String[] args) throws Exception { + syncListPrivateConnectionsString(); + } + + public static void syncListPrivateConnectionsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (PrivateConnection element : + datastreamClient.listPrivateConnections(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_listprivateconnections_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listroutes/AsyncListRoutes.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listroutes/AsyncListRoutes.java new file mode 100644 index 00000000..588a1d0f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listroutes/AsyncListRoutes.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_listroutes_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.ListRoutesRequest; +import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; +import com.google.cloud.datastream.v1alpha1.Route; + +public class AsyncListRoutes { + + public static void main(String[] args) throws Exception { + asyncListRoutes(); + } + + public static void asyncListRoutes() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListRoutesRequest request = + ListRoutesRequest.newBuilder() + .setParent( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = datastreamClient.listRoutesPagedCallable().futureCall(request); + // Do something. + for (Route element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_listroutes_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listroutes/AsyncListRoutesPaged.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listroutes/AsyncListRoutesPaged.java new file mode 100644 index 00000000..b33b990f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listroutes/AsyncListRoutesPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_listroutes_paged_async] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.ListRoutesRequest; +import com.google.cloud.datastream.v1alpha1.ListRoutesResponse; +import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; +import com.google.cloud.datastream.v1alpha1.Route; +import com.google.common.base.Strings; + +public class AsyncListRoutesPaged { + + public static void main(String[] args) throws Exception { + asyncListRoutesPaged(); + } + + public static void asyncListRoutesPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListRoutesRequest request = + ListRoutesRequest.newBuilder() + .setParent( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListRoutesResponse response = datastreamClient.listRoutesCallable().call(request); + for (Route element : response.getRoutesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_listroutes_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listroutes/SyncListRoutes.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listroutes/SyncListRoutes.java new file mode 100644 index 00000000..0fd289cf --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listroutes/SyncListRoutes.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_listroutes_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.ListRoutesRequest; +import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; +import com.google.cloud.datastream.v1alpha1.Route; + +public class SyncListRoutes { + + public static void main(String[] args) throws Exception { + syncListRoutes(); + } + + public static void syncListRoutes() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListRoutesRequest request = + ListRoutesRequest.newBuilder() + .setParent( + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (Route element : datastreamClient.listRoutes(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_listroutes_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listroutes/SyncListRoutesPrivateconnectionname.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listroutes/SyncListRoutesPrivateconnectionname.java new file mode 100644 index 00000000..c43e408b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listroutes/SyncListRoutesPrivateconnectionname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_listroutes_privateconnectionname_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; +import com.google.cloud.datastream.v1alpha1.Route; + +public class SyncListRoutesPrivateconnectionname { + + public static void main(String[] args) throws Exception { + syncListRoutesPrivateconnectionname(); + } + + public static void syncListRoutesPrivateconnectionname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + PrivateConnectionName parent = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]"); + for (Route element : datastreamClient.listRoutes(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_listroutes_privateconnectionname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listroutes/SyncListRoutesString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listroutes/SyncListRoutesString.java new file mode 100644 index 00000000..7306f84d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/listroutes/SyncListRoutesString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_listroutes_string_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; +import com.google.cloud.datastream.v1alpha1.Route; + +public class SyncListRoutesString { + + public static void main(String[] args) throws Exception { + syncListRoutesString(); + } + + public static void syncListRoutesString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String parent = + PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]").toString(); + for (Route element : datastreamClient.listRoutes(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_listroutes_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/liststreams/AsyncListStreams.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/liststreams/AsyncListStreams.java new file mode 100644 index 00000000..9fbd60f1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/liststreams/AsyncListStreams.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_liststreams_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.ListStreamsRequest; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.cloud.datastream.v1alpha1.Stream; + +public class AsyncListStreams { + + public static void main(String[] args) throws Exception { + asyncListStreams(); + } + + public static void asyncListStreams() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListStreamsRequest request = + ListStreamsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = datastreamClient.listStreamsPagedCallable().futureCall(request); + // Do something. + for (Stream element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_liststreams_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/liststreams/AsyncListStreamsPaged.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/liststreams/AsyncListStreamsPaged.java new file mode 100644 index 00000000..fd13d3c5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/liststreams/AsyncListStreamsPaged.java @@ -0,0 +1,60 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_liststreams_paged_async] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.ListStreamsRequest; +import com.google.cloud.datastream.v1alpha1.ListStreamsResponse; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.cloud.datastream.v1alpha1.Stream; +import com.google.common.base.Strings; + +public class AsyncListStreamsPaged { + + public static void main(String[] args) throws Exception { + asyncListStreamsPaged(); + } + + public static void asyncListStreamsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListStreamsRequest request = + ListStreamsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListStreamsResponse response = datastreamClient.listStreamsCallable().call(request); + for (Stream element : response.getStreamsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_liststreams_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/liststreams/SyncListStreams.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/liststreams/SyncListStreams.java new file mode 100644 index 00000000..6d95caf3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/liststreams/SyncListStreams.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_liststreams_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.ListStreamsRequest; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.cloud.datastream.v1alpha1.Stream; + +public class SyncListStreams { + + public static void main(String[] args) throws Exception { + syncListStreams(); + } + + public static void syncListStreams() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ListStreamsRequest request = + ListStreamsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (Stream element : datastreamClient.listStreams(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_liststreams_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/liststreams/SyncListStreamsLocationname.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/liststreams/SyncListStreamsLocationname.java new file mode 100644 index 00000000..3c547b48 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/liststreams/SyncListStreamsLocationname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_liststreams_locationname_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.cloud.datastream.v1alpha1.Stream; + +public class SyncListStreamsLocationname { + + public static void main(String[] args) throws Exception { + syncListStreamsLocationname(); + } + + public static void syncListStreamsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Stream element : datastreamClient.listStreams(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_liststreams_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/liststreams/SyncListStreamsString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/liststreams/SyncListStreamsString.java new file mode 100644 index 00000000..273bd71d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/liststreams/SyncListStreamsString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_liststreams_string_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.LocationName; +import com.google.cloud.datastream.v1alpha1.Stream; + +public class SyncListStreamsString { + + public static void main(String[] args) throws Exception { + syncListStreamsString(); + } + + public static void syncListStreamsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Stream element : datastreamClient.listStreams(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_liststreams_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updateconnectionprofile/AsyncUpdateConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updateconnectionprofile/AsyncUpdateConnectionProfile.java new file mode 100644 index 00000000..de42de78 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updateconnectionprofile/AsyncUpdateConnectionProfile.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_updateconnectionprofile_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1alpha1.ConnectionProfile; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.UpdateConnectionProfileRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateConnectionProfile { + + public static void main(String[] args) throws Exception { + asyncUpdateConnectionProfile(); + } + + public static void asyncUpdateConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + UpdateConnectionProfileRequest request = + UpdateConnectionProfileRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setConnectionProfile(ConnectionProfile.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + datastreamClient.updateConnectionProfileCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_updateconnectionprofile_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updateconnectionprofile/AsyncUpdateConnectionProfileLRO.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updateconnectionprofile/AsyncUpdateConnectionProfileLRO.java new file mode 100644 index 00000000..0dfdd204 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updateconnectionprofile/AsyncUpdateConnectionProfileLRO.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_updateconnectionprofile_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.datastream.v1alpha1.ConnectionProfile; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.OperationMetadata; +import com.google.cloud.datastream.v1alpha1.UpdateConnectionProfileRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateConnectionProfileLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateConnectionProfileLRO(); + } + + public static void asyncUpdateConnectionProfileLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + UpdateConnectionProfileRequest request = + UpdateConnectionProfileRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setConnectionProfile(ConnectionProfile.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + datastreamClient.updateConnectionProfileOperationCallable().futureCall(request); + // Do something. + ConnectionProfile response = future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_updateconnectionprofile_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfile.java new file mode 100644 index 00000000..3b0fb0c4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfile.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_updateconnectionprofile_sync] +import com.google.cloud.datastream.v1alpha1.ConnectionProfile; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.UpdateConnectionProfileRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateConnectionProfile { + + public static void main(String[] args) throws Exception { + syncUpdateConnectionProfile(); + } + + public static void syncUpdateConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + UpdateConnectionProfileRequest request = + UpdateConnectionProfileRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setConnectionProfile(ConnectionProfile.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ConnectionProfile response = datastreamClient.updateConnectionProfileAsync(request).get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_updateconnectionprofile_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfileConnectionprofileFieldmask.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfileConnectionprofileFieldmask.java new file mode 100644 index 00000000..c77232f9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfileConnectionprofileFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START +// datastream_v1alpha1_generated_datastreamclient_updateconnectionprofile_connectionprofilefieldmask_sync] +import com.google.cloud.datastream.v1alpha1.ConnectionProfile; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateConnectionProfileConnectionprofileFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateConnectionProfileConnectionprofileFieldmask(); + } + + public static void syncUpdateConnectionProfileConnectionprofileFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + ConnectionProfile connectionProfile = ConnectionProfile.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + ConnectionProfile response = + datastreamClient.updateConnectionProfileAsync(connectionProfile, updateMask).get(); + } + } +} +// [END +// datastream_v1alpha1_generated_datastreamclient_updateconnectionprofile_connectionprofilefieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updatestream/AsyncUpdateStream.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updatestream/AsyncUpdateStream.java new file mode 100644 index 00000000..ff02b15f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updatestream/AsyncUpdateStream.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_updatestream_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.Stream; +import com.google.cloud.datastream.v1alpha1.UpdateStreamRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateStream { + + public static void main(String[] args) throws Exception { + asyncUpdateStream(); + } + + public static void asyncUpdateStream() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + UpdateStreamRequest request = + UpdateStreamRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setStream(Stream.newBuilder().build()) + .setRequestId("requestId693933066") + .setValidateOnly(true) + .setForce(true) + .build(); + ApiFuture future = datastreamClient.updateStreamCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_updatestream_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updatestream/AsyncUpdateStreamLRO.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updatestream/AsyncUpdateStreamLRO.java new file mode 100644 index 00000000..6554853a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updatestream/AsyncUpdateStreamLRO.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_updatestream_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.OperationMetadata; +import com.google.cloud.datastream.v1alpha1.Stream; +import com.google.cloud.datastream.v1alpha1.UpdateStreamRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateStreamLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateStreamLRO(); + } + + public static void asyncUpdateStreamLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + UpdateStreamRequest request = + UpdateStreamRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setStream(Stream.newBuilder().build()) + .setRequestId("requestId693933066") + .setValidateOnly(true) + .setForce(true) + .build(); + OperationFuture future = + datastreamClient.updateStreamOperationCallable().futureCall(request); + // Do something. + Stream response = future.get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_updatestream_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updatestream/SyncUpdateStream.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updatestream/SyncUpdateStream.java new file mode 100644 index 00000000..109b116c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updatestream/SyncUpdateStream.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_updatestream_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.Stream; +import com.google.cloud.datastream.v1alpha1.UpdateStreamRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateStream { + + public static void main(String[] args) throws Exception { + syncUpdateStream(); + } + + public static void syncUpdateStream() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + UpdateStreamRequest request = + UpdateStreamRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setStream(Stream.newBuilder().build()) + .setRequestId("requestId693933066") + .setValidateOnly(true) + .setForce(true) + .build(); + Stream response = datastreamClient.updateStreamAsync(request).get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_updatestream_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updatestream/SyncUpdateStreamStreamFieldmask.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updatestream/SyncUpdateStreamStreamFieldmask.java new file mode 100644 index 00000000..4c5a320d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updatestream/SyncUpdateStreamStreamFieldmask.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamclient_updatestream_streamfieldmask_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.cloud.datastream.v1alpha1.Stream; +import com.google.protobuf.FieldMask; + +public class SyncUpdateStreamStreamFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateStreamStreamFieldmask(); + } + + public static void syncUpdateStreamStreamFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DatastreamClient datastreamClient = DatastreamClient.create()) { + Stream stream = Stream.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Stream response = datastreamClient.updateStreamAsync(stream, updateMask).get(); + } + } +} +// [END datastream_v1alpha1_generated_datastreamclient_updatestream_streamfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamsettings/getconnectionprofile/SyncGetConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamsettings/getconnectionprofile/SyncGetConnectionProfile.java new file mode 100644 index 00000000..023ff532 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamsettings/getconnectionprofile/SyncGetConnectionProfile.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.samples; + +// [START datastream_v1alpha1_generated_datastreamsettings_getconnectionprofile_sync] +import com.google.cloud.datastream.v1alpha1.DatastreamSettings; +import java.time.Duration; + +public class SyncGetConnectionProfile { + + public static void main(String[] args) throws Exception { + syncGetConnectionProfile(); + } + + public static void syncGetConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DatastreamSettings.Builder datastreamSettingsBuilder = DatastreamSettings.newBuilder(); + datastreamSettingsBuilder + .getConnectionProfileSettings() + .setRetrySettings( + datastreamSettingsBuilder + .getConnectionProfileSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + DatastreamSettings datastreamSettings = datastreamSettingsBuilder.build(); + } +} +// [END datastream_v1alpha1_generated_datastreamsettings_getconnectionprofile_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/stub/datastreamstubsettings/getconnectionprofile/SyncGetConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/stub/datastreamstubsettings/getconnectionprofile/SyncGetConnectionProfile.java new file mode 100644 index 00000000..a1ec0dc7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/stub/datastreamstubsettings/getconnectionprofile/SyncGetConnectionProfile.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.datastream.v1alpha1.stub.samples; + +// [START datastream_v1alpha1_generated_datastreamstubsettings_getconnectionprofile_sync] +import com.google.cloud.datastream.v1alpha1.stub.DatastreamStubSettings; +import java.time.Duration; + +public class SyncGetConnectionProfile { + + public static void main(String[] args) throws Exception { + syncGetConnectionProfile(); + } + + public static void syncGetConnectionProfile() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DatastreamStubSettings.Builder datastreamSettingsBuilder = DatastreamStubSettings.newBuilder(); + datastreamSettingsBuilder + .getConnectionProfileSettings() + .setRetrySettings( + datastreamSettingsBuilder + .getConnectionProfileSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + DatastreamStubSettings datastreamSettings = datastreamSettingsBuilder.build(); + } +} +// [END datastream_v1alpha1_generated_datastreamstubsettings_getconnectionprofile_sync] From 6c798b4273f3bd4c27248b5967852f8aa8d8561a Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 27 Jun 2022 19:24:29 +0000 Subject: [PATCH 08/13] chore: update dependencies for regapic (#1467) (#177) * chore: update dependencies for regapic * add more dependencies and trigger comment * update goldens * fix indentation * remove duplicate gax-httpjson dependency * remove duplicated dependencies Source-Link: https://github.com/googleapis/synthtool/commit/fa54eb2a78c6ee48613fd33152e2130e949dcbd9 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:1ec28a46062b19135b11178ceee60231e5f5a92dab454e23ae0aab72cd875906 --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/common.sh | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index a79f0627..f0625e4d 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest - digest: sha256:2567a120ce90fadb6201999b87d649d9f67459de28815ad239bce9ebfaa18a74 -# created: 2022-05-19T15:12:45.278246753Z + digest: sha256:1ec28a46062b19135b11178ceee60231e5f5a92dab454e23ae0aab72cd875906 +# created: 2022-06-27T15:01:06.405564326Z diff --git a/.kokoro/common.sh b/.kokoro/common.sh index ace89f45..f8f957af 100644 --- a/.kokoro/common.sh +++ b/.kokoro/common.sh @@ -55,4 +55,6 @@ function retry_with_backoff { ## Helper functionss function now() { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n'; } function msg() { println "$*" >&2; } -function println() { printf '%s\n' "$(now) $*"; } \ No newline at end of file +function println() { printf '%s\n' "$(now) $*"; } + +## Helper comment to trigger updated repo dependency release \ No newline at end of file From f793baa8cebcbaa48eadd3ac469a4e4f192e90be Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 28 Jun 2022 04:16:29 +0000 Subject: [PATCH 09/13] fix: update gapic-generator-java with mock service generation fixes (#178) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 457524730 Source-Link: https://github.com/googleapis/googleapis/commit/917e7f21cb1dc062744c6694437cdd46219f28cb Source-Link: https://github.com/googleapis/googleapis-gen/commit/2497f9a069d3f6b2d6810d5a4e239cda1e7e5a39 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjQ5N2Y5YTA2OWQzZjZiMmQ2ODEwZDVhNGUyMzljZGExZTdlNWEzOSJ9 --- .../com/google/cloud/datastream/v1/DatastreamClient.java | 2 ++ .../google/cloud/datastream/v1alpha1/DatastreamClient.java | 1 + .../google/cloud/datastream/v1/DatastreamClientTest.java | 1 - .../cloud/{location => datastream/v1}/MockLocations.java | 2 +- .../{location => datastream/v1}/MockLocationsImpl.java | 6 +++++- ...nnectionProfileLocationnameConnectionprofileString.java | 6 ++---- ...eateConnectionProfileStringConnectionprofileString.java | 6 ++---- ...ivateConnectionLocationnamePrivateconnectionString.java | 6 ++---- ...eatePrivateConnectionStringPrivateconnectionString.java | 6 ++---- .../SyncCreateRoutePrivateconnectionnameRouteString.java | 3 +-- .../SyncDeleteConnectionProfile.java | 1 + .../SyncDeleteConnectionProfileConnectionprofilename.java | 4 ++-- .../SyncDeleteConnectionProfileString.java | 1 + .../SyncDeletePrivateConnection.java | 1 + .../SyncDeletePrivateConnectionPrivateconnectionname.java | 4 ++-- .../SyncDeletePrivateConnectionString.java | 1 + .../v1/datastreamclient/deleteroute/SyncDeleteRoute.java | 1 + .../deleteroute/SyncDeleteRouteRoutename.java | 1 + .../deleteroute/SyncDeleteRouteString.java | 1 + .../v1/datastreamclient/deletestream/SyncDeleteStream.java | 1 + .../deletestream/SyncDeleteStreamStreamname.java | 1 + .../deletestream/SyncDeleteStreamString.java | 1 + ...cUpdateConnectionProfileConnectionprofileFieldmask.java | 6 ++---- ...nnectionProfileLocationnameConnectionprofileString.java | 6 ++---- ...eateConnectionProfileStringConnectionprofileString.java | 6 ++---- ...ivateConnectionLocationnamePrivateconnectionString.java | 6 ++---- ...eatePrivateConnectionStringPrivateconnectionString.java | 6 ++---- .../SyncCreateRoutePrivateconnectionnameRouteString.java | 6 ++---- .../SyncDeleteConnectionProfile.java | 1 + .../SyncDeleteConnectionProfileConnectionprofilename.java | 7 +++---- .../SyncDeleteConnectionProfileString.java | 1 + .../SyncDeletePrivateConnection.java | 1 + .../SyncDeletePrivateConnectionPrivateconnectionname.java | 7 +++---- .../SyncDeletePrivateConnectionString.java | 1 + .../datastreamclient/deleteroute/SyncDeleteRoute.java | 1 + .../deleteroute/SyncDeleteRouteRoutename.java | 1 + .../deleteroute/SyncDeleteRouteString.java | 1 + .../datastreamclient/deletestream/SyncDeleteStream.java | 1 + .../deletestream/SyncDeleteStreamStreamname.java | 1 + .../deletestream/SyncDeleteStreamString.java | 1 + .../SyncGetConnectionProfileConnectionprofilename.java | 6 ++---- .../SyncGetPrivateConnectionPrivateconnectionname.java | 6 ++---- ...cUpdateConnectionProfileConnectionprofileFieldmask.java | 6 ++---- 43 files changed, 66 insertions(+), 69 deletions(-) rename google-cloud-datastream/src/test/java/com/google/cloud/{location => datastream/v1}/MockLocations.java (97%) rename google-cloud-datastream/src/test/java/com/google/cloud/{location => datastream/v1}/MockLocationsImpl.java (93%) diff --git a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/DatastreamClient.java b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/DatastreamClient.java index b2ea9b78..d4b891db 100644 --- a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/DatastreamClient.java +++ b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1/DatastreamClient.java @@ -18,6 +18,7 @@ import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.httpjson.longrunning.OperationsClient; import com.google.api.gax.longrunning.OperationFuture; @@ -191,6 +192,7 @@ public final com.google.longrunning.OperationsClient getOperationsClient() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ + @BetaApi public final OperationsClient getHttpJsonOperationsClient() { return httpJsonOperationsClient; } diff --git a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/DatastreamClient.java b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/DatastreamClient.java index ccfa9694..2a9f640b 100644 --- a/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/DatastreamClient.java +++ b/google-cloud-datastream/src/main/java/com/google/cloud/datastream/v1alpha1/DatastreamClient.java @@ -189,6 +189,7 @@ public final com.google.longrunning.OperationsClient getOperationsClient() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ + @BetaApi public final OperationsClient getHttpJsonOperationsClient() { return httpJsonOperationsClient; } diff --git a/google-cloud-datastream/src/test/java/com/google/cloud/datastream/v1/DatastreamClientTest.java b/google-cloud-datastream/src/test/java/com/google/cloud/datastream/v1/DatastreamClientTest.java index c7013ead..aab64675 100644 --- a/google-cloud-datastream/src/test/java/com/google/cloud/datastream/v1/DatastreamClientTest.java +++ b/google-cloud-datastream/src/test/java/com/google/cloud/datastream/v1/DatastreamClientTest.java @@ -36,7 +36,6 @@ import com.google.cloud.location.ListLocationsRequest; import com.google.cloud.location.ListLocationsResponse; import com.google.cloud.location.Location; -import com.google.cloud.location.MockLocations; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.AbstractMessage; diff --git a/google-cloud-datastream/src/test/java/com/google/cloud/location/MockLocations.java b/google-cloud-datastream/src/test/java/com/google/cloud/datastream/v1/MockLocations.java similarity index 97% rename from google-cloud-datastream/src/test/java/com/google/cloud/location/MockLocations.java rename to google-cloud-datastream/src/test/java/com/google/cloud/datastream/v1/MockLocations.java index 8ce43edf..702513f9 100644 --- a/google-cloud-datastream/src/test/java/com/google/cloud/location/MockLocations.java +++ b/google-cloud-datastream/src/test/java/com/google/cloud/datastream/v1/MockLocations.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.cloud.location; +package com.google.cloud.datastream.v1; import com.google.api.core.BetaApi; import com.google.api.gax.grpc.testing.MockGrpcService; diff --git a/google-cloud-datastream/src/test/java/com/google/cloud/location/MockLocationsImpl.java b/google-cloud-datastream/src/test/java/com/google/cloud/datastream/v1/MockLocationsImpl.java similarity index 93% rename from google-cloud-datastream/src/test/java/com/google/cloud/location/MockLocationsImpl.java rename to google-cloud-datastream/src/test/java/com/google/cloud/datastream/v1/MockLocationsImpl.java index d6b51f13..40d2199f 100644 --- a/google-cloud-datastream/src/test/java/com/google/cloud/location/MockLocationsImpl.java +++ b/google-cloud-datastream/src/test/java/com/google/cloud/datastream/v1/MockLocationsImpl.java @@ -14,9 +14,13 @@ * limitations under the License. */ -package com.google.cloud.location; +package com.google.cloud.datastream.v1; import com.google.api.core.BetaApi; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.cloud.location.LocationsGrpc.LocationsImplBase; import com.google.protobuf.AbstractMessage; import io.grpc.stub.StreamObserver; diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileLocationnameConnectionprofileString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileLocationnameConnectionprofileString.java index 0ac05ae8..718c3cea 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileLocationnameConnectionprofileString.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileLocationnameConnectionprofileString.java @@ -16,8 +16,7 @@ package com.google.cloud.datastream.v1.samples; -// [START -// datastream_v1_generated_datastreamclient_createconnectionprofile_locationnameconnectionprofilestring_sync] +// [START datastream_v1_generated_datastreamclient_createconnectionprofile_locationnameconnectionprofilestring_sync] import com.google.cloud.datastream.v1.ConnectionProfile; import com.google.cloud.datastream.v1.DatastreamClient; import com.google.cloud.datastream.v1.LocationName; @@ -43,5 +42,4 @@ public static void syncCreateConnectionProfileLocationnameConnectionprofileStrin } } } -// [END -// datastream_v1_generated_datastreamclient_createconnectionprofile_locationnameconnectionprofilestring_sync] +// [END datastream_v1_generated_datastreamclient_createconnectionprofile_locationnameconnectionprofilestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileStringConnectionprofileString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileStringConnectionprofileString.java index 6a94c620..992856de 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileStringConnectionprofileString.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileStringConnectionprofileString.java @@ -16,8 +16,7 @@ package com.google.cloud.datastream.v1.samples; -// [START -// datastream_v1_generated_datastreamclient_createconnectionprofile_stringconnectionprofilestring_sync] +// [START datastream_v1_generated_datastreamclient_createconnectionprofile_stringconnectionprofilestring_sync] import com.google.cloud.datastream.v1.ConnectionProfile; import com.google.cloud.datastream.v1.DatastreamClient; import com.google.cloud.datastream.v1.LocationName; @@ -42,5 +41,4 @@ public static void syncCreateConnectionProfileStringConnectionprofileString() th } } } -// [END -// datastream_v1_generated_datastreamclient_createconnectionprofile_stringconnectionprofilestring_sync] +// [END datastream_v1_generated_datastreamclient_createconnectionprofile_stringconnectionprofilestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionLocationnamePrivateconnectionString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionLocationnamePrivateconnectionString.java index 746b16b8..9c2d78e1 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionLocationnamePrivateconnectionString.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionLocationnamePrivateconnectionString.java @@ -16,8 +16,7 @@ package com.google.cloud.datastream.v1.samples; -// [START -// datastream_v1_generated_datastreamclient_createprivateconnection_locationnameprivateconnectionstring_sync] +// [START datastream_v1_generated_datastreamclient_createprivateconnection_locationnameprivateconnectionstring_sync] import com.google.cloud.datastream.v1.DatastreamClient; import com.google.cloud.datastream.v1.LocationName; import com.google.cloud.datastream.v1.PrivateConnection; @@ -43,5 +42,4 @@ public static void syncCreatePrivateConnectionLocationnamePrivateconnectionStrin } } } -// [END -// datastream_v1_generated_datastreamclient_createprivateconnection_locationnameprivateconnectionstring_sync] +// [END datastream_v1_generated_datastreamclient_createprivateconnection_locationnameprivateconnectionstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionStringPrivateconnectionString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionStringPrivateconnectionString.java index 328819c6..0c5b58c2 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionStringPrivateconnectionString.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionStringPrivateconnectionString.java @@ -16,8 +16,7 @@ package com.google.cloud.datastream.v1.samples; -// [START -// datastream_v1_generated_datastreamclient_createprivateconnection_stringprivateconnectionstring_sync] +// [START datastream_v1_generated_datastreamclient_createprivateconnection_stringprivateconnectionstring_sync] import com.google.cloud.datastream.v1.DatastreamClient; import com.google.cloud.datastream.v1.LocationName; import com.google.cloud.datastream.v1.PrivateConnection; @@ -42,5 +41,4 @@ public static void syncCreatePrivateConnectionStringPrivateconnectionString() th } } } -// [END -// datastream_v1_generated_datastreamclient_createprivateconnection_stringprivateconnectionstring_sync] +// [END datastream_v1_generated_datastreamclient_createprivateconnection_stringprivateconnectionstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/SyncCreateRoutePrivateconnectionnameRouteString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/SyncCreateRoutePrivateconnectionnameRouteString.java index e11b4ec7..e06a83c1 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/SyncCreateRoutePrivateconnectionnameRouteString.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/createroute/SyncCreateRoutePrivateconnectionnameRouteString.java @@ -16,8 +16,7 @@ package com.google.cloud.datastream.v1.samples; -// [START -// datastream_v1_generated_datastreamclient_createroute_privateconnectionnameroutestring_sync] +// [START datastream_v1_generated_datastreamclient_createroute_privateconnectionnameroutestring_sync] import com.google.cloud.datastream.v1.DatastreamClient; import com.google.cloud.datastream.v1.PrivateConnectionName; import com.google.cloud.datastream.v1.Route; diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfile.java index 210bb5f4..e1f2d5e4 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfile.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfile.java @@ -20,6 +20,7 @@ import com.google.cloud.datastream.v1.ConnectionProfileName; import com.google.cloud.datastream.v1.DatastreamClient; import com.google.cloud.datastream.v1.DeleteConnectionProfileRequest; +import com.google.protobuf.Empty; public class SyncDeleteConnectionProfile { diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileConnectionprofilename.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileConnectionprofilename.java index db92d4a4..354e50da 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileConnectionprofilename.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileConnectionprofilename.java @@ -16,10 +16,10 @@ package com.google.cloud.datastream.v1.samples; -// [START -// datastream_v1_generated_datastreamclient_deleteconnectionprofile_connectionprofilename_sync] +// [START datastream_v1_generated_datastreamclient_deleteconnectionprofile_connectionprofilename_sync] import com.google.cloud.datastream.v1.ConnectionProfileName; import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.protobuf.Empty; public class SyncDeleteConnectionProfileConnectionprofilename { diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileString.java index 08d48415..ba47274e 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileString.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileString.java @@ -19,6 +19,7 @@ // [START datastream_v1_generated_datastreamclient_deleteconnectionprofile_string_sync] import com.google.cloud.datastream.v1.ConnectionProfileName; import com.google.cloud.datastream.v1.DatastreamClient; +import com.google.protobuf.Empty; public class SyncDeleteConnectionProfileString { diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnection.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnection.java index 73cbde96..e396b343 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnection.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnection.java @@ -20,6 +20,7 @@ import com.google.cloud.datastream.v1.DatastreamClient; import com.google.cloud.datastream.v1.DeletePrivateConnectionRequest; import com.google.cloud.datastream.v1.PrivateConnectionName; +import com.google.protobuf.Empty; public class SyncDeletePrivateConnection { diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionPrivateconnectionname.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionPrivateconnectionname.java index ae0b9dfd..b3941e8e 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionPrivateconnectionname.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionPrivateconnectionname.java @@ -16,10 +16,10 @@ package com.google.cloud.datastream.v1.samples; -// [START -// datastream_v1_generated_datastreamclient_deleteprivateconnection_privateconnectionname_sync] +// [START datastream_v1_generated_datastreamclient_deleteprivateconnection_privateconnectionname_sync] import com.google.cloud.datastream.v1.DatastreamClient; import com.google.cloud.datastream.v1.PrivateConnectionName; +import com.google.protobuf.Empty; public class SyncDeletePrivateConnectionPrivateconnectionname { diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionString.java index 323cae74..aae640d9 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionString.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionString.java @@ -19,6 +19,7 @@ // [START datastream_v1_generated_datastreamclient_deleteprivateconnection_string_sync] import com.google.cloud.datastream.v1.DatastreamClient; import com.google.cloud.datastream.v1.PrivateConnectionName; +import com.google.protobuf.Empty; public class SyncDeletePrivateConnectionString { diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRoute.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRoute.java index 787f642e..12dad948 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRoute.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRoute.java @@ -20,6 +20,7 @@ import com.google.cloud.datastream.v1.DatastreamClient; import com.google.cloud.datastream.v1.DeleteRouteRequest; import com.google.cloud.datastream.v1.RouteName; +import com.google.protobuf.Empty; public class SyncDeleteRoute { diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRouteRoutename.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRouteRoutename.java index b0869a1e..68845f52 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRouteRoutename.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRouteRoutename.java @@ -19,6 +19,7 @@ // [START datastream_v1_generated_datastreamclient_deleteroute_routename_sync] import com.google.cloud.datastream.v1.DatastreamClient; import com.google.cloud.datastream.v1.RouteName; +import com.google.protobuf.Empty; public class SyncDeleteRouteRoutename { diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRouteString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRouteString.java index 3d19d0e2..802982d6 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRouteString.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deleteroute/SyncDeleteRouteString.java @@ -19,6 +19,7 @@ // [START datastream_v1_generated_datastreamclient_deleteroute_string_sync] import com.google.cloud.datastream.v1.DatastreamClient; import com.google.cloud.datastream.v1.RouteName; +import com.google.protobuf.Empty; public class SyncDeleteRouteString { diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStream.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStream.java index 488c49f2..720d045f 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStream.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStream.java @@ -20,6 +20,7 @@ import com.google.cloud.datastream.v1.DatastreamClient; import com.google.cloud.datastream.v1.DeleteStreamRequest; import com.google.cloud.datastream.v1.StreamName; +import com.google.protobuf.Empty; public class SyncDeleteStream { diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStreamStreamname.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStreamStreamname.java index 856057b3..7b0627d9 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStreamStreamname.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStreamStreamname.java @@ -19,6 +19,7 @@ // [START datastream_v1_generated_datastreamclient_deletestream_streamname_sync] import com.google.cloud.datastream.v1.DatastreamClient; import com.google.cloud.datastream.v1.StreamName; +import com.google.protobuf.Empty; public class SyncDeleteStreamStreamname { diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStreamString.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStreamString.java index 4b1e9b45..497041eb 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStreamString.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/deletestream/SyncDeleteStreamString.java @@ -19,6 +19,7 @@ // [START datastream_v1_generated_datastreamclient_deletestream_string_sync] import com.google.cloud.datastream.v1.DatastreamClient; import com.google.cloud.datastream.v1.StreamName; +import com.google.protobuf.Empty; public class SyncDeleteStreamString { diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfileConnectionprofileFieldmask.java b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfileConnectionprofileFieldmask.java index 82d2f69b..39d7713b 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfileConnectionprofileFieldmask.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfileConnectionprofileFieldmask.java @@ -16,8 +16,7 @@ package com.google.cloud.datastream.v1.samples; -// [START -// datastream_v1_generated_datastreamclient_updateconnectionprofile_connectionprofilefieldmask_sync] +// [START datastream_v1_generated_datastreamclient_updateconnectionprofile_connectionprofilefieldmask_sync] import com.google.cloud.datastream.v1.ConnectionProfile; import com.google.cloud.datastream.v1.DatastreamClient; import com.google.protobuf.FieldMask; @@ -39,5 +38,4 @@ public static void syncUpdateConnectionProfileConnectionprofileFieldmask() throw } } } -// [END -// datastream_v1_generated_datastreamclient_updateconnectionprofile_connectionprofilefieldmask_sync] +// [END datastream_v1_generated_datastreamclient_updateconnectionprofile_connectionprofilefieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileLocationnameConnectionprofileString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileLocationnameConnectionprofileString.java index 8428a0f3..807bfea2 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileLocationnameConnectionprofileString.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileLocationnameConnectionprofileString.java @@ -16,8 +16,7 @@ package com.google.cloud.datastream.v1alpha1.samples; -// [START -// datastream_v1alpha1_generated_datastreamclient_createconnectionprofile_locationnameconnectionprofilestring_sync] +// [START datastream_v1alpha1_generated_datastreamclient_createconnectionprofile_locationnameconnectionprofilestring_sync] import com.google.cloud.datastream.v1alpha1.ConnectionProfile; import com.google.cloud.datastream.v1alpha1.DatastreamClient; import com.google.cloud.datastream.v1alpha1.LocationName; @@ -43,5 +42,4 @@ public static void syncCreateConnectionProfileLocationnameConnectionprofileStrin } } } -// [END -// datastream_v1alpha1_generated_datastreamclient_createconnectionprofile_locationnameconnectionprofilestring_sync] +// [END datastream_v1alpha1_generated_datastreamclient_createconnectionprofile_locationnameconnectionprofilestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileStringConnectionprofileString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileStringConnectionprofileString.java index 9c9bed05..4a59dfab 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileStringConnectionprofileString.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createconnectionprofile/SyncCreateConnectionProfileStringConnectionprofileString.java @@ -16,8 +16,7 @@ package com.google.cloud.datastream.v1alpha1.samples; -// [START -// datastream_v1alpha1_generated_datastreamclient_createconnectionprofile_stringconnectionprofilestring_sync] +// [START datastream_v1alpha1_generated_datastreamclient_createconnectionprofile_stringconnectionprofilestring_sync] import com.google.cloud.datastream.v1alpha1.ConnectionProfile; import com.google.cloud.datastream.v1alpha1.DatastreamClient; import com.google.cloud.datastream.v1alpha1.LocationName; @@ -42,5 +41,4 @@ public static void syncCreateConnectionProfileStringConnectionprofileString() th } } } -// [END -// datastream_v1alpha1_generated_datastreamclient_createconnectionprofile_stringconnectionprofilestring_sync] +// [END datastream_v1alpha1_generated_datastreamclient_createconnectionprofile_stringconnectionprofilestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionLocationnamePrivateconnectionString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionLocationnamePrivateconnectionString.java index 75b5668d..0b8b09d3 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionLocationnamePrivateconnectionString.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionLocationnamePrivateconnectionString.java @@ -16,8 +16,7 @@ package com.google.cloud.datastream.v1alpha1.samples; -// [START -// datastream_v1alpha1_generated_datastreamclient_createprivateconnection_locationnameprivateconnectionstring_sync] +// [START datastream_v1alpha1_generated_datastreamclient_createprivateconnection_locationnameprivateconnectionstring_sync] import com.google.cloud.datastream.v1alpha1.DatastreamClient; import com.google.cloud.datastream.v1alpha1.LocationName; import com.google.cloud.datastream.v1alpha1.PrivateConnection; @@ -43,5 +42,4 @@ public static void syncCreatePrivateConnectionLocationnamePrivateconnectionStrin } } } -// [END -// datastream_v1alpha1_generated_datastreamclient_createprivateconnection_locationnameprivateconnectionstring_sync] +// [END datastream_v1alpha1_generated_datastreamclient_createprivateconnection_locationnameprivateconnectionstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionStringPrivateconnectionString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionStringPrivateconnectionString.java index 629cb8ad..2c6b1fce 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionStringPrivateconnectionString.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createprivateconnection/SyncCreatePrivateConnectionStringPrivateconnectionString.java @@ -16,8 +16,7 @@ package com.google.cloud.datastream.v1alpha1.samples; -// [START -// datastream_v1alpha1_generated_datastreamclient_createprivateconnection_stringprivateconnectionstring_sync] +// [START datastream_v1alpha1_generated_datastreamclient_createprivateconnection_stringprivateconnectionstring_sync] import com.google.cloud.datastream.v1alpha1.DatastreamClient; import com.google.cloud.datastream.v1alpha1.LocationName; import com.google.cloud.datastream.v1alpha1.PrivateConnection; @@ -42,5 +41,4 @@ public static void syncCreatePrivateConnectionStringPrivateconnectionString() th } } } -// [END -// datastream_v1alpha1_generated_datastreamclient_createprivateconnection_stringprivateconnectionstring_sync] +// [END datastream_v1alpha1_generated_datastreamclient_createprivateconnection_stringprivateconnectionstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/SyncCreateRoutePrivateconnectionnameRouteString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/SyncCreateRoutePrivateconnectionnameRouteString.java index 7af1ee5a..eca19388 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/SyncCreateRoutePrivateconnectionnameRouteString.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/createroute/SyncCreateRoutePrivateconnectionnameRouteString.java @@ -16,8 +16,7 @@ package com.google.cloud.datastream.v1alpha1.samples; -// [START -// datastream_v1alpha1_generated_datastreamclient_createroute_privateconnectionnameroutestring_sync] +// [START datastream_v1alpha1_generated_datastreamclient_createroute_privateconnectionnameroutestring_sync] import com.google.cloud.datastream.v1alpha1.DatastreamClient; import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; import com.google.cloud.datastream.v1alpha1.Route; @@ -40,5 +39,4 @@ public static void syncCreateRoutePrivateconnectionnameRouteString() throws Exce } } } -// [END -// datastream_v1alpha1_generated_datastreamclient_createroute_privateconnectionnameroutestring_sync] +// [END datastream_v1alpha1_generated_datastreamclient_createroute_privateconnectionnameroutestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfile.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfile.java index 050e4b65..86cb4209 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfile.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfile.java @@ -20,6 +20,7 @@ import com.google.cloud.datastream.v1alpha1.ConnectionProfileName; import com.google.cloud.datastream.v1alpha1.DatastreamClient; import com.google.cloud.datastream.v1alpha1.DeleteConnectionProfileRequest; +import com.google.protobuf.Empty; public class SyncDeleteConnectionProfile { diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileConnectionprofilename.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileConnectionprofilename.java index 59770783..a9f4b46c 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileConnectionprofilename.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileConnectionprofilename.java @@ -16,10 +16,10 @@ package com.google.cloud.datastream.v1alpha1.samples; -// [START -// datastream_v1alpha1_generated_datastreamclient_deleteconnectionprofile_connectionprofilename_sync] +// [START datastream_v1alpha1_generated_datastreamclient_deleteconnectionprofile_connectionprofilename_sync] import com.google.cloud.datastream.v1alpha1.ConnectionProfileName; import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.protobuf.Empty; public class SyncDeleteConnectionProfileConnectionprofilename { @@ -37,5 +37,4 @@ public static void syncDeleteConnectionProfileConnectionprofilename() throws Exc } } } -// [END -// datastream_v1alpha1_generated_datastreamclient_deleteconnectionprofile_connectionprofilename_sync] +// [END datastream_v1alpha1_generated_datastreamclient_deleteconnectionprofile_connectionprofilename_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileString.java index 3779bf27..b260c32f 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileString.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteconnectionprofile/SyncDeleteConnectionProfileString.java @@ -19,6 +19,7 @@ // [START datastream_v1alpha1_generated_datastreamclient_deleteconnectionprofile_string_sync] import com.google.cloud.datastream.v1alpha1.ConnectionProfileName; import com.google.cloud.datastream.v1alpha1.DatastreamClient; +import com.google.protobuf.Empty; public class SyncDeleteConnectionProfileString { diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnection.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnection.java index 777c577e..498354f2 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnection.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnection.java @@ -20,6 +20,7 @@ import com.google.cloud.datastream.v1alpha1.DatastreamClient; import com.google.cloud.datastream.v1alpha1.DeletePrivateConnectionRequest; import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; +import com.google.protobuf.Empty; public class SyncDeletePrivateConnection { diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionPrivateconnectionname.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionPrivateconnectionname.java index e913623f..41451c9a 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionPrivateconnectionname.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionPrivateconnectionname.java @@ -16,10 +16,10 @@ package com.google.cloud.datastream.v1alpha1.samples; -// [START -// datastream_v1alpha1_generated_datastreamclient_deleteprivateconnection_privateconnectionname_sync] +// [START datastream_v1alpha1_generated_datastreamclient_deleteprivateconnection_privateconnectionname_sync] import com.google.cloud.datastream.v1alpha1.DatastreamClient; import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; +import com.google.protobuf.Empty; public class SyncDeletePrivateConnectionPrivateconnectionname { @@ -37,5 +37,4 @@ public static void syncDeletePrivateConnectionPrivateconnectionname() throws Exc } } } -// [END -// datastream_v1alpha1_generated_datastreamclient_deleteprivateconnection_privateconnectionname_sync] +// [END datastream_v1alpha1_generated_datastreamclient_deleteprivateconnection_privateconnectionname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionString.java index b2e0d571..62dff45c 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionString.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteprivateconnection/SyncDeletePrivateConnectionString.java @@ -19,6 +19,7 @@ // [START datastream_v1alpha1_generated_datastreamclient_deleteprivateconnection_string_sync] import com.google.cloud.datastream.v1alpha1.DatastreamClient; import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; +import com.google.protobuf.Empty; public class SyncDeletePrivateConnectionString { diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRoute.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRoute.java index eb15f13e..99e6339f 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRoute.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRoute.java @@ -20,6 +20,7 @@ import com.google.cloud.datastream.v1alpha1.DatastreamClient; import com.google.cloud.datastream.v1alpha1.DeleteRouteRequest; import com.google.cloud.datastream.v1alpha1.RouteName; +import com.google.protobuf.Empty; public class SyncDeleteRoute { diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRouteRoutename.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRouteRoutename.java index 008a0673..880b2945 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRouteRoutename.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRouteRoutename.java @@ -19,6 +19,7 @@ // [START datastream_v1alpha1_generated_datastreamclient_deleteroute_routename_sync] import com.google.cloud.datastream.v1alpha1.DatastreamClient; import com.google.cloud.datastream.v1alpha1.RouteName; +import com.google.protobuf.Empty; public class SyncDeleteRouteRoutename { diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRouteString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRouteString.java index 2c0237dd..86f3e21b 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRouteString.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deleteroute/SyncDeleteRouteString.java @@ -19,6 +19,7 @@ // [START datastream_v1alpha1_generated_datastreamclient_deleteroute_string_sync] import com.google.cloud.datastream.v1alpha1.DatastreamClient; import com.google.cloud.datastream.v1alpha1.RouteName; +import com.google.protobuf.Empty; public class SyncDeleteRouteString { diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStream.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStream.java index 0a113f3f..f78f1fc0 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStream.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStream.java @@ -20,6 +20,7 @@ import com.google.cloud.datastream.v1alpha1.DatastreamClient; import com.google.cloud.datastream.v1alpha1.DeleteStreamRequest; import com.google.cloud.datastream.v1alpha1.StreamName; +import com.google.protobuf.Empty; public class SyncDeleteStream { diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStreamStreamname.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStreamStreamname.java index 4793ce72..cc84517d 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStreamStreamname.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStreamStreamname.java @@ -19,6 +19,7 @@ // [START datastream_v1alpha1_generated_datastreamclient_deletestream_streamname_sync] import com.google.cloud.datastream.v1alpha1.DatastreamClient; import com.google.cloud.datastream.v1alpha1.StreamName; +import com.google.protobuf.Empty; public class SyncDeleteStreamStreamname { diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStreamString.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStreamString.java index c3a15b3c..c13d5ebc 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStreamString.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/deletestream/SyncDeleteStreamString.java @@ -19,6 +19,7 @@ // [START datastream_v1alpha1_generated_datastreamclient_deletestream_string_sync] import com.google.cloud.datastream.v1alpha1.DatastreamClient; import com.google.cloud.datastream.v1alpha1.StreamName; +import com.google.protobuf.Empty; public class SyncDeleteStreamString { diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getconnectionprofile/SyncGetConnectionProfileConnectionprofilename.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getconnectionprofile/SyncGetConnectionProfileConnectionprofilename.java index 030da00a..c59987d7 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getconnectionprofile/SyncGetConnectionProfileConnectionprofilename.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getconnectionprofile/SyncGetConnectionProfileConnectionprofilename.java @@ -16,8 +16,7 @@ package com.google.cloud.datastream.v1alpha1.samples; -// [START -// datastream_v1alpha1_generated_datastreamclient_getconnectionprofile_connectionprofilename_sync] +// [START datastream_v1alpha1_generated_datastreamclient_getconnectionprofile_connectionprofilename_sync] import com.google.cloud.datastream.v1alpha1.ConnectionProfile; import com.google.cloud.datastream.v1alpha1.ConnectionProfileName; import com.google.cloud.datastream.v1alpha1.DatastreamClient; @@ -38,5 +37,4 @@ public static void syncGetConnectionProfileConnectionprofilename() throws Except } } } -// [END -// datastream_v1alpha1_generated_datastreamclient_getconnectionprofile_connectionprofilename_sync] +// [END datastream_v1alpha1_generated_datastreamclient_getconnectionprofile_connectionprofilename_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getprivateconnection/SyncGetPrivateConnectionPrivateconnectionname.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getprivateconnection/SyncGetPrivateConnectionPrivateconnectionname.java index 664c7cab..b6b2526c 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getprivateconnection/SyncGetPrivateConnectionPrivateconnectionname.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/getprivateconnection/SyncGetPrivateConnectionPrivateconnectionname.java @@ -16,8 +16,7 @@ package com.google.cloud.datastream.v1alpha1.samples; -// [START -// datastream_v1alpha1_generated_datastreamclient_getprivateconnection_privateconnectionname_sync] +// [START datastream_v1alpha1_generated_datastreamclient_getprivateconnection_privateconnectionname_sync] import com.google.cloud.datastream.v1alpha1.DatastreamClient; import com.google.cloud.datastream.v1alpha1.PrivateConnection; import com.google.cloud.datastream.v1alpha1.PrivateConnectionName; @@ -38,5 +37,4 @@ public static void syncGetPrivateConnectionPrivateconnectionname() throws Except } } } -// [END -// datastream_v1alpha1_generated_datastreamclient_getprivateconnection_privateconnectionname_sync] +// [END datastream_v1alpha1_generated_datastreamclient_getprivateconnection_privateconnectionname_sync] diff --git a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfileConnectionprofileFieldmask.java b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfileConnectionprofileFieldmask.java index c77232f9..58c9d974 100644 --- a/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfileConnectionprofileFieldmask.java +++ b/samples/snippets/generated/com/google/cloud/datastream/v1alpha1/datastreamclient/updateconnectionprofile/SyncUpdateConnectionProfileConnectionprofileFieldmask.java @@ -16,8 +16,7 @@ package com.google.cloud.datastream.v1alpha1.samples; -// [START -// datastream_v1alpha1_generated_datastreamclient_updateconnectionprofile_connectionprofilefieldmask_sync] +// [START datastream_v1alpha1_generated_datastreamclient_updateconnectionprofile_connectionprofilefieldmask_sync] import com.google.cloud.datastream.v1alpha1.ConnectionProfile; import com.google.cloud.datastream.v1alpha1.DatastreamClient; import com.google.protobuf.FieldMask; @@ -39,5 +38,4 @@ public static void syncUpdateConnectionProfileConnectionprofileFieldmask() throw } } } -// [END -// datastream_v1alpha1_generated_datastreamclient_updateconnectionprofile_connectionprofilefieldmask_sync] +// [END datastream_v1alpha1_generated_datastreamclient_updateconnectionprofile_connectionprofilefieldmask_sync] From e734c59c6a8b7bec50fab3440332a93990417937 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 30 Jun 2022 02:22:34 +0000 Subject: [PATCH 10/13] chore: Disable CLIRR checks on releas (#1474) (#181) Source-Link: https://github.com/googleapis/synthtool/commit/7a220e27993a25ab3cda26510d5619d97b6952a9 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:6d4e3a15c62cfdcb823d60e16da7521e7c6fc00eba07c8ff12e4de9924a57d28 --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/release/stage.sh | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index f0625e4d..a454a61e 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest - digest: sha256:1ec28a46062b19135b11178ceee60231e5f5a92dab454e23ae0aab72cd875906 -# created: 2022-06-27T15:01:06.405564326Z + digest: sha256:6d4e3a15c62cfdcb823d60e16da7521e7c6fc00eba07c8ff12e4de9924a57d28 +# created: 2022-06-29T23:17:33.110417661Z diff --git a/.kokoro/release/stage.sh b/.kokoro/release/stage.sh index 77dc4e8f..1dba8de1 100755 --- a/.kokoro/release/stage.sh +++ b/.kokoro/release/stage.sh @@ -32,6 +32,7 @@ retry_with_backoff 3 10 \ mvn clean deploy -B \ --settings ${MAVEN_SETTINGS_FILE} \ -DskipTests=true \ + -Dclirr.skip=true \ -DperformRelease=true \ -Dgpg.executable=gpg \ -Dgpg.passphrase=${GPG_PASSPHRASE} \ @@ -42,4 +43,4 @@ then mvn nexus-staging:release -B \ -DperformRelease=true \ --settings=settings.xml -fi \ No newline at end of file +fi From 59950a17a7193a7678e38eb57bba0b0b88f07687 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 1 Jul 2022 03:54:26 +0000 Subject: [PATCH 11/13] chore(main): release 1.0.1-SNAPSHOT (#169) :robot: I have created a release *beep* *boop* --- ### Updating meta-information for bleeding-edge SNAPSHOT release. --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- google-cloud-datastream-bom/pom.xml | 12 ++++++------ google-cloud-datastream/pom.xml | 4 ++-- grpc-google-cloud-datastream-v1/pom.xml | 4 ++-- grpc-google-cloud-datastream-v1alpha1/pom.xml | 4 ++-- pom.xml | 12 ++++++------ proto-google-cloud-datastream-v1/pom.xml | 4 ++-- proto-google-cloud-datastream-v1alpha1/pom.xml | 4 ++-- versions.txt | 10 +++++----- 8 files changed, 27 insertions(+), 27 deletions(-) diff --git a/google-cloud-datastream-bom/pom.xml b/google-cloud-datastream-bom/pom.xml index 0a887e0e..cd7bdbdc 100644 --- a/google-cloud-datastream-bom/pom.xml +++ b/google-cloud-datastream-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-datastream-bom - 1.0.0 + 1.0.1-SNAPSHOT pom com.google.cloud @@ -56,27 +56,27 @@ com.google.cloud google-cloud-datastream - 1.0.0 + 1.0.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-datastream-v1alpha1 - 0.5.0 + 0.5.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-datastream-v1 - 1.0.0 + 1.0.1-SNAPSHOT com.google.api.grpc proto-google-cloud-datastream-v1alpha1 - 0.5.0 + 0.5.1-SNAPSHOT com.google.api.grpc proto-google-cloud-datastream-v1 - 1.0.0 + 1.0.1-SNAPSHOT diff --git a/google-cloud-datastream/pom.xml b/google-cloud-datastream/pom.xml index 9c8a11c5..1dd4cefc 100644 --- a/google-cloud-datastream/pom.xml +++ b/google-cloud-datastream/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-datastream - 1.0.0 + 1.0.1-SNAPSHOT jar Google Datastream https://github.com/googleapis/java-datastream @@ -11,7 +11,7 @@ com.google.cloud google-cloud-datastream-parent - 1.0.0 + 1.0.1-SNAPSHOT google-cloud-datastream diff --git a/grpc-google-cloud-datastream-v1/pom.xml b/grpc-google-cloud-datastream-v1/pom.xml index 9d54622d..65343ec6 100644 --- a/grpc-google-cloud-datastream-v1/pom.xml +++ b/grpc-google-cloud-datastream-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-datastream-v1 - 1.0.0 + 1.0.1-SNAPSHOT grpc-google-cloud-datastream-v1 GRPC library for google-cloud-datastream com.google.cloud google-cloud-datastream-parent - 1.0.0 + 1.0.1-SNAPSHOT diff --git a/grpc-google-cloud-datastream-v1alpha1/pom.xml b/grpc-google-cloud-datastream-v1alpha1/pom.xml index 8e155ae7..e208cacf 100644 --- a/grpc-google-cloud-datastream-v1alpha1/pom.xml +++ b/grpc-google-cloud-datastream-v1alpha1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-datastream-v1alpha1 - 0.5.0 + 0.5.1-SNAPSHOT grpc-google-cloud-datastream-v1alpha1 GRPC library for google-cloud-datastream com.google.cloud google-cloud-datastream-parent - 1.0.0 + 1.0.1-SNAPSHOT diff --git a/pom.xml b/pom.xml index b2967a63..f3330501 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-datastream-parent pom - 1.0.0 + 1.0.1-SNAPSHOT Google Datastream Parent https://github.com/googleapis/java-datastream @@ -69,27 +69,27 @@ com.google.cloud google-cloud-datastream - 1.0.0 + 1.0.1-SNAPSHOT com.google.api.grpc proto-google-cloud-datastream-v1 - 1.0.0 + 1.0.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-datastream-v1 - 1.0.0 + 1.0.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-datastream-v1alpha1 - 0.5.0 + 0.5.1-SNAPSHOT com.google.api.grpc proto-google-cloud-datastream-v1alpha1 - 0.5.0 + 0.5.1-SNAPSHOT diff --git a/proto-google-cloud-datastream-v1/pom.xml b/proto-google-cloud-datastream-v1/pom.xml index dbc5268d..cf0ec22f 100644 --- a/proto-google-cloud-datastream-v1/pom.xml +++ b/proto-google-cloud-datastream-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-datastream-v1 - 1.0.0 + 1.0.1-SNAPSHOT proto-google-cloud-datastream-v1 Proto library for google-cloud-datastream com.google.cloud google-cloud-datastream-parent - 1.0.0 + 1.0.1-SNAPSHOT diff --git a/proto-google-cloud-datastream-v1alpha1/pom.xml b/proto-google-cloud-datastream-v1alpha1/pom.xml index 0f19420f..1f699413 100644 --- a/proto-google-cloud-datastream-v1alpha1/pom.xml +++ b/proto-google-cloud-datastream-v1alpha1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-datastream-v1alpha1 - 0.5.0 + 0.5.1-SNAPSHOT proto-google-cloud-datastream-v1alpha1 Proto library for google-cloud-datastream com.google.cloud google-cloud-datastream-parent - 1.0.0 + 1.0.1-SNAPSHOT diff --git a/versions.txt b/versions.txt index cc5cc5e2..e86f3917 100644 --- a/versions.txt +++ b/versions.txt @@ -1,8 +1,8 @@ # Format: # module:released-version:current-version -google-cloud-datastream:1.0.0:1.0.0 -grpc-google-cloud-datastream-v1alpha1:0.5.0:0.5.0 -proto-google-cloud-datastream-v1alpha1:0.5.0:0.5.0 -proto-google-cloud-datastream-v1:1.0.0:1.0.0 -grpc-google-cloud-datastream-v1:1.0.0:1.0.0 +google-cloud-datastream:1.0.0:1.0.1-SNAPSHOT +grpc-google-cloud-datastream-v1alpha1:0.5.0:0.5.1-SNAPSHOT +proto-google-cloud-datastream-v1alpha1:0.5.0:0.5.1-SNAPSHOT +proto-google-cloud-datastream-v1:1.0.0:1.0.1-SNAPSHOT +grpc-google-cloud-datastream-v1:1.0.0:1.0.1-SNAPSHOT From 2d862e00fdacda00c81c236b60076639a88b0adf Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Fri, 1 Jul 2022 10:30:26 -0400 Subject: [PATCH 12/13] ci: removing clirr from required checks (#179) Making CLIRR not required. The version bumps are now controlled by the Release Please and OwlBot. The CL authors create appropriate change description to control major version bumps. --- .github/sync-repo-settings.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index 6f09d695..dd5626f3 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -11,7 +11,6 @@ branchProtectionRules: - dependencies (8) - dependencies (11) - lint - - clirr - units (8) - units (11) - 'Kokoro - Test: Integration' @@ -26,7 +25,6 @@ branchProtectionRules: - dependencies (8) - dependencies (11) - lint - - clirr - units (7) - units (8) - units (11) From efb940f9a6fc9c9ae1c7437e8b8e637cc08603e5 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 1 Jul 2022 16:22:20 +0000 Subject: [PATCH 13/13] chore(main): release 1.1.0 (#182) :robot: I have created a release *beep* *boop* --- ## [1.1.0](https://github.com/googleapis/java-datastream/compare/v1.0.0...v1.1.0) (2022-07-01) ### Features * Enable REST transport for most of Java and Go clients ([#176](https://github.com/googleapis/java-datastream/issues/176)) ([3e68385](https://github.com/googleapis/java-datastream/commit/3e6838526f2a2e4233767b1ce3032c4c6b5e0086)) ### Bug Fixes * update gapic-generator-java with mock service generation fixes ([#178](https://github.com/googleapis/java-datastream/issues/178)) ([f793baa](https://github.com/googleapis/java-datastream/commit/f793baa8cebcbaa48eadd3ac469a4e4f192e90be)) ### Dependencies * update dependency com.google.cloud:google-cloud-shared-dependencies to v2.13.0 ([#175](https://github.com/googleapis/java-datastream/issues/175)) ([4f222a0](https://github.com/googleapis/java-datastream/commit/4f222a0f0cd6a055627c459d81cdfeeb3d1baf26)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- CHANGELOG.md | 17 +++++++++++++++++ google-cloud-datastream-bom/pom.xml | 12 ++++++------ google-cloud-datastream/pom.xml | 4 ++-- grpc-google-cloud-datastream-v1/pom.xml | 4 ++-- grpc-google-cloud-datastream-v1alpha1/pom.xml | 4 ++-- pom.xml | 12 ++++++------ proto-google-cloud-datastream-v1/pom.xml | 4 ++-- proto-google-cloud-datastream-v1alpha1/pom.xml | 4 ++-- versions.txt | 10 +++++----- 9 files changed, 44 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a26f6956..ded54bfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## [1.1.0](https://github.com/googleapis/java-datastream/compare/v1.0.0...v1.1.0) (2022-07-01) + + +### Features + +* Enable REST transport for most of Java and Go clients ([#176](https://github.com/googleapis/java-datastream/issues/176)) ([3e68385](https://github.com/googleapis/java-datastream/commit/3e6838526f2a2e4233767b1ce3032c4c6b5e0086)) + + +### Bug Fixes + +* update gapic-generator-java with mock service generation fixes ([#178](https://github.com/googleapis/java-datastream/issues/178)) ([f793baa](https://github.com/googleapis/java-datastream/commit/f793baa8cebcbaa48eadd3ac469a4e4f192e90be)) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.13.0 ([#175](https://github.com/googleapis/java-datastream/issues/175)) ([4f222a0](https://github.com/googleapis/java-datastream/commit/4f222a0f0cd6a055627c459d81cdfeeb3d1baf26)) + ## [1.0.0](https://github.com/googleapis/java-datastream/compare/v0.4.4...v1.0.0) (2022-05-19) diff --git a/google-cloud-datastream-bom/pom.xml b/google-cloud-datastream-bom/pom.xml index cd7bdbdc..a38b2c60 100644 --- a/google-cloud-datastream-bom/pom.xml +++ b/google-cloud-datastream-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-datastream-bom - 1.0.1-SNAPSHOT + 1.1.0 pom com.google.cloud @@ -56,27 +56,27 @@ com.google.cloud google-cloud-datastream - 1.0.1-SNAPSHOT + 1.1.0 com.google.api.grpc grpc-google-cloud-datastream-v1alpha1 - 0.5.1-SNAPSHOT + 0.6.0 com.google.api.grpc grpc-google-cloud-datastream-v1 - 1.0.1-SNAPSHOT + 1.1.0 com.google.api.grpc proto-google-cloud-datastream-v1alpha1 - 0.5.1-SNAPSHOT + 0.6.0 com.google.api.grpc proto-google-cloud-datastream-v1 - 1.0.1-SNAPSHOT + 1.1.0 diff --git a/google-cloud-datastream/pom.xml b/google-cloud-datastream/pom.xml index 1dd4cefc..22e6b299 100644 --- a/google-cloud-datastream/pom.xml +++ b/google-cloud-datastream/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-datastream - 1.0.1-SNAPSHOT + 1.1.0 jar Google Datastream https://github.com/googleapis/java-datastream @@ -11,7 +11,7 @@ com.google.cloud google-cloud-datastream-parent - 1.0.1-SNAPSHOT + 1.1.0 google-cloud-datastream diff --git a/grpc-google-cloud-datastream-v1/pom.xml b/grpc-google-cloud-datastream-v1/pom.xml index 65343ec6..66a26623 100644 --- a/grpc-google-cloud-datastream-v1/pom.xml +++ b/grpc-google-cloud-datastream-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-datastream-v1 - 1.0.1-SNAPSHOT + 1.1.0 grpc-google-cloud-datastream-v1 GRPC library for google-cloud-datastream com.google.cloud google-cloud-datastream-parent - 1.0.1-SNAPSHOT + 1.1.0 diff --git a/grpc-google-cloud-datastream-v1alpha1/pom.xml b/grpc-google-cloud-datastream-v1alpha1/pom.xml index e208cacf..f45d728a 100644 --- a/grpc-google-cloud-datastream-v1alpha1/pom.xml +++ b/grpc-google-cloud-datastream-v1alpha1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-datastream-v1alpha1 - 0.5.1-SNAPSHOT + 0.6.0 grpc-google-cloud-datastream-v1alpha1 GRPC library for google-cloud-datastream com.google.cloud google-cloud-datastream-parent - 1.0.1-SNAPSHOT + 1.1.0 diff --git a/pom.xml b/pom.xml index f3330501..219a918f 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-datastream-parent pom - 1.0.1-SNAPSHOT + 1.1.0 Google Datastream Parent https://github.com/googleapis/java-datastream @@ -69,27 +69,27 @@ com.google.cloud google-cloud-datastream - 1.0.1-SNAPSHOT + 1.1.0 com.google.api.grpc proto-google-cloud-datastream-v1 - 1.0.1-SNAPSHOT + 1.1.0 com.google.api.grpc grpc-google-cloud-datastream-v1 - 1.0.1-SNAPSHOT + 1.1.0 com.google.api.grpc grpc-google-cloud-datastream-v1alpha1 - 0.5.1-SNAPSHOT + 0.6.0 com.google.api.grpc proto-google-cloud-datastream-v1alpha1 - 0.5.1-SNAPSHOT + 0.6.0 diff --git a/proto-google-cloud-datastream-v1/pom.xml b/proto-google-cloud-datastream-v1/pom.xml index cf0ec22f..a21df84e 100644 --- a/proto-google-cloud-datastream-v1/pom.xml +++ b/proto-google-cloud-datastream-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-datastream-v1 - 1.0.1-SNAPSHOT + 1.1.0 proto-google-cloud-datastream-v1 Proto library for google-cloud-datastream com.google.cloud google-cloud-datastream-parent - 1.0.1-SNAPSHOT + 1.1.0 diff --git a/proto-google-cloud-datastream-v1alpha1/pom.xml b/proto-google-cloud-datastream-v1alpha1/pom.xml index 1f699413..4639cca6 100644 --- a/proto-google-cloud-datastream-v1alpha1/pom.xml +++ b/proto-google-cloud-datastream-v1alpha1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-datastream-v1alpha1 - 0.5.1-SNAPSHOT + 0.6.0 proto-google-cloud-datastream-v1alpha1 Proto library for google-cloud-datastream com.google.cloud google-cloud-datastream-parent - 1.0.1-SNAPSHOT + 1.1.0 diff --git a/versions.txt b/versions.txt index e86f3917..9e4140e1 100644 --- a/versions.txt +++ b/versions.txt @@ -1,8 +1,8 @@ # Format: # module:released-version:current-version -google-cloud-datastream:1.0.0:1.0.1-SNAPSHOT -grpc-google-cloud-datastream-v1alpha1:0.5.0:0.5.1-SNAPSHOT -proto-google-cloud-datastream-v1alpha1:0.5.0:0.5.1-SNAPSHOT -proto-google-cloud-datastream-v1:1.0.0:1.0.1-SNAPSHOT -grpc-google-cloud-datastream-v1:1.0.0:1.0.1-SNAPSHOT +google-cloud-datastream:1.1.0:1.1.0 +grpc-google-cloud-datastream-v1alpha1:0.6.0:0.6.0 +proto-google-cloud-datastream-v1alpha1:0.6.0:0.6.0 +proto-google-cloud-datastream-v1:1.1.0:1.1.0 +grpc-google-cloud-datastream-v1:1.1.0:1.1.0