diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b29b449..5ec662af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.2.3](https://github.com/googleapis/java-networkconnectivity/compare/v1.2.2...v1.2.3) (2022-08-09) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-shared-dependencies to v3 ([#278](https://github.com/googleapis/java-networkconnectivity/issues/278)) ([f63ae40](https://github.com/googleapis/java-networkconnectivity/commit/f63ae405d7f1a207d9eee1bcc976dafbb916fda1)) + ## [1.2.2](https://github.com/googleapis/java-networkconnectivity/compare/v1.2.1...v1.2.2) (2022-07-13) diff --git a/google-cloud-networkconnectivity-bom/pom.xml b/google-cloud-networkconnectivity-bom/pom.xml index dd3ad676..1171075d 100644 --- a/google-cloud-networkconnectivity-bom/pom.xml +++ b/google-cloud-networkconnectivity-bom/pom.xml @@ -3,12 +3,12 @@ 4.0.0 com.google.cloud google-cloud-networkconnectivity-bom - 1.2.2 + 1.2.3 pom com.google.cloud google-cloud-shared-config - 1.5.1 + 1.5.3 Google Network Connectivity Center BOM @@ -56,27 +56,27 @@ com.google.cloud google-cloud-networkconnectivity - 1.2.2 + 1.2.3 com.google.api.grpc grpc-google-cloud-networkconnectivity-v1alpha1 - 0.8.2 + 0.8.3 com.google.api.grpc grpc-google-cloud-networkconnectivity-v1 - 1.2.2 + 1.2.3 com.google.api.grpc proto-google-cloud-networkconnectivity-v1alpha1 - 0.8.2 + 0.8.3 com.google.api.grpc proto-google-cloud-networkconnectivity-v1 - 1.2.2 + 1.2.3 diff --git a/google-cloud-networkconnectivity/pom.xml b/google-cloud-networkconnectivity/pom.xml index 32791dc3..acd6b08d 100644 --- a/google-cloud-networkconnectivity/pom.xml +++ b/google-cloud-networkconnectivity/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-networkconnectivity - 1.2.2 + 1.2.3 jar Google Network Connectivity Center https://github.com/googleapis/java-networkconnectivity @@ -11,7 +11,7 @@ com.google.cloud google-cloud-networkconnectivity-parent - 1.2.2 + 1.2.3 google-cloud-networkconnectivity diff --git a/grpc-google-cloud-networkconnectivity-v1/pom.xml b/grpc-google-cloud-networkconnectivity-v1/pom.xml index ac47b3fe..35abcccd 100644 --- a/grpc-google-cloud-networkconnectivity-v1/pom.xml +++ b/grpc-google-cloud-networkconnectivity-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-networkconnectivity-v1 - 1.2.2 + 1.2.3 grpc-google-cloud-networkconnectivity-v1 GRPC library for google-cloud-networkconnectivity com.google.cloud google-cloud-networkconnectivity-parent - 1.2.2 + 1.2.3 diff --git a/grpc-google-cloud-networkconnectivity-v1alpha1/pom.xml b/grpc-google-cloud-networkconnectivity-v1alpha1/pom.xml index 1496b869..70f8489e 100644 --- a/grpc-google-cloud-networkconnectivity-v1alpha1/pom.xml +++ b/grpc-google-cloud-networkconnectivity-v1alpha1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-networkconnectivity-v1alpha1 - 0.8.2 + 0.8.3 grpc-google-cloud-networkconnectivity-v1alpha1 GRPC library for google-cloud-networkconnectivity com.google.cloud google-cloud-networkconnectivity-parent - 1.2.2 + 1.2.3 diff --git a/pom.xml b/pom.xml index 899802a3..0093749d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-networkconnectivity-parent pom - 1.2.2 + 1.2.3 Google Network Connectivity Center Parent https://github.com/googleapis/java- @@ -14,7 +14,7 @@ com.google.cloud google-cloud-shared-config - 1.5.1 + 1.5.3 @@ -61,33 +61,33 @@ com.google.cloud google-cloud-networkconnectivity - 1.2.2 + 1.2.3 com.google.api.grpc proto-google-cloud-networkconnectivity-v1 - 1.2.2 + 1.2.3 com.google.api.grpc grpc-google-cloud-networkconnectivity-v1 - 1.2.2 + 1.2.3 com.google.api.grpc proto-google-cloud-networkconnectivity-v1alpha1 - 0.8.2 + 0.8.3 com.google.api.grpc grpc-google-cloud-networkconnectivity-v1alpha1 - 0.8.2 + 0.8.3 com.google.cloud google-cloud-shared-dependencies - 2.13.0 + 3.0.1 pom import @@ -125,7 +125,7 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 3.3.0 + 3.4.0 diff --git a/proto-google-cloud-networkconnectivity-v1/pom.xml b/proto-google-cloud-networkconnectivity-v1/pom.xml index ec779768..dddb8a46 100644 --- a/proto-google-cloud-networkconnectivity-v1/pom.xml +++ b/proto-google-cloud-networkconnectivity-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-networkconnectivity-v1 - 1.2.2 + 1.2.3 proto-google-cloud-networkconnectivity-v1 Proto library for google-cloud-networkconnectivity com.google.cloud google-cloud-networkconnectivity-parent - 1.2.2 + 1.2.3 diff --git a/proto-google-cloud-networkconnectivity-v1/src/main/java/com/google/cloud/networkconnectivity/v1/LocationMetadata.java b/proto-google-cloud-networkconnectivity-v1/src/main/java/com/google/cloud/networkconnectivity/v1/LocationMetadata.java index 86f33e9f..2863a3ab 100644 --- a/proto-google-cloud-networkconnectivity-v1/src/main/java/com/google/cloud/networkconnectivity/v1/LocationMetadata.java +++ b/proto-google-cloud-networkconnectivity-v1/src/main/java/com/google/cloud/networkconnectivity/v1/LocationMetadata.java @@ -775,8 +775,8 @@ public int getLocationFeaturesValue(int index) { * repeated .google.cloud.networkconnectivity.v1.LocationFeature location_features = 1; * * - * @param index The index of the value to return. - * @return The enum numeric value on the wire of locationFeatures at the given index. + * @param index The index to set the value at. + * @param value The enum numeric value on the wire for locationFeatures to set. * @return This builder for chaining. */ public Builder setLocationFeaturesValue(int index, int value) { diff --git a/proto-google-cloud-networkconnectivity-v1alpha1/pom.xml b/proto-google-cloud-networkconnectivity-v1alpha1/pom.xml index 80e92c29..1576825d 100644 --- a/proto-google-cloud-networkconnectivity-v1alpha1/pom.xml +++ b/proto-google-cloud-networkconnectivity-v1alpha1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-networkconnectivity-v1alpha1 - 0.8.2 + 0.8.3 proto-google-cloud-networkconnectivity-v1alpha1 Proto library for google-cloud-networkconnectivity com.google.cloud google-cloud-networkconnectivity-parent - 1.2.2 + 1.2.3 diff --git a/samples/pom.xml b/samples/pom.xml index 542bb586..29560c32 100644 --- a/samples/pom.xml +++ b/samples/pom.xml @@ -38,7 +38,7 @@ org.apache.maven.plugins maven-deploy-plugin - 2.8.2 + 3.0.0 true diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..4bdfb33d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.HubServiceSettings; +import com.google.cloud.networkconnectivity.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. + HubServiceSettings hubServiceSettings = + HubServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + HubServiceClient hubServiceClient = HubServiceClient.create(hubServiceSettings); + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..ee46a923 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_create_setendpoint_sync] +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.HubServiceSettings; +import com.google.cloud.networkconnectivity.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. + HubServiceSettings hubServiceSettings = + HubServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + HubServiceClient hubServiceClient = HubServiceClient.create(hubServiceSettings); + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createhub/AsyncCreateHub.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createhub/AsyncCreateHub.java new file mode 100644 index 00000000..6c329fad --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createhub/AsyncCreateHub.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_createhub_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.networkconnectivity.v1.CreateHubRequest; +import com.google.cloud.networkconnectivity.v1.Hub; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateHub { + + public static void main(String[] args) throws Exception { + asyncCreateHub(); + } + + public static void asyncCreateHub() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + CreateHubRequest request = + CreateHubRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setHubId("hubId99628272") + .setHub(Hub.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = hubServiceClient.createHubCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_createhub_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createhub/AsyncCreateHubLRO.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createhub/AsyncCreateHubLRO.java new file mode 100644 index 00000000..45185c6e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createhub/AsyncCreateHubLRO.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_createhub_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.networkconnectivity.v1.CreateHubRequest; +import com.google.cloud.networkconnectivity.v1.Hub; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.LocationName; +import com.google.cloud.networkconnectivity.v1.OperationMetadata; + +public class AsyncCreateHubLRO { + + public static void main(String[] args) throws Exception { + asyncCreateHubLRO(); + } + + public static void asyncCreateHubLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + CreateHubRequest request = + CreateHubRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setHubId("hubId99628272") + .setHub(Hub.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + hubServiceClient.createHubOperationCallable().futureCall(request); + // Do something. + Hub response = future.get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_createhub_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createhub/SyncCreateHub.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createhub/SyncCreateHub.java new file mode 100644 index 00000000..c0ae57fb --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createhub/SyncCreateHub.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_createhub_sync] +import com.google.cloud.networkconnectivity.v1.CreateHubRequest; +import com.google.cloud.networkconnectivity.v1.Hub; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.LocationName; + +public class SyncCreateHub { + + public static void main(String[] args) throws Exception { + syncCreateHub(); + } + + public static void syncCreateHub() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + CreateHubRequest request = + CreateHubRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setHubId("hubId99628272") + .setHub(Hub.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + Hub response = hubServiceClient.createHubAsync(request).get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_createhub_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createhub/SyncCreateHubLocationnameHubString.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createhub/SyncCreateHubLocationnameHubString.java new file mode 100644 index 00000000..6cd04d36 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createhub/SyncCreateHubLocationnameHubString.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_createhub_locationnamehubstring_sync] +import com.google.cloud.networkconnectivity.v1.Hub; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.LocationName; + +public class SyncCreateHubLocationnameHubString { + + public static void main(String[] args) throws Exception { + syncCreateHubLocationnameHubString(); + } + + public static void syncCreateHubLocationnameHubString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Hub hub = Hub.newBuilder().build(); + String hubId = "hubId99628272"; + Hub response = hubServiceClient.createHubAsync(parent, hub, hubId).get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_createhub_locationnamehubstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createhub/SyncCreateHubStringHubString.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createhub/SyncCreateHubStringHubString.java new file mode 100644 index 00000000..0e662bd0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createhub/SyncCreateHubStringHubString.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_createhub_stringhubstring_sync] +import com.google.cloud.networkconnectivity.v1.Hub; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.LocationName; + +public class SyncCreateHubStringHubString { + + public static void main(String[] args) throws Exception { + syncCreateHubStringHubString(); + } + + public static void syncCreateHubStringHubString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Hub hub = Hub.newBuilder().build(); + String hubId = "hubId99628272"; + Hub response = hubServiceClient.createHubAsync(parent, hub, hubId).get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_createhub_stringhubstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createspoke/AsyncCreateSpoke.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createspoke/AsyncCreateSpoke.java new file mode 100644 index 00000000..ab671a24 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createspoke/AsyncCreateSpoke.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_createspoke_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.networkconnectivity.v1.CreateSpokeRequest; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.LocationName; +import com.google.cloud.networkconnectivity.v1.Spoke; +import com.google.longrunning.Operation; + +public class AsyncCreateSpoke { + + public static void main(String[] args) throws Exception { + asyncCreateSpoke(); + } + + public static void asyncCreateSpoke() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + CreateSpokeRequest request = + CreateSpokeRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSpokeId("spokeId-1998996281") + .setSpoke(Spoke.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = hubServiceClient.createSpokeCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_createspoke_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createspoke/AsyncCreateSpokeLRO.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createspoke/AsyncCreateSpokeLRO.java new file mode 100644 index 00000000..051c8b96 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createspoke/AsyncCreateSpokeLRO.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_createspoke_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.networkconnectivity.v1.CreateSpokeRequest; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.LocationName; +import com.google.cloud.networkconnectivity.v1.OperationMetadata; +import com.google.cloud.networkconnectivity.v1.Spoke; + +public class AsyncCreateSpokeLRO { + + public static void main(String[] args) throws Exception { + asyncCreateSpokeLRO(); + } + + public static void asyncCreateSpokeLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + CreateSpokeRequest request = + CreateSpokeRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSpokeId("spokeId-1998996281") + .setSpoke(Spoke.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + hubServiceClient.createSpokeOperationCallable().futureCall(request); + // Do something. + Spoke response = future.get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_createspoke_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createspoke/SyncCreateSpoke.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createspoke/SyncCreateSpoke.java new file mode 100644 index 00000000..9262500d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createspoke/SyncCreateSpoke.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_createspoke_sync] +import com.google.cloud.networkconnectivity.v1.CreateSpokeRequest; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.LocationName; +import com.google.cloud.networkconnectivity.v1.Spoke; + +public class SyncCreateSpoke { + + public static void main(String[] args) throws Exception { + syncCreateSpoke(); + } + + public static void syncCreateSpoke() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + CreateSpokeRequest request = + CreateSpokeRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSpokeId("spokeId-1998996281") + .setSpoke(Spoke.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + Spoke response = hubServiceClient.createSpokeAsync(request).get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_createspoke_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createspoke/SyncCreateSpokeLocationnameSpokeString.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createspoke/SyncCreateSpokeLocationnameSpokeString.java new file mode 100644 index 00000000..9572f31f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createspoke/SyncCreateSpokeLocationnameSpokeString.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_createspoke_locationnamespokestring_sync] +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.LocationName; +import com.google.cloud.networkconnectivity.v1.Spoke; + +public class SyncCreateSpokeLocationnameSpokeString { + + public static void main(String[] args) throws Exception { + syncCreateSpokeLocationnameSpokeString(); + } + + public static void syncCreateSpokeLocationnameSpokeString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Spoke spoke = Spoke.newBuilder().build(); + String spokeId = "spokeId-1998996281"; + Spoke response = hubServiceClient.createSpokeAsync(parent, spoke, spokeId).get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_createspoke_locationnamespokestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createspoke/SyncCreateSpokeStringSpokeString.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createspoke/SyncCreateSpokeStringSpokeString.java new file mode 100644 index 00000000..b7a9e696 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/createspoke/SyncCreateSpokeStringSpokeString.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_createspoke_stringspokestring_sync] +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.LocationName; +import com.google.cloud.networkconnectivity.v1.Spoke; + +public class SyncCreateSpokeStringSpokeString { + + public static void main(String[] args) throws Exception { + syncCreateSpokeStringSpokeString(); + } + + public static void syncCreateSpokeStringSpokeString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Spoke spoke = Spoke.newBuilder().build(); + String spokeId = "spokeId-1998996281"; + Spoke response = hubServiceClient.createSpokeAsync(parent, spoke, spokeId).get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_createspoke_stringspokestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletehub/AsyncDeleteHub.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletehub/AsyncDeleteHub.java new file mode 100644 index 00000000..77cf7fd3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletehub/AsyncDeleteHub.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_deletehub_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.networkconnectivity.v1.DeleteHubRequest; +import com.google.cloud.networkconnectivity.v1.HubName; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteHub { + + public static void main(String[] args) throws Exception { + asyncDeleteHub(); + } + + public static void asyncDeleteHub() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + DeleteHubRequest request = + DeleteHubRequest.newBuilder() + .setName(HubName.of("[PROJECT]", "[HUB]").toString()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = hubServiceClient.deleteHubCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_deletehub_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletehub/AsyncDeleteHubLRO.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletehub/AsyncDeleteHubLRO.java new file mode 100644 index 00000000..2d564c24 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletehub/AsyncDeleteHubLRO.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_deletehub_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.networkconnectivity.v1.DeleteHubRequest; +import com.google.cloud.networkconnectivity.v1.HubName; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.OperationMetadata; +import com.google.protobuf.Empty; + +public class AsyncDeleteHubLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteHubLRO(); + } + + public static void asyncDeleteHubLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + DeleteHubRequest request = + DeleteHubRequest.newBuilder() + .setName(HubName.of("[PROJECT]", "[HUB]").toString()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + hubServiceClient.deleteHubOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_deletehub_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletehub/SyncDeleteHub.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletehub/SyncDeleteHub.java new file mode 100644 index 00000000..05a90b6d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletehub/SyncDeleteHub.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_deletehub_sync] +import com.google.cloud.networkconnectivity.v1.DeleteHubRequest; +import com.google.cloud.networkconnectivity.v1.HubName; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteHub { + + public static void main(String[] args) throws Exception { + syncDeleteHub(); + } + + public static void syncDeleteHub() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + DeleteHubRequest request = + DeleteHubRequest.newBuilder() + .setName(HubName.of("[PROJECT]", "[HUB]").toString()) + .setRequestId("requestId693933066") + .build(); + hubServiceClient.deleteHubAsync(request).get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_deletehub_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletehub/SyncDeleteHubHubname.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletehub/SyncDeleteHubHubname.java new file mode 100644 index 00000000..6ebacdd1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletehub/SyncDeleteHubHubname.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_deletehub_hubname_sync] +import com.google.cloud.networkconnectivity.v1.HubName; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteHubHubname { + + public static void main(String[] args) throws Exception { + syncDeleteHubHubname(); + } + + public static void syncDeleteHubHubname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + HubName name = HubName.of("[PROJECT]", "[HUB]"); + hubServiceClient.deleteHubAsync(name).get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_deletehub_hubname_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletehub/SyncDeleteHubString.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletehub/SyncDeleteHubString.java new file mode 100644 index 00000000..d9cb608d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletehub/SyncDeleteHubString.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_deletehub_string_sync] +import com.google.cloud.networkconnectivity.v1.HubName; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteHubString { + + public static void main(String[] args) throws Exception { + syncDeleteHubString(); + } + + public static void syncDeleteHubString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + String name = HubName.of("[PROJECT]", "[HUB]").toString(); + hubServiceClient.deleteHubAsync(name).get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_deletehub_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletespoke/AsyncDeleteSpoke.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletespoke/AsyncDeleteSpoke.java new file mode 100644 index 00000000..db59f9cc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletespoke/AsyncDeleteSpoke.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_deletespoke_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.networkconnectivity.v1.DeleteSpokeRequest; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.SpokeName; +import com.google.longrunning.Operation; + +public class AsyncDeleteSpoke { + + public static void main(String[] args) throws Exception { + asyncDeleteSpoke(); + } + + public static void asyncDeleteSpoke() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + DeleteSpokeRequest request = + DeleteSpokeRequest.newBuilder() + .setName(SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = hubServiceClient.deleteSpokeCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_deletespoke_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletespoke/AsyncDeleteSpokeLRO.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletespoke/AsyncDeleteSpokeLRO.java new file mode 100644 index 00000000..d99e0da1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletespoke/AsyncDeleteSpokeLRO.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_deletespoke_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.networkconnectivity.v1.DeleteSpokeRequest; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.OperationMetadata; +import com.google.cloud.networkconnectivity.v1.SpokeName; +import com.google.protobuf.Empty; + +public class AsyncDeleteSpokeLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteSpokeLRO(); + } + + public static void asyncDeleteSpokeLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + DeleteSpokeRequest request = + DeleteSpokeRequest.newBuilder() + .setName(SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + hubServiceClient.deleteSpokeOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_deletespoke_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletespoke/SyncDeleteSpoke.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletespoke/SyncDeleteSpoke.java new file mode 100644 index 00000000..aec30d43 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletespoke/SyncDeleteSpoke.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_deletespoke_sync] +import com.google.cloud.networkconnectivity.v1.DeleteSpokeRequest; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.SpokeName; +import com.google.protobuf.Empty; + +public class SyncDeleteSpoke { + + public static void main(String[] args) throws Exception { + syncDeleteSpoke(); + } + + public static void syncDeleteSpoke() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + DeleteSpokeRequest request = + DeleteSpokeRequest.newBuilder() + .setName(SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString()) + .setRequestId("requestId693933066") + .build(); + hubServiceClient.deleteSpokeAsync(request).get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_deletespoke_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletespoke/SyncDeleteSpokeSpokename.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletespoke/SyncDeleteSpokeSpokename.java new file mode 100644 index 00000000..9fa1415f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletespoke/SyncDeleteSpokeSpokename.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_deletespoke_spokename_sync] +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.SpokeName; +import com.google.protobuf.Empty; + +public class SyncDeleteSpokeSpokename { + + public static void main(String[] args) throws Exception { + syncDeleteSpokeSpokename(); + } + + public static void syncDeleteSpokeSpokename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + SpokeName name = SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]"); + hubServiceClient.deleteSpokeAsync(name).get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_deletespoke_spokename_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletespoke/SyncDeleteSpokeString.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletespoke/SyncDeleteSpokeString.java new file mode 100644 index 00000000..5d181d95 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/deletespoke/SyncDeleteSpokeString.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_deletespoke_string_sync] +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.SpokeName; +import com.google.protobuf.Empty; + +public class SyncDeleteSpokeString { + + public static void main(String[] args) throws Exception { + syncDeleteSpokeString(); + } + + public static void syncDeleteSpokeString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + String name = SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString(); + hubServiceClient.deleteSpokeAsync(name).get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_deletespoke_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/gethub/AsyncGetHub.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/gethub/AsyncGetHub.java new file mode 100644 index 00000000..60e2932c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/gethub/AsyncGetHub.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_gethub_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.networkconnectivity.v1.GetHubRequest; +import com.google.cloud.networkconnectivity.v1.Hub; +import com.google.cloud.networkconnectivity.v1.HubName; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; + +public class AsyncGetHub { + + public static void main(String[] args) throws Exception { + asyncGetHub(); + } + + public static void asyncGetHub() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + GetHubRequest request = + GetHubRequest.newBuilder().setName(HubName.of("[PROJECT]", "[HUB]").toString()).build(); + ApiFuture future = hubServiceClient.getHubCallable().futureCall(request); + // Do something. + Hub response = future.get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_gethub_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/gethub/SyncGetHub.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/gethub/SyncGetHub.java new file mode 100644 index 00000000..ad933292 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/gethub/SyncGetHub.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_gethub_sync] +import com.google.cloud.networkconnectivity.v1.GetHubRequest; +import com.google.cloud.networkconnectivity.v1.Hub; +import com.google.cloud.networkconnectivity.v1.HubName; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; + +public class SyncGetHub { + + public static void main(String[] args) throws Exception { + syncGetHub(); + } + + public static void syncGetHub() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + GetHubRequest request = + GetHubRequest.newBuilder().setName(HubName.of("[PROJECT]", "[HUB]").toString()).build(); + Hub response = hubServiceClient.getHub(request); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_gethub_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/gethub/SyncGetHubHubname.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/gethub/SyncGetHubHubname.java new file mode 100644 index 00000000..9cf29887 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/gethub/SyncGetHubHubname.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_gethub_hubname_sync] +import com.google.cloud.networkconnectivity.v1.Hub; +import com.google.cloud.networkconnectivity.v1.HubName; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; + +public class SyncGetHubHubname { + + public static void main(String[] args) throws Exception { + syncGetHubHubname(); + } + + public static void syncGetHubHubname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + HubName name = HubName.of("[PROJECT]", "[HUB]"); + Hub response = hubServiceClient.getHub(name); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_gethub_hubname_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/gethub/SyncGetHubString.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/gethub/SyncGetHubString.java new file mode 100644 index 00000000..5d9aae8c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/gethub/SyncGetHubString.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_gethub_string_sync] +import com.google.cloud.networkconnectivity.v1.Hub; +import com.google.cloud.networkconnectivity.v1.HubName; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; + +public class SyncGetHubString { + + public static void main(String[] args) throws Exception { + syncGetHubString(); + } + + public static void syncGetHubString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + String name = HubName.of("[PROJECT]", "[HUB]").toString(); + Hub response = hubServiceClient.getHub(name); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_gethub_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/getspoke/AsyncGetSpoke.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/getspoke/AsyncGetSpoke.java new file mode 100644 index 00000000..620e4463 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/getspoke/AsyncGetSpoke.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_getspoke_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.networkconnectivity.v1.GetSpokeRequest; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.Spoke; +import com.google.cloud.networkconnectivity.v1.SpokeName; + +public class AsyncGetSpoke { + + public static void main(String[] args) throws Exception { + asyncGetSpoke(); + } + + public static void asyncGetSpoke() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + GetSpokeRequest request = + GetSpokeRequest.newBuilder() + .setName(SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString()) + .build(); + ApiFuture future = hubServiceClient.getSpokeCallable().futureCall(request); + // Do something. + Spoke response = future.get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_getspoke_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/getspoke/SyncGetSpoke.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/getspoke/SyncGetSpoke.java new file mode 100644 index 00000000..03832e7e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/getspoke/SyncGetSpoke.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_getspoke_sync] +import com.google.cloud.networkconnectivity.v1.GetSpokeRequest; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.Spoke; +import com.google.cloud.networkconnectivity.v1.SpokeName; + +public class SyncGetSpoke { + + public static void main(String[] args) throws Exception { + syncGetSpoke(); + } + + public static void syncGetSpoke() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + GetSpokeRequest request = + GetSpokeRequest.newBuilder() + .setName(SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString()) + .build(); + Spoke response = hubServiceClient.getSpoke(request); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_getspoke_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/getspoke/SyncGetSpokeSpokename.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/getspoke/SyncGetSpokeSpokename.java new file mode 100644 index 00000000..d05dca84 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/getspoke/SyncGetSpokeSpokename.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_getspoke_spokename_sync] +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.Spoke; +import com.google.cloud.networkconnectivity.v1.SpokeName; + +public class SyncGetSpokeSpokename { + + public static void main(String[] args) throws Exception { + syncGetSpokeSpokename(); + } + + public static void syncGetSpokeSpokename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + SpokeName name = SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]"); + Spoke response = hubServiceClient.getSpoke(name); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_getspoke_spokename_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/getspoke/SyncGetSpokeString.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/getspoke/SyncGetSpokeString.java new file mode 100644 index 00000000..8d331c68 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/getspoke/SyncGetSpokeString.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_getspoke_string_sync] +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.Spoke; +import com.google.cloud.networkconnectivity.v1.SpokeName; + +public class SyncGetSpokeString { + + public static void main(String[] args) throws Exception { + syncGetSpokeString(); + } + + public static void syncGetSpokeString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + String name = SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString(); + Spoke response = hubServiceClient.getSpoke(name); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_getspoke_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listhubs/AsyncListHubs.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listhubs/AsyncListHubs.java new file mode 100644 index 00000000..0211d1b8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listhubs/AsyncListHubs.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_listhubs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.networkconnectivity.v1.Hub; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.ListHubsRequest; +import com.google.cloud.networkconnectivity.v1.LocationName; + +public class AsyncListHubs { + + public static void main(String[] args) throws Exception { + asyncListHubs(); + } + + public static void asyncListHubs() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + ListHubsRequest request = + ListHubsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = hubServiceClient.listHubsPagedCallable().futureCall(request); + // Do something. + for (Hub element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_listhubs_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listhubs/AsyncListHubsPaged.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listhubs/AsyncListHubsPaged.java new file mode 100644 index 00000000..a3577d4b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listhubs/AsyncListHubsPaged.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_listhubs_paged_async] +import com.google.cloud.networkconnectivity.v1.Hub; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.ListHubsRequest; +import com.google.cloud.networkconnectivity.v1.ListHubsResponse; +import com.google.cloud.networkconnectivity.v1.LocationName; +import com.google.common.base.Strings; + +public class AsyncListHubsPaged { + + public static void main(String[] args) throws Exception { + asyncListHubsPaged(); + } + + public static void asyncListHubsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + ListHubsRequest request = + ListHubsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListHubsResponse response = hubServiceClient.listHubsCallable().call(request); + for (Hub element : response.getHubsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_listhubs_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listhubs/SyncListHubs.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listhubs/SyncListHubs.java new file mode 100644 index 00000000..68c02c8b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listhubs/SyncListHubs.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_listhubs_sync] +import com.google.cloud.networkconnectivity.v1.Hub; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.ListHubsRequest; +import com.google.cloud.networkconnectivity.v1.LocationName; + +public class SyncListHubs { + + public static void main(String[] args) throws Exception { + syncListHubs(); + } + + public static void syncListHubs() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + ListHubsRequest request = + ListHubsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (Hub element : hubServiceClient.listHubs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_listhubs_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listhubs/SyncListHubsLocationname.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listhubs/SyncListHubsLocationname.java new file mode 100644 index 00000000..dbccad6d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listhubs/SyncListHubsLocationname.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_listhubs_locationname_sync] +import com.google.cloud.networkconnectivity.v1.Hub; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.LocationName; + +public class SyncListHubsLocationname { + + public static void main(String[] args) throws Exception { + syncListHubsLocationname(); + } + + public static void syncListHubsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Hub element : hubServiceClient.listHubs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_listhubs_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listhubs/SyncListHubsString.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listhubs/SyncListHubsString.java new file mode 100644 index 00000000..d97c331a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listhubs/SyncListHubsString.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_listhubs_string_sync] +import com.google.cloud.networkconnectivity.v1.Hub; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.LocationName; + +public class SyncListHubsString { + + public static void main(String[] args) throws Exception { + syncListHubsString(); + } + + public static void syncListHubsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Hub element : hubServiceClient.listHubs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_listhubs_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listspokes/AsyncListSpokes.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listspokes/AsyncListSpokes.java new file mode 100644 index 00000000..0c3a20c5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listspokes/AsyncListSpokes.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_listspokes_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.ListSpokesRequest; +import com.google.cloud.networkconnectivity.v1.LocationName; +import com.google.cloud.networkconnectivity.v1.Spoke; + +public class AsyncListSpokes { + + public static void main(String[] args) throws Exception { + asyncListSpokes(); + } + + public static void asyncListSpokes() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + ListSpokesRequest request = + ListSpokesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = hubServiceClient.listSpokesPagedCallable().futureCall(request); + // Do something. + for (Spoke element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_listspokes_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listspokes/AsyncListSpokesPaged.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listspokes/AsyncListSpokesPaged.java new file mode 100644 index 00000000..969de725 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listspokes/AsyncListSpokesPaged.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_listspokes_paged_async] +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.ListSpokesRequest; +import com.google.cloud.networkconnectivity.v1.ListSpokesResponse; +import com.google.cloud.networkconnectivity.v1.LocationName; +import com.google.cloud.networkconnectivity.v1.Spoke; +import com.google.common.base.Strings; + +public class AsyncListSpokesPaged { + + public static void main(String[] args) throws Exception { + asyncListSpokesPaged(); + } + + public static void asyncListSpokesPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + ListSpokesRequest request = + ListSpokesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListSpokesResponse response = hubServiceClient.listSpokesCallable().call(request); + for (Spoke element : response.getSpokesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_listspokes_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listspokes/SyncListSpokes.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listspokes/SyncListSpokes.java new file mode 100644 index 00000000..2f923d08 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listspokes/SyncListSpokes.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_listspokes_sync] +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.ListSpokesRequest; +import com.google.cloud.networkconnectivity.v1.LocationName; +import com.google.cloud.networkconnectivity.v1.Spoke; + +public class SyncListSpokes { + + public static void main(String[] args) throws Exception { + syncListSpokes(); + } + + public static void syncListSpokes() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + ListSpokesRequest request = + ListSpokesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (Spoke element : hubServiceClient.listSpokes(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_listspokes_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listspokes/SyncListSpokesLocationname.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listspokes/SyncListSpokesLocationname.java new file mode 100644 index 00000000..1fd0f919 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listspokes/SyncListSpokesLocationname.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_listspokes_locationname_sync] +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.LocationName; +import com.google.cloud.networkconnectivity.v1.Spoke; + +public class SyncListSpokesLocationname { + + public static void main(String[] args) throws Exception { + syncListSpokesLocationname(); + } + + public static void syncListSpokesLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Spoke element : hubServiceClient.listSpokes(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_listspokes_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listspokes/SyncListSpokesString.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listspokes/SyncListSpokesString.java new file mode 100644 index 00000000..0edfee90 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/listspokes/SyncListSpokesString.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_listspokes_string_sync] +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.LocationName; +import com.google.cloud.networkconnectivity.v1.Spoke; + +public class SyncListSpokesString { + + public static void main(String[] args) throws Exception { + syncListSpokesString(); + } + + public static void syncListSpokesString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Spoke element : hubServiceClient.listSpokes(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_listspokes_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatehub/AsyncUpdateHub.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatehub/AsyncUpdateHub.java new file mode 100644 index 00000000..990cd67f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatehub/AsyncUpdateHub.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_updatehub_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.networkconnectivity.v1.Hub; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.UpdateHubRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateHub { + + public static void main(String[] args) throws Exception { + asyncUpdateHub(); + } + + public static void asyncUpdateHub() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + UpdateHubRequest request = + UpdateHubRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setHub(Hub.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = hubServiceClient.updateHubCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_updatehub_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatehub/AsyncUpdateHubLRO.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatehub/AsyncUpdateHubLRO.java new file mode 100644 index 00000000..795f3454 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatehub/AsyncUpdateHubLRO.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_updatehub_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.networkconnectivity.v1.Hub; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.OperationMetadata; +import com.google.cloud.networkconnectivity.v1.UpdateHubRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateHubLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateHubLRO(); + } + + public static void asyncUpdateHubLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + UpdateHubRequest request = + UpdateHubRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setHub(Hub.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + hubServiceClient.updateHubOperationCallable().futureCall(request); + // Do something. + Hub response = future.get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_updatehub_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatehub/SyncUpdateHub.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatehub/SyncUpdateHub.java new file mode 100644 index 00000000..7f788f47 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatehub/SyncUpdateHub.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_updatehub_sync] +import com.google.cloud.networkconnectivity.v1.Hub; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.UpdateHubRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateHub { + + public static void main(String[] args) throws Exception { + syncUpdateHub(); + } + + public static void syncUpdateHub() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + UpdateHubRequest request = + UpdateHubRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setHub(Hub.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + Hub response = hubServiceClient.updateHubAsync(request).get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_updatehub_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatehub/SyncUpdateHubHubFieldmask.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatehub/SyncUpdateHubHubFieldmask.java new file mode 100644 index 00000000..01dd40fc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatehub/SyncUpdateHubHubFieldmask.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_updatehub_hubfieldmask_sync] +import com.google.cloud.networkconnectivity.v1.Hub; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateHubHubFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateHubHubFieldmask(); + } + + public static void syncUpdateHubHubFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + Hub hub = Hub.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Hub response = hubServiceClient.updateHubAsync(hub, updateMask).get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_updatehub_hubfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatespoke/AsyncUpdateSpoke.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatespoke/AsyncUpdateSpoke.java new file mode 100644 index 00000000..7acdbb41 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatespoke/AsyncUpdateSpoke.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_updatespoke_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.Spoke; +import com.google.cloud.networkconnectivity.v1.UpdateSpokeRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateSpoke { + + public static void main(String[] args) throws Exception { + asyncUpdateSpoke(); + } + + public static void asyncUpdateSpoke() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + UpdateSpokeRequest request = + UpdateSpokeRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setSpoke(Spoke.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = hubServiceClient.updateSpokeCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_updatespoke_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatespoke/AsyncUpdateSpokeLRO.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatespoke/AsyncUpdateSpokeLRO.java new file mode 100644 index 00000000..a6c86b7b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatespoke/AsyncUpdateSpokeLRO.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_updatespoke_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.OperationMetadata; +import com.google.cloud.networkconnectivity.v1.Spoke; +import com.google.cloud.networkconnectivity.v1.UpdateSpokeRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateSpokeLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateSpokeLRO(); + } + + public static void asyncUpdateSpokeLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + UpdateSpokeRequest request = + UpdateSpokeRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setSpoke(Spoke.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + hubServiceClient.updateSpokeOperationCallable().futureCall(request); + // Do something. + Spoke response = future.get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_updatespoke_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatespoke/SyncUpdateSpoke.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatespoke/SyncUpdateSpoke.java new file mode 100644 index 00000000..f928773e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatespoke/SyncUpdateSpoke.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_updatespoke_sync] +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.Spoke; +import com.google.cloud.networkconnectivity.v1.UpdateSpokeRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateSpoke { + + public static void main(String[] args) throws Exception { + syncUpdateSpoke(); + } + + public static void syncUpdateSpoke() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + UpdateSpokeRequest request = + UpdateSpokeRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setSpoke(Spoke.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + Spoke response = hubServiceClient.updateSpokeAsync(request).get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_updatespoke_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatespoke/SyncUpdateSpokeSpokeFieldmask.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatespoke/SyncUpdateSpokeSpokeFieldmask.java new file mode 100644 index 00000000..f58902ae --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubserviceclient/updatespoke/SyncUpdateSpokeSpokeFieldmask.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubserviceclient_updatespoke_spokefieldmask_sync] +import com.google.cloud.networkconnectivity.v1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1.Spoke; +import com.google.protobuf.FieldMask; + +public class SyncUpdateSpokeSpokeFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateSpokeSpokeFieldmask(); + } + + public static void syncUpdateSpokeSpokeFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + Spoke spoke = Spoke.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Spoke response = hubServiceClient.updateSpokeAsync(spoke, updateMask).get(); + } + } +} +// [END networkconnectivity_v1_generated_hubserviceclient_updatespoke_spokefieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubservicesettings/gethub/SyncGetHub.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubservicesettings/gethub/SyncGetHub.java new file mode 100644 index 00000000..3f3e1b58 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/hubservicesettings/gethub/SyncGetHub.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.networkconnectivity.v1.samples; + +// [START networkconnectivity_v1_generated_hubservicesettings_gethub_sync] +import com.google.cloud.networkconnectivity.v1.HubServiceSettings; +import java.time.Duration; + +public class SyncGetHub { + + public static void main(String[] args) throws Exception { + syncGetHub(); + } + + public static void syncGetHub() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + HubServiceSettings.Builder hubServiceSettingsBuilder = HubServiceSettings.newBuilder(); + hubServiceSettingsBuilder + .getHubSettings() + .setRetrySettings( + hubServiceSettingsBuilder + .getHubSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + HubServiceSettings hubServiceSettings = hubServiceSettingsBuilder.build(); + } +} +// [END networkconnectivity_v1_generated_hubservicesettings_gethub_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/stub/hubservicestubsettings/gethub/SyncGetHub.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/stub/hubservicestubsettings/gethub/SyncGetHub.java new file mode 100644 index 00000000..44b97354 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1/stub/hubservicestubsettings/gethub/SyncGetHub.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.networkconnectivity.v1.stub.samples; + +// [START networkconnectivity_v1_generated_hubservicestubsettings_gethub_sync] +import com.google.cloud.networkconnectivity.v1.stub.HubServiceStubSettings; +import java.time.Duration; + +public class SyncGetHub { + + public static void main(String[] args) throws Exception { + syncGetHub(); + } + + public static void syncGetHub() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + HubServiceStubSettings.Builder hubServiceSettingsBuilder = HubServiceStubSettings.newBuilder(); + hubServiceSettingsBuilder + .getHubSettings() + .setRetrySettings( + hubServiceSettingsBuilder + .getHubSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + HubServiceStubSettings hubServiceSettings = hubServiceSettingsBuilder.build(); + } +} +// [END networkconnectivity_v1_generated_hubservicestubsettings_gethub_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..02788a62 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceSettings; +import com.google.cloud.networkconnectivity.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. + HubServiceSettings hubServiceSettings = + HubServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + HubServiceClient hubServiceClient = HubServiceClient.create(hubServiceSettings); + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..71396ab4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_create_setendpoint_sync] +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceSettings; +import com.google.cloud.networkconnectivity.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. + HubServiceSettings hubServiceSettings = + HubServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + HubServiceClient hubServiceClient = HubServiceClient.create(hubServiceSettings); + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createhub/AsyncCreateHub.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createhub/AsyncCreateHub.java new file mode 100644 index 00000000..6e2b7d34 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createhub/AsyncCreateHub.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_createhub_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest; +import com.google.cloud.networkconnectivity.v1alpha1.Hub; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateHub { + + public static void main(String[] args) throws Exception { + asyncCreateHub(); + } + + public static void asyncCreateHub() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + CreateHubRequest request = + CreateHubRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setHubId("hubId99628272") + .setHub(Hub.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = hubServiceClient.createHubCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_createhub_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createhub/AsyncCreateHubLRO.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createhub/AsyncCreateHubLRO.java new file mode 100644 index 00000000..4f015352 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createhub/AsyncCreateHubLRO.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_createhub_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest; +import com.google.cloud.networkconnectivity.v1alpha1.Hub; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.LocationName; +import com.google.cloud.networkconnectivity.v1alpha1.OperationMetadata; + +public class AsyncCreateHubLRO { + + public static void main(String[] args) throws Exception { + asyncCreateHubLRO(); + } + + public static void asyncCreateHubLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + CreateHubRequest request = + CreateHubRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setHubId("hubId99628272") + .setHub(Hub.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + hubServiceClient.createHubOperationCallable().futureCall(request); + // Do something. + Hub response = future.get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_createhub_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createhub/SyncCreateHub.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createhub/SyncCreateHub.java new file mode 100644 index 00000000..0f0cfdb1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createhub/SyncCreateHub.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_createhub_sync] +import com.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest; +import com.google.cloud.networkconnectivity.v1alpha1.Hub; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.LocationName; + +public class SyncCreateHub { + + public static void main(String[] args) throws Exception { + syncCreateHub(); + } + + public static void syncCreateHub() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + CreateHubRequest request = + CreateHubRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setHubId("hubId99628272") + .setHub(Hub.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + Hub response = hubServiceClient.createHubAsync(request).get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_createhub_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createhub/SyncCreateHubLocationnameHubString.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createhub/SyncCreateHubLocationnameHubString.java new file mode 100644 index 00000000..b85a2e83 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createhub/SyncCreateHubLocationnameHubString.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_createhub_locationnamehubstring_sync] +import com.google.cloud.networkconnectivity.v1alpha1.Hub; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.LocationName; + +public class SyncCreateHubLocationnameHubString { + + public static void main(String[] args) throws Exception { + syncCreateHubLocationnameHubString(); + } + + public static void syncCreateHubLocationnameHubString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Hub hub = Hub.newBuilder().build(); + String hubId = "hubId99628272"; + Hub response = hubServiceClient.createHubAsync(parent, hub, hubId).get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_createhub_locationnamehubstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createhub/SyncCreateHubStringHubString.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createhub/SyncCreateHubStringHubString.java new file mode 100644 index 00000000..f8a9b04b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createhub/SyncCreateHubStringHubString.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_createhub_stringhubstring_sync] +import com.google.cloud.networkconnectivity.v1alpha1.Hub; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.LocationName; + +public class SyncCreateHubStringHubString { + + public static void main(String[] args) throws Exception { + syncCreateHubStringHubString(); + } + + public static void syncCreateHubStringHubString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Hub hub = Hub.newBuilder().build(); + String hubId = "hubId99628272"; + Hub response = hubServiceClient.createHubAsync(parent, hub, hubId).get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_createhub_stringhubstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createspoke/AsyncCreateSpoke.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createspoke/AsyncCreateSpoke.java new file mode 100644 index 00000000..3105c5e5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createspoke/AsyncCreateSpoke.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_createspoke_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.LocationName; +import com.google.cloud.networkconnectivity.v1alpha1.Spoke; +import com.google.longrunning.Operation; + +public class AsyncCreateSpoke { + + public static void main(String[] args) throws Exception { + asyncCreateSpoke(); + } + + public static void asyncCreateSpoke() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + CreateSpokeRequest request = + CreateSpokeRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSpokeId("spokeId-1998996281") + .setSpoke(Spoke.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = hubServiceClient.createSpokeCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_createspoke_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createspoke/AsyncCreateSpokeLRO.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createspoke/AsyncCreateSpokeLRO.java new file mode 100644 index 00000000..f67f956b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createspoke/AsyncCreateSpokeLRO.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_createspoke_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.LocationName; +import com.google.cloud.networkconnectivity.v1alpha1.OperationMetadata; +import com.google.cloud.networkconnectivity.v1alpha1.Spoke; + +public class AsyncCreateSpokeLRO { + + public static void main(String[] args) throws Exception { + asyncCreateSpokeLRO(); + } + + public static void asyncCreateSpokeLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + CreateSpokeRequest request = + CreateSpokeRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSpokeId("spokeId-1998996281") + .setSpoke(Spoke.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + hubServiceClient.createSpokeOperationCallable().futureCall(request); + // Do something. + Spoke response = future.get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_createspoke_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createspoke/SyncCreateSpoke.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createspoke/SyncCreateSpoke.java new file mode 100644 index 00000000..e9892e98 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createspoke/SyncCreateSpoke.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_createspoke_sync] +import com.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.LocationName; +import com.google.cloud.networkconnectivity.v1alpha1.Spoke; + +public class SyncCreateSpoke { + + public static void main(String[] args) throws Exception { + syncCreateSpoke(); + } + + public static void syncCreateSpoke() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + CreateSpokeRequest request = + CreateSpokeRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSpokeId("spokeId-1998996281") + .setSpoke(Spoke.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + Spoke response = hubServiceClient.createSpokeAsync(request).get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_createspoke_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createspoke/SyncCreateSpokeLocationnameSpokeString.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createspoke/SyncCreateSpokeLocationnameSpokeString.java new file mode 100644 index 00000000..0b7b40da --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createspoke/SyncCreateSpokeLocationnameSpokeString.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_createspoke_locationnamespokestring_sync] +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.LocationName; +import com.google.cloud.networkconnectivity.v1alpha1.Spoke; + +public class SyncCreateSpokeLocationnameSpokeString { + + public static void main(String[] args) throws Exception { + syncCreateSpokeLocationnameSpokeString(); + } + + public static void syncCreateSpokeLocationnameSpokeString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Spoke spoke = Spoke.newBuilder().build(); + String spokeId = "spokeId-1998996281"; + Spoke response = hubServiceClient.createSpokeAsync(parent, spoke, spokeId).get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_createspoke_locationnamespokestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createspoke/SyncCreateSpokeStringSpokeString.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createspoke/SyncCreateSpokeStringSpokeString.java new file mode 100644 index 00000000..c1e2c156 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/createspoke/SyncCreateSpokeStringSpokeString.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_createspoke_stringspokestring_sync] +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.LocationName; +import com.google.cloud.networkconnectivity.v1alpha1.Spoke; + +public class SyncCreateSpokeStringSpokeString { + + public static void main(String[] args) throws Exception { + syncCreateSpokeStringSpokeString(); + } + + public static void syncCreateSpokeStringSpokeString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Spoke spoke = Spoke.newBuilder().build(); + String spokeId = "spokeId-1998996281"; + Spoke response = hubServiceClient.createSpokeAsync(parent, spoke, spokeId).get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_createspoke_stringspokestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletehub/AsyncDeleteHub.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletehub/AsyncDeleteHub.java new file mode 100644 index 00000000..3e8d5055 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletehub/AsyncDeleteHub.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_deletehub_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest; +import com.google.cloud.networkconnectivity.v1alpha1.HubName; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteHub { + + public static void main(String[] args) throws Exception { + asyncDeleteHub(); + } + + public static void asyncDeleteHub() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + DeleteHubRequest request = + DeleteHubRequest.newBuilder() + .setName(HubName.of("[PROJECT]", "[HUB]").toString()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = hubServiceClient.deleteHubCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_deletehub_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletehub/AsyncDeleteHubLRO.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletehub/AsyncDeleteHubLRO.java new file mode 100644 index 00000000..3bdef483 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletehub/AsyncDeleteHubLRO.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_deletehub_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest; +import com.google.cloud.networkconnectivity.v1alpha1.HubName; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.OperationMetadata; +import com.google.protobuf.Empty; + +public class AsyncDeleteHubLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteHubLRO(); + } + + public static void asyncDeleteHubLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + DeleteHubRequest request = + DeleteHubRequest.newBuilder() + .setName(HubName.of("[PROJECT]", "[HUB]").toString()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + hubServiceClient.deleteHubOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_deletehub_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletehub/SyncDeleteHub.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletehub/SyncDeleteHub.java new file mode 100644 index 00000000..72c4bba0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletehub/SyncDeleteHub.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_deletehub_sync] +import com.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest; +import com.google.cloud.networkconnectivity.v1alpha1.HubName; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteHub { + + public static void main(String[] args) throws Exception { + syncDeleteHub(); + } + + public static void syncDeleteHub() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + DeleteHubRequest request = + DeleteHubRequest.newBuilder() + .setName(HubName.of("[PROJECT]", "[HUB]").toString()) + .setRequestId("requestId693933066") + .build(); + hubServiceClient.deleteHubAsync(request).get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_deletehub_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletehub/SyncDeleteHubHubname.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletehub/SyncDeleteHubHubname.java new file mode 100644 index 00000000..263da65c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletehub/SyncDeleteHubHubname.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_deletehub_hubname_sync] +import com.google.cloud.networkconnectivity.v1alpha1.HubName; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteHubHubname { + + public static void main(String[] args) throws Exception { + syncDeleteHubHubname(); + } + + public static void syncDeleteHubHubname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + HubName name = HubName.of("[PROJECT]", "[HUB]"); + hubServiceClient.deleteHubAsync(name).get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_deletehub_hubname_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletehub/SyncDeleteHubString.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletehub/SyncDeleteHubString.java new file mode 100644 index 00000000..c67e0613 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletehub/SyncDeleteHubString.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_deletehub_string_sync] +import com.google.cloud.networkconnectivity.v1alpha1.HubName; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteHubString { + + public static void main(String[] args) throws Exception { + syncDeleteHubString(); + } + + public static void syncDeleteHubString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + String name = HubName.of("[PROJECT]", "[HUB]").toString(); + hubServiceClient.deleteHubAsync(name).get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_deletehub_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletespoke/AsyncDeleteSpoke.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletespoke/AsyncDeleteSpoke.java new file mode 100644 index 00000000..0a2b31d5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletespoke/AsyncDeleteSpoke.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_deletespoke_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.SpokeName; +import com.google.longrunning.Operation; + +public class AsyncDeleteSpoke { + + public static void main(String[] args) throws Exception { + asyncDeleteSpoke(); + } + + public static void asyncDeleteSpoke() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + DeleteSpokeRequest request = + DeleteSpokeRequest.newBuilder() + .setName(SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = hubServiceClient.deleteSpokeCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_deletespoke_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletespoke/AsyncDeleteSpokeLRO.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletespoke/AsyncDeleteSpokeLRO.java new file mode 100644 index 00000000..e68fe3aa --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletespoke/AsyncDeleteSpokeLRO.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_deletespoke_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.OperationMetadata; +import com.google.cloud.networkconnectivity.v1alpha1.SpokeName; +import com.google.protobuf.Empty; + +public class AsyncDeleteSpokeLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteSpokeLRO(); + } + + public static void asyncDeleteSpokeLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + DeleteSpokeRequest request = + DeleteSpokeRequest.newBuilder() + .setName(SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + hubServiceClient.deleteSpokeOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_deletespoke_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletespoke/SyncDeleteSpoke.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletespoke/SyncDeleteSpoke.java new file mode 100644 index 00000000..60ef478a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletespoke/SyncDeleteSpoke.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_deletespoke_sync] +import com.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.SpokeName; +import com.google.protobuf.Empty; + +public class SyncDeleteSpoke { + + public static void main(String[] args) throws Exception { + syncDeleteSpoke(); + } + + public static void syncDeleteSpoke() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + DeleteSpokeRequest request = + DeleteSpokeRequest.newBuilder() + .setName(SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString()) + .setRequestId("requestId693933066") + .build(); + hubServiceClient.deleteSpokeAsync(request).get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_deletespoke_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletespoke/SyncDeleteSpokeSpokename.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletespoke/SyncDeleteSpokeSpokename.java new file mode 100644 index 00000000..90319586 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletespoke/SyncDeleteSpokeSpokename.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_deletespoke_spokename_sync] +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.SpokeName; +import com.google.protobuf.Empty; + +public class SyncDeleteSpokeSpokename { + + public static void main(String[] args) throws Exception { + syncDeleteSpokeSpokename(); + } + + public static void syncDeleteSpokeSpokename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + SpokeName name = SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]"); + hubServiceClient.deleteSpokeAsync(name).get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_deletespoke_spokename_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletespoke/SyncDeleteSpokeString.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletespoke/SyncDeleteSpokeString.java new file mode 100644 index 00000000..3ca21840 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/deletespoke/SyncDeleteSpokeString.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_deletespoke_string_sync] +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.SpokeName; +import com.google.protobuf.Empty; + +public class SyncDeleteSpokeString { + + public static void main(String[] args) throws Exception { + syncDeleteSpokeString(); + } + + public static void syncDeleteSpokeString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + String name = SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString(); + hubServiceClient.deleteSpokeAsync(name).get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_deletespoke_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/gethub/AsyncGetHub.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/gethub/AsyncGetHub.java new file mode 100644 index 00000000..623ae49d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/gethub/AsyncGetHub.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_gethub_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.networkconnectivity.v1alpha1.GetHubRequest; +import com.google.cloud.networkconnectivity.v1alpha1.Hub; +import com.google.cloud.networkconnectivity.v1alpha1.HubName; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; + +public class AsyncGetHub { + + public static void main(String[] args) throws Exception { + asyncGetHub(); + } + + public static void asyncGetHub() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + GetHubRequest request = + GetHubRequest.newBuilder().setName(HubName.of("[PROJECT]", "[HUB]").toString()).build(); + ApiFuture future = hubServiceClient.getHubCallable().futureCall(request); + // Do something. + Hub response = future.get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_gethub_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/gethub/SyncGetHub.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/gethub/SyncGetHub.java new file mode 100644 index 00000000..e32c1239 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/gethub/SyncGetHub.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_gethub_sync] +import com.google.cloud.networkconnectivity.v1alpha1.GetHubRequest; +import com.google.cloud.networkconnectivity.v1alpha1.Hub; +import com.google.cloud.networkconnectivity.v1alpha1.HubName; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; + +public class SyncGetHub { + + public static void main(String[] args) throws Exception { + syncGetHub(); + } + + public static void syncGetHub() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + GetHubRequest request = + GetHubRequest.newBuilder().setName(HubName.of("[PROJECT]", "[HUB]").toString()).build(); + Hub response = hubServiceClient.getHub(request); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_gethub_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/gethub/SyncGetHubHubname.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/gethub/SyncGetHubHubname.java new file mode 100644 index 00000000..28e89f6f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/gethub/SyncGetHubHubname.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_gethub_hubname_sync] +import com.google.cloud.networkconnectivity.v1alpha1.Hub; +import com.google.cloud.networkconnectivity.v1alpha1.HubName; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; + +public class SyncGetHubHubname { + + public static void main(String[] args) throws Exception { + syncGetHubHubname(); + } + + public static void syncGetHubHubname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + HubName name = HubName.of("[PROJECT]", "[HUB]"); + Hub response = hubServiceClient.getHub(name); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_gethub_hubname_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/gethub/SyncGetHubString.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/gethub/SyncGetHubString.java new file mode 100644 index 00000000..f0016ed6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/gethub/SyncGetHubString.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_gethub_string_sync] +import com.google.cloud.networkconnectivity.v1alpha1.Hub; +import com.google.cloud.networkconnectivity.v1alpha1.HubName; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; + +public class SyncGetHubString { + + public static void main(String[] args) throws Exception { + syncGetHubString(); + } + + public static void syncGetHubString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + String name = HubName.of("[PROJECT]", "[HUB]").toString(); + Hub response = hubServiceClient.getHub(name); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_gethub_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/getspoke/AsyncGetSpoke.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/getspoke/AsyncGetSpoke.java new file mode 100644 index 00000000..095e30d9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/getspoke/AsyncGetSpoke.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_getspoke_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.Spoke; +import com.google.cloud.networkconnectivity.v1alpha1.SpokeName; + +public class AsyncGetSpoke { + + public static void main(String[] args) throws Exception { + asyncGetSpoke(); + } + + public static void asyncGetSpoke() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + GetSpokeRequest request = + GetSpokeRequest.newBuilder() + .setName(SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString()) + .build(); + ApiFuture future = hubServiceClient.getSpokeCallable().futureCall(request); + // Do something. + Spoke response = future.get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_getspoke_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/getspoke/SyncGetSpoke.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/getspoke/SyncGetSpoke.java new file mode 100644 index 00000000..39098970 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/getspoke/SyncGetSpoke.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_getspoke_sync] +import com.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.Spoke; +import com.google.cloud.networkconnectivity.v1alpha1.SpokeName; + +public class SyncGetSpoke { + + public static void main(String[] args) throws Exception { + syncGetSpoke(); + } + + public static void syncGetSpoke() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + GetSpokeRequest request = + GetSpokeRequest.newBuilder() + .setName(SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString()) + .build(); + Spoke response = hubServiceClient.getSpoke(request); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_getspoke_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/getspoke/SyncGetSpokeSpokename.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/getspoke/SyncGetSpokeSpokename.java new file mode 100644 index 00000000..24c20d58 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/getspoke/SyncGetSpokeSpokename.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_getspoke_spokename_sync] +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.Spoke; +import com.google.cloud.networkconnectivity.v1alpha1.SpokeName; + +public class SyncGetSpokeSpokename { + + public static void main(String[] args) throws Exception { + syncGetSpokeSpokename(); + } + + public static void syncGetSpokeSpokename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + SpokeName name = SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]"); + Spoke response = hubServiceClient.getSpoke(name); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_getspoke_spokename_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/getspoke/SyncGetSpokeString.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/getspoke/SyncGetSpokeString.java new file mode 100644 index 00000000..e396a135 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/getspoke/SyncGetSpokeString.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_getspoke_string_sync] +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.Spoke; +import com.google.cloud.networkconnectivity.v1alpha1.SpokeName; + +public class SyncGetSpokeString { + + public static void main(String[] args) throws Exception { + syncGetSpokeString(); + } + + public static void syncGetSpokeString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + String name = SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString(); + Spoke response = hubServiceClient.getSpoke(name); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_getspoke_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listhubs/AsyncListHubs.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listhubs/AsyncListHubs.java new file mode 100644 index 00000000..64e88473 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listhubs/AsyncListHubs.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_listhubs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.networkconnectivity.v1alpha1.Hub; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest; +import com.google.cloud.networkconnectivity.v1alpha1.LocationName; + +public class AsyncListHubs { + + public static void main(String[] args) throws Exception { + asyncListHubs(); + } + + public static void asyncListHubs() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + ListHubsRequest request = + ListHubsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = hubServiceClient.listHubsPagedCallable().futureCall(request); + // Do something. + for (Hub element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_listhubs_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listhubs/AsyncListHubsPaged.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listhubs/AsyncListHubsPaged.java new file mode 100644 index 00000000..a2b6a184 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listhubs/AsyncListHubsPaged.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_listhubs_paged_async] +import com.google.cloud.networkconnectivity.v1alpha1.Hub; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest; +import com.google.cloud.networkconnectivity.v1alpha1.ListHubsResponse; +import com.google.cloud.networkconnectivity.v1alpha1.LocationName; +import com.google.common.base.Strings; + +public class AsyncListHubsPaged { + + public static void main(String[] args) throws Exception { + asyncListHubsPaged(); + } + + public static void asyncListHubsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + ListHubsRequest request = + ListHubsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListHubsResponse response = hubServiceClient.listHubsCallable().call(request); + for (Hub element : response.getHubsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_listhubs_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listhubs/SyncListHubs.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listhubs/SyncListHubs.java new file mode 100644 index 00000000..a74c8ed0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listhubs/SyncListHubs.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_listhubs_sync] +import com.google.cloud.networkconnectivity.v1alpha1.Hub; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest; +import com.google.cloud.networkconnectivity.v1alpha1.LocationName; + +public class SyncListHubs { + + public static void main(String[] args) throws Exception { + syncListHubs(); + } + + public static void syncListHubs() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + ListHubsRequest request = + ListHubsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (Hub element : hubServiceClient.listHubs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_listhubs_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listhubs/SyncListHubsLocationname.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listhubs/SyncListHubsLocationname.java new file mode 100644 index 00000000..6f11aa8c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listhubs/SyncListHubsLocationname.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_listhubs_locationname_sync] +import com.google.cloud.networkconnectivity.v1alpha1.Hub; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.LocationName; + +public class SyncListHubsLocationname { + + public static void main(String[] args) throws Exception { + syncListHubsLocationname(); + } + + public static void syncListHubsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Hub element : hubServiceClient.listHubs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_listhubs_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listhubs/SyncListHubsString.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listhubs/SyncListHubsString.java new file mode 100644 index 00000000..fddea0d6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listhubs/SyncListHubsString.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_listhubs_string_sync] +import com.google.cloud.networkconnectivity.v1alpha1.Hub; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.LocationName; + +public class SyncListHubsString { + + public static void main(String[] args) throws Exception { + syncListHubsString(); + } + + public static void syncListHubsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Hub element : hubServiceClient.listHubs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_listhubs_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listspokes/AsyncListSpokes.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listspokes/AsyncListSpokes.java new file mode 100644 index 00000000..e9bab3fd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listspokes/AsyncListSpokes.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_listspokes_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest; +import com.google.cloud.networkconnectivity.v1alpha1.LocationName; +import com.google.cloud.networkconnectivity.v1alpha1.Spoke; + +public class AsyncListSpokes { + + public static void main(String[] args) throws Exception { + asyncListSpokes(); + } + + public static void asyncListSpokes() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + ListSpokesRequest request = + ListSpokesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = hubServiceClient.listSpokesPagedCallable().futureCall(request); + // Do something. + for (Spoke element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_listspokes_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listspokes/AsyncListSpokesPaged.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listspokes/AsyncListSpokesPaged.java new file mode 100644 index 00000000..cf62491f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listspokes/AsyncListSpokesPaged.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_listspokes_paged_async] +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest; +import com.google.cloud.networkconnectivity.v1alpha1.ListSpokesResponse; +import com.google.cloud.networkconnectivity.v1alpha1.LocationName; +import com.google.cloud.networkconnectivity.v1alpha1.Spoke; +import com.google.common.base.Strings; + +public class AsyncListSpokesPaged { + + public static void main(String[] args) throws Exception { + asyncListSpokesPaged(); + } + + public static void asyncListSpokesPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + ListSpokesRequest request = + ListSpokesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListSpokesResponse response = hubServiceClient.listSpokesCallable().call(request); + for (Spoke element : response.getSpokesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_listspokes_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listspokes/SyncListSpokes.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listspokes/SyncListSpokes.java new file mode 100644 index 00000000..f1a48606 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listspokes/SyncListSpokes.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_listspokes_sync] +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest; +import com.google.cloud.networkconnectivity.v1alpha1.LocationName; +import com.google.cloud.networkconnectivity.v1alpha1.Spoke; + +public class SyncListSpokes { + + public static void main(String[] args) throws Exception { + syncListSpokes(); + } + + public static void syncListSpokes() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + ListSpokesRequest request = + ListSpokesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (Spoke element : hubServiceClient.listSpokes(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_listspokes_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listspokes/SyncListSpokesLocationname.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listspokes/SyncListSpokesLocationname.java new file mode 100644 index 00000000..c248998b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listspokes/SyncListSpokesLocationname.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_listspokes_locationname_sync] +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.LocationName; +import com.google.cloud.networkconnectivity.v1alpha1.Spoke; + +public class SyncListSpokesLocationname { + + public static void main(String[] args) throws Exception { + syncListSpokesLocationname(); + } + + public static void syncListSpokesLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Spoke element : hubServiceClient.listSpokes(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_listspokes_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listspokes/SyncListSpokesString.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listspokes/SyncListSpokesString.java new file mode 100644 index 00000000..a0b5f2f3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/listspokes/SyncListSpokesString.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_listspokes_string_sync] +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.LocationName; +import com.google.cloud.networkconnectivity.v1alpha1.Spoke; + +public class SyncListSpokesString { + + public static void main(String[] args) throws Exception { + syncListSpokesString(); + } + + public static void syncListSpokesString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Spoke element : hubServiceClient.listSpokes(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_listspokes_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatehub/AsyncUpdateHub.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatehub/AsyncUpdateHub.java new file mode 100644 index 00000000..6376e418 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatehub/AsyncUpdateHub.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_updatehub_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.networkconnectivity.v1alpha1.Hub; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateHub { + + public static void main(String[] args) throws Exception { + asyncUpdateHub(); + } + + public static void asyncUpdateHub() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + UpdateHubRequest request = + UpdateHubRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setHub(Hub.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = hubServiceClient.updateHubCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_updatehub_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatehub/AsyncUpdateHubLRO.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatehub/AsyncUpdateHubLRO.java new file mode 100644 index 00000000..860fa82f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatehub/AsyncUpdateHubLRO.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_updatehub_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.networkconnectivity.v1alpha1.Hub; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.OperationMetadata; +import com.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateHubLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateHubLRO(); + } + + public static void asyncUpdateHubLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + UpdateHubRequest request = + UpdateHubRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setHub(Hub.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + hubServiceClient.updateHubOperationCallable().futureCall(request); + // Do something. + Hub response = future.get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_updatehub_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatehub/SyncUpdateHub.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatehub/SyncUpdateHub.java new file mode 100644 index 00000000..89bb0164 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatehub/SyncUpdateHub.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_updatehub_sync] +import com.google.cloud.networkconnectivity.v1alpha1.Hub; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateHub { + + public static void main(String[] args) throws Exception { + syncUpdateHub(); + } + + public static void syncUpdateHub() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + UpdateHubRequest request = + UpdateHubRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setHub(Hub.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + Hub response = hubServiceClient.updateHubAsync(request).get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_updatehub_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatehub/SyncUpdateHubHubFieldmask.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatehub/SyncUpdateHubHubFieldmask.java new file mode 100644 index 00000000..5e8021d3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatehub/SyncUpdateHubHubFieldmask.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_updatehub_hubfieldmask_sync] +import com.google.cloud.networkconnectivity.v1alpha1.Hub; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateHubHubFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateHubHubFieldmask(); + } + + public static void syncUpdateHubHubFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + Hub hub = Hub.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Hub response = hubServiceClient.updateHubAsync(hub, updateMask).get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_updatehub_hubfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatespoke/AsyncUpdateSpoke.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatespoke/AsyncUpdateSpoke.java new file mode 100644 index 00000000..c87a1dfb --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatespoke/AsyncUpdateSpoke.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_updatespoke_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.Spoke; +import com.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateSpoke { + + public static void main(String[] args) throws Exception { + asyncUpdateSpoke(); + } + + public static void asyncUpdateSpoke() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + UpdateSpokeRequest request = + UpdateSpokeRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setSpoke(Spoke.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = hubServiceClient.updateSpokeCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_updatespoke_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatespoke/AsyncUpdateSpokeLRO.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatespoke/AsyncUpdateSpokeLRO.java new file mode 100644 index 00000000..fb779239 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatespoke/AsyncUpdateSpokeLRO.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_updatespoke_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.OperationMetadata; +import com.google.cloud.networkconnectivity.v1alpha1.Spoke; +import com.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateSpokeLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateSpokeLRO(); + } + + public static void asyncUpdateSpokeLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + UpdateSpokeRequest request = + UpdateSpokeRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setSpoke(Spoke.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + hubServiceClient.updateSpokeOperationCallable().futureCall(request); + // Do something. + Spoke response = future.get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_updatespoke_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatespoke/SyncUpdateSpoke.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatespoke/SyncUpdateSpoke.java new file mode 100644 index 00000000..6f73e417 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatespoke/SyncUpdateSpoke.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_updatespoke_sync] +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.Spoke; +import com.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateSpoke { + + public static void main(String[] args) throws Exception { + syncUpdateSpoke(); + } + + public static void syncUpdateSpoke() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + UpdateSpokeRequest request = + UpdateSpokeRequest.newBuilder() + .setUpdateMask(FieldMask.newBuilder().build()) + .setSpoke(Spoke.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + Spoke response = hubServiceClient.updateSpokeAsync(request).get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_updatespoke_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatespoke/SyncUpdateSpokeSpokeFieldmask.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatespoke/SyncUpdateSpokeSpokeFieldmask.java new file mode 100644 index 00000000..e8d03127 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubserviceclient/updatespoke/SyncUpdateSpokeSpokeFieldmask.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubserviceclient_updatespoke_spokefieldmask_sync] +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient; +import com.google.cloud.networkconnectivity.v1alpha1.Spoke; +import com.google.protobuf.FieldMask; + +public class SyncUpdateSpokeSpokeFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateSpokeSpokeFieldmask(); + } + + public static void syncUpdateSpokeSpokeFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (HubServiceClient hubServiceClient = HubServiceClient.create()) { + Spoke spoke = Spoke.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Spoke response = hubServiceClient.updateSpokeAsync(spoke, updateMask).get(); + } + } +} +// [END networkconnectivity_v1alpha1_generated_hubserviceclient_updatespoke_spokefieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubservicesettings/gethub/SyncGetHub.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubservicesettings/gethub/SyncGetHub.java new file mode 100644 index 00000000..1a609680 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/hubservicesettings/gethub/SyncGetHub.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.networkconnectivity.v1alpha1.samples; + +// [START networkconnectivity_v1alpha1_generated_hubservicesettings_gethub_sync] +import com.google.cloud.networkconnectivity.v1alpha1.HubServiceSettings; +import java.time.Duration; + +public class SyncGetHub { + + public static void main(String[] args) throws Exception { + syncGetHub(); + } + + public static void syncGetHub() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + HubServiceSettings.Builder hubServiceSettingsBuilder = HubServiceSettings.newBuilder(); + hubServiceSettingsBuilder + .getHubSettings() + .setRetrySettings( + hubServiceSettingsBuilder + .getHubSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + HubServiceSettings hubServiceSettings = hubServiceSettingsBuilder.build(); + } +} +// [END networkconnectivity_v1alpha1_generated_hubservicesettings_gethub_sync] diff --git a/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/stub/hubservicestubsettings/gethub/SyncGetHub.java b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/stub/hubservicestubsettings/gethub/SyncGetHub.java new file mode 100644 index 00000000..09d608b4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/networkconnectivity/v1alpha1/stub/hubservicestubsettings/gethub/SyncGetHub.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.networkconnectivity.v1alpha1.stub.samples; + +// [START networkconnectivity_v1alpha1_generated_hubservicestubsettings_gethub_sync] +import com.google.cloud.networkconnectivity.v1alpha1.stub.HubServiceStubSettings; +import java.time.Duration; + +public class SyncGetHub { + + public static void main(String[] args) throws Exception { + syncGetHub(); + } + + public static void syncGetHub() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + HubServiceStubSettings.Builder hubServiceSettingsBuilder = HubServiceStubSettings.newBuilder(); + hubServiceSettingsBuilder + .getHubSettings() + .setRetrySettings( + hubServiceSettingsBuilder + .getHubSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + HubServiceStubSettings hubServiceSettings = hubServiceSettingsBuilder.build(); + } +} +// [END networkconnectivity_v1alpha1_generated_hubservicestubsettings_gethub_sync] diff --git a/versions.txt b/versions.txt index 196a48f6..0228a784 100644 --- a/versions.txt +++ b/versions.txt @@ -1,8 +1,8 @@ # Format: # module:released-version:current-version -google-cloud-networkconnectivity:1.2.2:1.2.2 -grpc-google-cloud-networkconnectivity-v1alpha1:0.8.2:0.8.2 -grpc-google-cloud-networkconnectivity-v1:1.2.2:1.2.2 -proto-google-cloud-networkconnectivity-v1alpha1:0.8.2:0.8.2 -proto-google-cloud-networkconnectivity-v1:1.2.2:1.2.2 +google-cloud-networkconnectivity:1.2.3:1.2.3 +grpc-google-cloud-networkconnectivity-v1alpha1:0.8.3:0.8.3 +grpc-google-cloud-networkconnectivity-v1:1.2.3:1.2.3 +proto-google-cloud-networkconnectivity-v1alpha1:0.8.3:0.8.3 +proto-google-cloud-networkconnectivity-v1:1.2.3:1.2.3