diff --git a/README.md b/README.md index 03b9906..14a8978 100644 --- a/README.md +++ b/README.md @@ -22,20 +22,20 @@ If you are using Maven, add this to your pom.xml file: com.google.cloud google-cloud-gke-multi-cloud - 0.1.0 + 0.1.1 ``` If you are using Gradle without BOM, add this to your dependencies ```Groovy -implementation 'com.google.cloud:google-cloud-gke-multi-cloud:0.1.0' +implementation 'com.google.cloud:google-cloud-gke-multi-cloud:0.1.1' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-gke-multi-cloud" % "0.1.0" +libraryDependencies += "com.google.cloud" % "google-cloud-gke-multi-cloud" % "0.1.1" ``` ## Authentication diff --git a/google-cloud-gke-multi-cloud/pom.xml b/google-cloud-gke-multi-cloud/pom.xml index 6d6e960..908696b 100644 --- a/google-cloud-gke-multi-cloud/pom.xml +++ b/google-cloud-gke-multi-cloud/pom.xml @@ -58,6 +58,10 @@ com.google.api gax-grpc + + com.google.api + gax-httpjson + org.threeten threetenbp @@ -77,12 +81,24 @@ test + + com.google.api + gax + testlib + test + com.google.api gax-grpc testlib test + + com.google.api + gax-httpjson + testlib + test + diff --git a/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AwsClustersClient.java b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AwsClustersClient.java index fe73a5a..b03b742 100644 --- a/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AwsClustersClient.java +++ b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AwsClustersClient.java @@ -19,6 +19,7 @@ import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutures; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.longrunning.OperationsClient; import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; @@ -30,7 +31,6 @@ import com.google.cloud.gkemulticloud.v1.stub.AwsClustersStubSettings; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; -import com.google.longrunning.OperationsClient; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import java.io.IOException; @@ -103,13 +103,28 @@ * AwsClustersClient awsClustersClient = AwsClustersClient.create(awsClustersSettings); * } * + *

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

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

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") public class AwsClustersClient implements BackgroundResource { private final AwsClustersSettings settings; private final AwsClustersStub stub; - private final OperationsClient operationsClient; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of AwsClustersClient with default settings. */ public static final AwsClustersClient create() throws IOException { @@ -140,13 +155,17 @@ public static final AwsClustersClient create(AwsClustersStub stub) { protected AwsClustersClient(AwsClustersSettings settings) throws IOException { this.settings = settings; this.stub = ((AwsClustersStubSettings) settings.getStubSettings()).createStub(); - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } protected AwsClustersClient(AwsClustersStub stub) { this.settings = null; this.stub = stub; - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } public final AwsClustersSettings getSettings() { @@ -161,10 +180,18 @@ public AwsClustersStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - public final OperationsClient getOperationsClient() { + public final com.google.longrunning.OperationsClient getOperationsClient() { return operationsClient; } + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final OperationsClient getHttpJsonOperationsClient() { + return httpJsonOperationsClient; + } + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster] resource on a given GCP diff --git a/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AwsClustersSettings.java b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AwsClustersSettings.java index 2361c6d..5a8579a 100644 --- a/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AwsClustersSettings.java +++ b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AwsClustersSettings.java @@ -24,6 +24,7 @@ import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; @@ -200,11 +201,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return AwsClustersStubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return AwsClustersStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return AwsClustersStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return AwsClustersStubSettings.defaultTransportChannelProvider(); } @@ -214,11 +222,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return AwsClustersStubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -256,6 +270,11 @@ private static Builder createDefault() { return new Builder(AwsClustersStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(AwsClustersStubSettings.newHttpJsonBuilder()); + } + public AwsClustersStubSettings.Builder getStubSettingsBuilder() { return ((AwsClustersStubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AzureClustersClient.java b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AzureClustersClient.java index 91e8551..bc36485 100644 --- a/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AzureClustersClient.java +++ b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AzureClustersClient.java @@ -19,6 +19,7 @@ import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutures; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.longrunning.OperationsClient; import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; @@ -30,7 +31,6 @@ import com.google.cloud.gkemulticloud.v1.stub.AzureClustersStubSettings; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; -import com.google.longrunning.OperationsClient; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import java.io.IOException; @@ -103,13 +103,28 @@ * AzureClustersClient azureClustersClient = AzureClustersClient.create(azureClustersSettings); * } * + *

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

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

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") public class AzureClustersClient implements BackgroundResource { private final AzureClustersSettings settings; private final AzureClustersStub stub; - private final OperationsClient operationsClient; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of AzureClustersClient with default settings. */ public static final AzureClustersClient create() throws IOException { @@ -141,13 +156,17 @@ public static final AzureClustersClient create(AzureClustersStub stub) { protected AzureClustersClient(AzureClustersSettings settings) throws IOException { this.settings = settings; this.stub = ((AzureClustersStubSettings) settings.getStubSettings()).createStub(); - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } protected AzureClustersClient(AzureClustersStub stub) { this.settings = null; this.stub = stub; - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } public final AzureClustersSettings getSettings() { @@ -162,10 +181,18 @@ public AzureClustersStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - public final OperationsClient getOperationsClient() { + public final com.google.longrunning.OperationsClient getOperationsClient() { return operationsClient; } + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final OperationsClient getHttpJsonOperationsClient() { + return httpJsonOperationsClient; + } + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new [AzureClient][google.cloud.gkemulticloud.v1.AzureClient] resource on a given diff --git a/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AzureClustersSettings.java b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AzureClustersSettings.java index 9d08bfd..77c4b90 100644 --- a/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AzureClustersSettings.java +++ b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AzureClustersSettings.java @@ -25,6 +25,7 @@ import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; @@ -236,11 +237,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return AzureClustersStubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return AzureClustersStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return AzureClustersStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return AzureClustersStubSettings.defaultTransportChannelProvider(); } @@ -250,11 +258,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return AzureClustersStubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -292,6 +306,11 @@ private static Builder createDefault() { return new Builder(AzureClustersStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(AzureClustersStubSettings.newHttpJsonBuilder()); + } + public AzureClustersStubSettings.Builder getStubSettingsBuilder() { return ((AzureClustersStubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AwsClustersStub.java b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AwsClustersStub.java index fac79eb..0c26029 100644 --- a/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AwsClustersStub.java +++ b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AwsClustersStub.java @@ -56,7 +56,11 @@ public abstract class AwsClustersStub implements BackgroundResource { public OperationsStub getOperationsStub() { - throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); + return null; + } + + public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { + return null; } public OperationCallable diff --git a/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AwsClustersStubSettings.java b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AwsClustersStubSettings.java index eeaa39c..2a33709 100644 --- a/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AwsClustersStubSettings.java +++ b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AwsClustersStubSettings.java @@ -29,6 +29,9 @@ import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; import com.google.api.gax.grpc.ProtoOperationTransformers; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.longrunning.OperationSnapshot; import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; import com.google.api.gax.retrying.RetrySettings; @@ -369,6 +372,11 @@ public AwsClustersStub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcAwsClustersStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonAwsClustersStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -401,18 +409,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde .setUseJwtAccessWithScope(true); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return InstantiatingGrpcChannelProvider.newBuilder() .setMaxInboundMessageSize(Integer.MAX_VALUE); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return defaultGrpcTransportProviderBuilder().build(); } @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken( "gapic", GaxProperties.getLibraryVersion(AwsClustersStubSettings.class)) @@ -420,11 +435,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } - /** Returns a new builder for this class. */ + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(AwsClustersStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return AwsClustersStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -641,6 +675,19 @@ private static Builder createDefault() { return initDefaults(builder); } + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + private static Builder initDefaults(Builder builder) { builder .createAwsClusterSettings() diff --git a/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AzureClustersStub.java b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AzureClustersStub.java index a3ade7e..e3f73eb 100644 --- a/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AzureClustersStub.java +++ b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AzureClustersStub.java @@ -63,7 +63,11 @@ public abstract class AzureClustersStub implements BackgroundResource { public OperationsStub getOperationsStub() { - throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); + return null; + } + + public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { + return null; } public OperationCallable diff --git a/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AzureClustersStubSettings.java b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AzureClustersStubSettings.java index 8d13287..359848f 100644 --- a/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AzureClustersStubSettings.java +++ b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AzureClustersStubSettings.java @@ -30,6 +30,9 @@ import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; import com.google.api.gax.grpc.ProtoOperationTransformers; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.longrunning.OperationSnapshot; import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; import com.google.api.gax.retrying.RetrySettings; @@ -489,6 +492,11 @@ public AzureClustersStub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcAzureClustersStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonAzureClustersStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -521,18 +529,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde .setUseJwtAccessWithScope(true); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return InstantiatingGrpcChannelProvider.newBuilder() .setMaxInboundMessageSize(Integer.MAX_VALUE); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return defaultGrpcTransportProviderBuilder().build(); } @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken( "gapic", GaxProperties.getLibraryVersion(AzureClustersStubSettings.class)) @@ -540,11 +555,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } - /** Returns a new builder for this class. */ + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(AzureClustersStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return AzureClustersStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -815,6 +849,19 @@ private static Builder createDefault() { return initDefaults(builder); } + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + private static Builder initDefaults(Builder builder) { builder .createAzureClientSettings() diff --git a/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/HttpJsonAwsClustersCallableFactory.java b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/HttpJsonAwsClustersCallableFactory.java new file mode 100644 index 0000000..9a5a634 --- /dev/null +++ b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/HttpJsonAwsClustersCallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the AwsClusters service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonAwsClustersCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/HttpJsonAwsClustersStub.java b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/HttpJsonAwsClustersStub.java new file mode 100644 index 0000000..7bf2af1 --- /dev/null +++ b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/HttpJsonAwsClustersStub.java @@ -0,0 +1,946 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.stub; + +import static com.google.cloud.gkemulticloud.v1.AwsClustersClient.ListAwsClustersPagedResponse; +import static com.google.cloud.gkemulticloud.v1.AwsClustersClient.ListAwsNodePoolsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshot; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.gkemulticloud.v1.AwsCluster; +import com.google.cloud.gkemulticloud.v1.AwsNodePool; +import com.google.cloud.gkemulticloud.v1.AwsServerConfig; +import com.google.cloud.gkemulticloud.v1.CreateAwsClusterRequest; +import com.google.cloud.gkemulticloud.v1.CreateAwsNodePoolRequest; +import com.google.cloud.gkemulticloud.v1.DeleteAwsClusterRequest; +import com.google.cloud.gkemulticloud.v1.DeleteAwsNodePoolRequest; +import com.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenRequest; +import com.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenResponse; +import com.google.cloud.gkemulticloud.v1.GetAwsClusterRequest; +import com.google.cloud.gkemulticloud.v1.GetAwsNodePoolRequest; +import com.google.cloud.gkemulticloud.v1.GetAwsServerConfigRequest; +import com.google.cloud.gkemulticloud.v1.ListAwsClustersRequest; +import com.google.cloud.gkemulticloud.v1.ListAwsClustersResponse; +import com.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest; +import com.google.cloud.gkemulticloud.v1.ListAwsNodePoolsResponse; +import com.google.cloud.gkemulticloud.v1.OperationMetadata; +import com.google.cloud.gkemulticloud.v1.UpdateAwsClusterRequest; +import com.google.cloud.gkemulticloud.v1.UpdateAwsNodePoolRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.Empty; +import com.google.protobuf.TypeRegistry; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the AwsClusters service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonAwsClustersStub extends AwsClustersStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(OperationMetadata.getDescriptor()) + .add(Empty.getDescriptor()) + .add(AwsCluster.getDescriptor()) + .add(AwsNodePool.getDescriptor()) + .build(); + + private static final ApiMethodDescriptor + createAwsClusterMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AwsClusters/CreateAwsCluster") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/awsClusters", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "awsClusterId", request.getAwsClusterId()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("awsCluster", request.getAwsCluster())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateAwsClusterRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + updateAwsClusterMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AwsClusters/UpdateAwsCluster") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{awsCluster.name=projects/*/locations/*/awsClusters/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "awsCluster.name", request.getAwsCluster().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("awsCluster", request.getAwsCluster())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateAwsClusterRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + getAwsClusterMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AwsClusters/GetAwsCluster") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/awsClusters/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AwsCluster.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listAwsClustersMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AwsClusters/ListAwsClusters") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/awsClusters", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListAwsClustersResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteAwsClusterMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AwsClusters/DeleteAwsCluster") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/awsClusters/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "allowMissing", request.getAllowMissing()); + serializer.putQueryParam(fields, "etag", request.getEtag()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteAwsClusterRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor< + GenerateAwsAccessTokenRequest, GenerateAwsAccessTokenResponse> + generateAwsAccessTokenMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AwsClusters/GenerateAwsAccessToken") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{awsCluster=projects/*/locations/*/awsClusters/*}:generateAwsAccessToken", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "awsCluster", request.getAwsCluster()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(GenerateAwsAccessTokenResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createAwsNodePoolMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AwsClusters/CreateAwsNodePool") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*/awsClusters/*}/awsNodePools", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "awsNodePoolId", request.getAwsNodePoolId()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("awsNodePool", request.getAwsNodePool())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateAwsNodePoolRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + updateAwsNodePoolMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AwsClusters/UpdateAwsNodePool") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{awsNodePool.name=projects/*/locations/*/awsClusters/*/awsNodePools/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "awsNodePool.name", request.getAwsNodePool().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("awsNodePool", request.getAwsNodePool())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateAwsNodePoolRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + getAwsNodePoolMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AwsClusters/GetAwsNodePool") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/awsClusters/*/awsNodePools/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AwsNodePool.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listAwsNodePoolsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AwsClusters/ListAwsNodePools") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*/awsClusters/*}/awsNodePools", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListAwsNodePoolsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteAwsNodePoolMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AwsClusters/DeleteAwsNodePool") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/awsClusters/*/awsNodePools/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "allowMissing", request.getAllowMissing()); + serializer.putQueryParam(fields, "etag", request.getEtag()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteAwsNodePoolRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + getAwsServerConfigMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AwsClusters/GetAwsServerConfig") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/awsServerConfig}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AwsServerConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable createAwsClusterCallable; + private final OperationCallable + createAwsClusterOperationCallable; + private final UnaryCallable updateAwsClusterCallable; + private final OperationCallable + updateAwsClusterOperationCallable; + private final UnaryCallable getAwsClusterCallable; + private final UnaryCallable + listAwsClustersCallable; + private final UnaryCallable + listAwsClustersPagedCallable; + private final UnaryCallable deleteAwsClusterCallable; + private final OperationCallable + deleteAwsClusterOperationCallable; + private final UnaryCallable + generateAwsAccessTokenCallable; + private final UnaryCallable createAwsNodePoolCallable; + private final OperationCallable + createAwsNodePoolOperationCallable; + private final UnaryCallable updateAwsNodePoolCallable; + private final OperationCallable + updateAwsNodePoolOperationCallable; + private final UnaryCallable getAwsNodePoolCallable; + private final UnaryCallable + listAwsNodePoolsCallable; + private final UnaryCallable + listAwsNodePoolsPagedCallable; + private final UnaryCallable deleteAwsNodePoolCallable; + private final OperationCallable + deleteAwsNodePoolOperationCallable; + private final UnaryCallable + getAwsServerConfigCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonAwsClustersStub create(AwsClustersStubSettings settings) + throws IOException { + return new HttpJsonAwsClustersStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonAwsClustersStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonAwsClustersStub( + AwsClustersStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonAwsClustersStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonAwsClustersStub( + AwsClustersStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonAwsClustersStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonAwsClustersStub(AwsClustersStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonAwsClustersCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonAwsClustersStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonAwsClustersStub( + AwsClustersStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings createAwsClusterTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createAwsClusterMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateAwsClusterTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateAwsClusterMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getAwsClusterTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getAwsClusterMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listAwsClustersTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listAwsClustersMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteAwsClusterTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteAwsClusterMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + generateAwsAccessTokenTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(generateAwsAccessTokenMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings createAwsNodePoolTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createAwsNodePoolMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateAwsNodePoolTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateAwsNodePoolMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getAwsNodePoolTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getAwsNodePoolMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listAwsNodePoolsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listAwsNodePoolsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteAwsNodePoolTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteAwsNodePoolMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getAwsServerConfigTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getAwsServerConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.createAwsClusterCallable = + callableFactory.createUnaryCallable( + createAwsClusterTransportSettings, settings.createAwsClusterSettings(), clientContext); + this.createAwsClusterOperationCallable = + callableFactory.createOperationCallable( + createAwsClusterTransportSettings, + settings.createAwsClusterOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.updateAwsClusterCallable = + callableFactory.createUnaryCallable( + updateAwsClusterTransportSettings, settings.updateAwsClusterSettings(), clientContext); + this.updateAwsClusterOperationCallable = + callableFactory.createOperationCallable( + updateAwsClusterTransportSettings, + settings.updateAwsClusterOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getAwsClusterCallable = + callableFactory.createUnaryCallable( + getAwsClusterTransportSettings, settings.getAwsClusterSettings(), clientContext); + this.listAwsClustersCallable = + callableFactory.createUnaryCallable( + listAwsClustersTransportSettings, settings.listAwsClustersSettings(), clientContext); + this.listAwsClustersPagedCallable = + callableFactory.createPagedCallable( + listAwsClustersTransportSettings, settings.listAwsClustersSettings(), clientContext); + this.deleteAwsClusterCallable = + callableFactory.createUnaryCallable( + deleteAwsClusterTransportSettings, settings.deleteAwsClusterSettings(), clientContext); + this.deleteAwsClusterOperationCallable = + callableFactory.createOperationCallable( + deleteAwsClusterTransportSettings, + settings.deleteAwsClusterOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.generateAwsAccessTokenCallable = + callableFactory.createUnaryCallable( + generateAwsAccessTokenTransportSettings, + settings.generateAwsAccessTokenSettings(), + clientContext); + this.createAwsNodePoolCallable = + callableFactory.createUnaryCallable( + createAwsNodePoolTransportSettings, + settings.createAwsNodePoolSettings(), + clientContext); + this.createAwsNodePoolOperationCallable = + callableFactory.createOperationCallable( + createAwsNodePoolTransportSettings, + settings.createAwsNodePoolOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.updateAwsNodePoolCallable = + callableFactory.createUnaryCallable( + updateAwsNodePoolTransportSettings, + settings.updateAwsNodePoolSettings(), + clientContext); + this.updateAwsNodePoolOperationCallable = + callableFactory.createOperationCallable( + updateAwsNodePoolTransportSettings, + settings.updateAwsNodePoolOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getAwsNodePoolCallable = + callableFactory.createUnaryCallable( + getAwsNodePoolTransportSettings, settings.getAwsNodePoolSettings(), clientContext); + this.listAwsNodePoolsCallable = + callableFactory.createUnaryCallable( + listAwsNodePoolsTransportSettings, settings.listAwsNodePoolsSettings(), clientContext); + this.listAwsNodePoolsPagedCallable = + callableFactory.createPagedCallable( + listAwsNodePoolsTransportSettings, settings.listAwsNodePoolsSettings(), clientContext); + this.deleteAwsNodePoolCallable = + callableFactory.createUnaryCallable( + deleteAwsNodePoolTransportSettings, + settings.deleteAwsNodePoolSettings(), + clientContext); + this.deleteAwsNodePoolOperationCallable = + callableFactory.createOperationCallable( + deleteAwsNodePoolTransportSettings, + settings.deleteAwsNodePoolOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getAwsServerConfigCallable = + callableFactory.createUnaryCallable( + getAwsServerConfigTransportSettings, + settings.getAwsServerConfigSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(createAwsClusterMethodDescriptor); + methodDescriptors.add(updateAwsClusterMethodDescriptor); + methodDescriptors.add(getAwsClusterMethodDescriptor); + methodDescriptors.add(listAwsClustersMethodDescriptor); + methodDescriptors.add(deleteAwsClusterMethodDescriptor); + methodDescriptors.add(generateAwsAccessTokenMethodDescriptor); + methodDescriptors.add(createAwsNodePoolMethodDescriptor); + methodDescriptors.add(updateAwsNodePoolMethodDescriptor); + methodDescriptors.add(getAwsNodePoolMethodDescriptor); + methodDescriptors.add(listAwsNodePoolsMethodDescriptor); + methodDescriptors.add(deleteAwsNodePoolMethodDescriptor); + methodDescriptors.add(getAwsServerConfigMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable createAwsClusterCallable() { + return createAwsClusterCallable; + } + + @Override + public OperationCallable + createAwsClusterOperationCallable() { + return createAwsClusterOperationCallable; + } + + @Override + public UnaryCallable updateAwsClusterCallable() { + return updateAwsClusterCallable; + } + + @Override + public OperationCallable + updateAwsClusterOperationCallable() { + return updateAwsClusterOperationCallable; + } + + @Override + public UnaryCallable getAwsClusterCallable() { + return getAwsClusterCallable; + } + + @Override + public UnaryCallable listAwsClustersCallable() { + return listAwsClustersCallable; + } + + @Override + public UnaryCallable + listAwsClustersPagedCallable() { + return listAwsClustersPagedCallable; + } + + @Override + public UnaryCallable deleteAwsClusterCallable() { + return deleteAwsClusterCallable; + } + + @Override + public OperationCallable + deleteAwsClusterOperationCallable() { + return deleteAwsClusterOperationCallable; + } + + @Override + public UnaryCallable + generateAwsAccessTokenCallable() { + return generateAwsAccessTokenCallable; + } + + @Override + public UnaryCallable createAwsNodePoolCallable() { + return createAwsNodePoolCallable; + } + + @Override + public OperationCallable + createAwsNodePoolOperationCallable() { + return createAwsNodePoolOperationCallable; + } + + @Override + public UnaryCallable updateAwsNodePoolCallable() { + return updateAwsNodePoolCallable; + } + + @Override + public OperationCallable + updateAwsNodePoolOperationCallable() { + return updateAwsNodePoolOperationCallable; + } + + @Override + public UnaryCallable getAwsNodePoolCallable() { + return getAwsNodePoolCallable; + } + + @Override + public UnaryCallable + listAwsNodePoolsCallable() { + return listAwsNodePoolsCallable; + } + + @Override + public UnaryCallable + listAwsNodePoolsPagedCallable() { + return listAwsNodePoolsPagedCallable; + } + + @Override + public UnaryCallable deleteAwsNodePoolCallable() { + return deleteAwsNodePoolCallable; + } + + @Override + public OperationCallable + deleteAwsNodePoolOperationCallable() { + return deleteAwsNodePoolOperationCallable; + } + + @Override + public UnaryCallable getAwsServerConfigCallable() { + return getAwsServerConfigCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/HttpJsonAzureClustersCallableFactory.java b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/HttpJsonAzureClustersCallableFactory.java new file mode 100644 index 0000000..39086ef --- /dev/null +++ b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/HttpJsonAzureClustersCallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the AzureClusters service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonAzureClustersCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/HttpJsonAzureClustersStub.java b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/HttpJsonAzureClustersStub.java new file mode 100644 index 0000000..6855663 --- /dev/null +++ b/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/HttpJsonAzureClustersStub.java @@ -0,0 +1,1232 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.stub; + +import static com.google.cloud.gkemulticloud.v1.AzureClustersClient.ListAzureClientsPagedResponse; +import static com.google.cloud.gkemulticloud.v1.AzureClustersClient.ListAzureClustersPagedResponse; +import static com.google.cloud.gkemulticloud.v1.AzureClustersClient.ListAzureNodePoolsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshot; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.gkemulticloud.v1.AzureClient; +import com.google.cloud.gkemulticloud.v1.AzureCluster; +import com.google.cloud.gkemulticloud.v1.AzureNodePool; +import com.google.cloud.gkemulticloud.v1.AzureServerConfig; +import com.google.cloud.gkemulticloud.v1.CreateAzureClientRequest; +import com.google.cloud.gkemulticloud.v1.CreateAzureClusterRequest; +import com.google.cloud.gkemulticloud.v1.CreateAzureNodePoolRequest; +import com.google.cloud.gkemulticloud.v1.DeleteAzureClientRequest; +import com.google.cloud.gkemulticloud.v1.DeleteAzureClusterRequest; +import com.google.cloud.gkemulticloud.v1.DeleteAzureNodePoolRequest; +import com.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenRequest; +import com.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenResponse; +import com.google.cloud.gkemulticloud.v1.GetAzureClientRequest; +import com.google.cloud.gkemulticloud.v1.GetAzureClusterRequest; +import com.google.cloud.gkemulticloud.v1.GetAzureNodePoolRequest; +import com.google.cloud.gkemulticloud.v1.GetAzureServerConfigRequest; +import com.google.cloud.gkemulticloud.v1.ListAzureClientsRequest; +import com.google.cloud.gkemulticloud.v1.ListAzureClientsResponse; +import com.google.cloud.gkemulticloud.v1.ListAzureClustersRequest; +import com.google.cloud.gkemulticloud.v1.ListAzureClustersResponse; +import com.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest; +import com.google.cloud.gkemulticloud.v1.ListAzureNodePoolsResponse; +import com.google.cloud.gkemulticloud.v1.OperationMetadata; +import com.google.cloud.gkemulticloud.v1.UpdateAzureClusterRequest; +import com.google.cloud.gkemulticloud.v1.UpdateAzureNodePoolRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.Empty; +import com.google.protobuf.TypeRegistry; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the AzureClusters service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonAzureClustersStub extends AzureClustersStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(OperationMetadata.getDescriptor()) + .add(Empty.getDescriptor()) + .add(AzureNodePool.getDescriptor()) + .add(AzureCluster.getDescriptor()) + .add(AzureClient.getDescriptor()) + .build(); + + private static final ApiMethodDescriptor + createAzureClientMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AzureClusters/CreateAzureClient") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/azureClients", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "azureClientId", request.getAzureClientId()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("azureClient", request.getAzureClient())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateAzureClientRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + getAzureClientMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AzureClusters/GetAzureClient") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/azureClients/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AzureClient.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listAzureClientsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AzureClusters/ListAzureClients") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/azureClients", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListAzureClientsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteAzureClientMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AzureClusters/DeleteAzureClient") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/azureClients/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "allowMissing", request.getAllowMissing()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteAzureClientRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + createAzureClusterMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AzureClusters/CreateAzureCluster") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/azureClusters", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "azureClusterId", request.getAzureClusterId()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("azureCluster", request.getAzureCluster())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateAzureClusterRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + updateAzureClusterMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AzureClusters/UpdateAzureCluster") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{azureCluster.name=projects/*/locations/*/azureClusters/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "azureCluster.name", request.getAzureCluster().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("azureCluster", request.getAzureCluster())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateAzureClusterRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + getAzureClusterMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AzureClusters/GetAzureCluster") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/azureClusters/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AzureCluster.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listAzureClustersMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AzureClusters/ListAzureClusters") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/azureClusters", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListAzureClustersResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteAzureClusterMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AzureClusters/DeleteAzureCluster") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/azureClusters/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "allowMissing", request.getAllowMissing()); + serializer.putQueryParam(fields, "etag", request.getEtag()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteAzureClusterRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor< + GenerateAzureAccessTokenRequest, GenerateAzureAccessTokenResponse> + generateAzureAccessTokenMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.gkemulticloud.v1.AzureClusters/GenerateAzureAccessToken") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{azureCluster=projects/*/locations/*/azureClusters/*}:generateAzureAccessToken", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "azureCluster", request.getAzureCluster()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(GenerateAzureAccessTokenResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createAzureNodePoolMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AzureClusters/CreateAzureNodePool") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*/azureClusters/*}/azureNodePools", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "azureNodePoolId", request.getAzureNodePoolId()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("azureNodePool", request.getAzureNodePool())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateAzureNodePoolRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + updateAzureNodePoolMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AzureClusters/UpdateAzureNodePool") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{azureNodePool.name=projects/*/locations/*/azureClusters/*/azureNodePools/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "azureNodePool.name", request.getAzureNodePool().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("azureNodePool", request.getAzureNodePool())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateAzureNodePoolRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + getAzureNodePoolMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AzureClusters/GetAzureNodePool") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/azureClusters/*/azureNodePools/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AzureNodePool.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listAzureNodePoolsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AzureClusters/ListAzureNodePools") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*/azureClusters/*}/azureNodePools", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListAzureNodePoolsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteAzureNodePoolMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AzureClusters/DeleteAzureNodePool") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/azureClusters/*/azureNodePools/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "allowMissing", request.getAllowMissing()); + serializer.putQueryParam(fields, "etag", request.getEtag()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteAzureNodePoolRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + getAzureServerConfigMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.gkemulticloud.v1.AzureClusters/GetAzureServerConfig") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/azureServerConfig}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AzureServerConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable createAzureClientCallable; + private final OperationCallable + createAzureClientOperationCallable; + private final UnaryCallable getAzureClientCallable; + private final UnaryCallable + listAzureClientsCallable; + private final UnaryCallable + listAzureClientsPagedCallable; + private final UnaryCallable deleteAzureClientCallable; + private final OperationCallable + deleteAzureClientOperationCallable; + private final UnaryCallable createAzureClusterCallable; + private final OperationCallable + createAzureClusterOperationCallable; + private final UnaryCallable updateAzureClusterCallable; + private final OperationCallable + updateAzureClusterOperationCallable; + private final UnaryCallable getAzureClusterCallable; + private final UnaryCallable + listAzureClustersCallable; + private final UnaryCallable + listAzureClustersPagedCallable; + private final UnaryCallable deleteAzureClusterCallable; + private final OperationCallable + deleteAzureClusterOperationCallable; + private final UnaryCallable + generateAzureAccessTokenCallable; + private final UnaryCallable createAzureNodePoolCallable; + private final OperationCallable + createAzureNodePoolOperationCallable; + private final UnaryCallable updateAzureNodePoolCallable; + private final OperationCallable + updateAzureNodePoolOperationCallable; + private final UnaryCallable getAzureNodePoolCallable; + private final UnaryCallable + listAzureNodePoolsCallable; + private final UnaryCallable + listAzureNodePoolsPagedCallable; + private final UnaryCallable deleteAzureNodePoolCallable; + private final OperationCallable + deleteAzureNodePoolOperationCallable; + private final UnaryCallable + getAzureServerConfigCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonAzureClustersStub create(AzureClustersStubSettings settings) + throws IOException { + return new HttpJsonAzureClustersStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonAzureClustersStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonAzureClustersStub( + AzureClustersStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonAzureClustersStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonAzureClustersStub( + AzureClustersStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonAzureClustersStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonAzureClustersStub( + AzureClustersStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonAzureClustersCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonAzureClustersStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonAzureClustersStub( + AzureClustersStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings createAzureClientTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createAzureClientMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getAzureClientTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getAzureClientMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listAzureClientsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listAzureClientsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteAzureClientTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteAzureClientMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings createAzureClusterTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createAzureClusterMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateAzureClusterTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateAzureClusterMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getAzureClusterTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getAzureClusterMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listAzureClustersTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listAzureClustersMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteAzureClusterTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteAzureClusterMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + generateAzureAccessTokenTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(generateAzureAccessTokenMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createAzureNodePoolTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createAzureNodePoolMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateAzureNodePoolTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateAzureNodePoolMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getAzureNodePoolTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getAzureNodePoolMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listAzureNodePoolsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listAzureNodePoolsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + deleteAzureNodePoolTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteAzureNodePoolMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getAzureServerConfigTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getAzureServerConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.createAzureClientCallable = + callableFactory.createUnaryCallable( + createAzureClientTransportSettings, + settings.createAzureClientSettings(), + clientContext); + this.createAzureClientOperationCallable = + callableFactory.createOperationCallable( + createAzureClientTransportSettings, + settings.createAzureClientOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getAzureClientCallable = + callableFactory.createUnaryCallable( + getAzureClientTransportSettings, settings.getAzureClientSettings(), clientContext); + this.listAzureClientsCallable = + callableFactory.createUnaryCallable( + listAzureClientsTransportSettings, settings.listAzureClientsSettings(), clientContext); + this.listAzureClientsPagedCallable = + callableFactory.createPagedCallable( + listAzureClientsTransportSettings, settings.listAzureClientsSettings(), clientContext); + this.deleteAzureClientCallable = + callableFactory.createUnaryCallable( + deleteAzureClientTransportSettings, + settings.deleteAzureClientSettings(), + clientContext); + this.deleteAzureClientOperationCallable = + callableFactory.createOperationCallable( + deleteAzureClientTransportSettings, + settings.deleteAzureClientOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.createAzureClusterCallable = + callableFactory.createUnaryCallable( + createAzureClusterTransportSettings, + settings.createAzureClusterSettings(), + clientContext); + this.createAzureClusterOperationCallable = + callableFactory.createOperationCallable( + createAzureClusterTransportSettings, + settings.createAzureClusterOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.updateAzureClusterCallable = + callableFactory.createUnaryCallable( + updateAzureClusterTransportSettings, + settings.updateAzureClusterSettings(), + clientContext); + this.updateAzureClusterOperationCallable = + callableFactory.createOperationCallable( + updateAzureClusterTransportSettings, + settings.updateAzureClusterOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getAzureClusterCallable = + callableFactory.createUnaryCallable( + getAzureClusterTransportSettings, settings.getAzureClusterSettings(), clientContext); + this.listAzureClustersCallable = + callableFactory.createUnaryCallable( + listAzureClustersTransportSettings, + settings.listAzureClustersSettings(), + clientContext); + this.listAzureClustersPagedCallable = + callableFactory.createPagedCallable( + listAzureClustersTransportSettings, + settings.listAzureClustersSettings(), + clientContext); + this.deleteAzureClusterCallable = + callableFactory.createUnaryCallable( + deleteAzureClusterTransportSettings, + settings.deleteAzureClusterSettings(), + clientContext); + this.deleteAzureClusterOperationCallable = + callableFactory.createOperationCallable( + deleteAzureClusterTransportSettings, + settings.deleteAzureClusterOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.generateAzureAccessTokenCallable = + callableFactory.createUnaryCallable( + generateAzureAccessTokenTransportSettings, + settings.generateAzureAccessTokenSettings(), + clientContext); + this.createAzureNodePoolCallable = + callableFactory.createUnaryCallable( + createAzureNodePoolTransportSettings, + settings.createAzureNodePoolSettings(), + clientContext); + this.createAzureNodePoolOperationCallable = + callableFactory.createOperationCallable( + createAzureNodePoolTransportSettings, + settings.createAzureNodePoolOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.updateAzureNodePoolCallable = + callableFactory.createUnaryCallable( + updateAzureNodePoolTransportSettings, + settings.updateAzureNodePoolSettings(), + clientContext); + this.updateAzureNodePoolOperationCallable = + callableFactory.createOperationCallable( + updateAzureNodePoolTransportSettings, + settings.updateAzureNodePoolOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getAzureNodePoolCallable = + callableFactory.createUnaryCallable( + getAzureNodePoolTransportSettings, settings.getAzureNodePoolSettings(), clientContext); + this.listAzureNodePoolsCallable = + callableFactory.createUnaryCallable( + listAzureNodePoolsTransportSettings, + settings.listAzureNodePoolsSettings(), + clientContext); + this.listAzureNodePoolsPagedCallable = + callableFactory.createPagedCallable( + listAzureNodePoolsTransportSettings, + settings.listAzureNodePoolsSettings(), + clientContext); + this.deleteAzureNodePoolCallable = + callableFactory.createUnaryCallable( + deleteAzureNodePoolTransportSettings, + settings.deleteAzureNodePoolSettings(), + clientContext); + this.deleteAzureNodePoolOperationCallable = + callableFactory.createOperationCallable( + deleteAzureNodePoolTransportSettings, + settings.deleteAzureNodePoolOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getAzureServerConfigCallable = + callableFactory.createUnaryCallable( + getAzureServerConfigTransportSettings, + settings.getAzureServerConfigSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(createAzureClientMethodDescriptor); + methodDescriptors.add(getAzureClientMethodDescriptor); + methodDescriptors.add(listAzureClientsMethodDescriptor); + methodDescriptors.add(deleteAzureClientMethodDescriptor); + methodDescriptors.add(createAzureClusterMethodDescriptor); + methodDescriptors.add(updateAzureClusterMethodDescriptor); + methodDescriptors.add(getAzureClusterMethodDescriptor); + methodDescriptors.add(listAzureClustersMethodDescriptor); + methodDescriptors.add(deleteAzureClusterMethodDescriptor); + methodDescriptors.add(generateAzureAccessTokenMethodDescriptor); + methodDescriptors.add(createAzureNodePoolMethodDescriptor); + methodDescriptors.add(updateAzureNodePoolMethodDescriptor); + methodDescriptors.add(getAzureNodePoolMethodDescriptor); + methodDescriptors.add(listAzureNodePoolsMethodDescriptor); + methodDescriptors.add(deleteAzureNodePoolMethodDescriptor); + methodDescriptors.add(getAzureServerConfigMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable createAzureClientCallable() { + return createAzureClientCallable; + } + + @Override + public OperationCallable + createAzureClientOperationCallable() { + return createAzureClientOperationCallable; + } + + @Override + public UnaryCallable getAzureClientCallable() { + return getAzureClientCallable; + } + + @Override + public UnaryCallable + listAzureClientsCallable() { + return listAzureClientsCallable; + } + + @Override + public UnaryCallable + listAzureClientsPagedCallable() { + return listAzureClientsPagedCallable; + } + + @Override + public UnaryCallable deleteAzureClientCallable() { + return deleteAzureClientCallable; + } + + @Override + public OperationCallable + deleteAzureClientOperationCallable() { + return deleteAzureClientOperationCallable; + } + + @Override + public UnaryCallable createAzureClusterCallable() { + return createAzureClusterCallable; + } + + @Override + public OperationCallable + createAzureClusterOperationCallable() { + return createAzureClusterOperationCallable; + } + + @Override + public UnaryCallable updateAzureClusterCallable() { + return updateAzureClusterCallable; + } + + @Override + public OperationCallable + updateAzureClusterOperationCallable() { + return updateAzureClusterOperationCallable; + } + + @Override + public UnaryCallable getAzureClusterCallable() { + return getAzureClusterCallable; + } + + @Override + public UnaryCallable + listAzureClustersCallable() { + return listAzureClustersCallable; + } + + @Override + public UnaryCallable + listAzureClustersPagedCallable() { + return listAzureClustersPagedCallable; + } + + @Override + public UnaryCallable deleteAzureClusterCallable() { + return deleteAzureClusterCallable; + } + + @Override + public OperationCallable + deleteAzureClusterOperationCallable() { + return deleteAzureClusterOperationCallable; + } + + @Override + public UnaryCallable + generateAzureAccessTokenCallable() { + return generateAzureAccessTokenCallable; + } + + @Override + public UnaryCallable createAzureNodePoolCallable() { + return createAzureNodePoolCallable; + } + + @Override + public OperationCallable + createAzureNodePoolOperationCallable() { + return createAzureNodePoolOperationCallable; + } + + @Override + public UnaryCallable updateAzureNodePoolCallable() { + return updateAzureNodePoolCallable; + } + + @Override + public OperationCallable + updateAzureNodePoolOperationCallable() { + return updateAzureNodePoolOperationCallable; + } + + @Override + public UnaryCallable getAzureNodePoolCallable() { + return getAzureNodePoolCallable; + } + + @Override + public UnaryCallable + listAzureNodePoolsCallable() { + return listAzureNodePoolsCallable; + } + + @Override + public UnaryCallable + listAzureNodePoolsPagedCallable() { + return listAzureNodePoolsPagedCallable; + } + + @Override + public UnaryCallable deleteAzureNodePoolCallable() { + return deleteAzureNodePoolCallable; + } + + @Override + public OperationCallable + deleteAzureNodePoolOperationCallable() { + return deleteAzureNodePoolOperationCallable; + } + + @Override + public UnaryCallable + getAzureServerConfigCallable() { + return getAzureServerConfigCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-gke-multi-cloud/src/test/java/com/google/cloud/gkemulticloud/v1/AwsClustersClientHttpJsonTest.java b/google-cloud-gke-multi-cloud/src/test/java/com/google/cloud/gkemulticloud/v1/AwsClustersClientHttpJsonTest.java new file mode 100644 index 0000000..d45b2cb --- /dev/null +++ b/google-cloud-gke-multi-cloud/src/test/java/com/google/cloud/gkemulticloud/v1/AwsClustersClientHttpJsonTest.java @@ -0,0 +1,1327 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1; + +import static com.google.cloud.gkemulticloud.v1.AwsClustersClient.ListAwsClustersPagedResponse; +import static com.google.cloud.gkemulticloud.v1.AwsClustersClient.ListAwsNodePoolsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.gkemulticloud.v1.stub.HttpJsonAwsClustersStub; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.Any; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class AwsClustersClientHttpJsonTest { + private static MockHttpService mockService; + private static AwsClustersClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonAwsClustersStub.getMethodDescriptors(), + AwsClustersSettings.getDefaultEndpoint()); + AwsClustersSettings settings = + AwsClustersSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + AwsClustersSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = AwsClustersClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void createAwsClusterTest() throws Exception { + AwsCluster expectedResponse = + AwsCluster.newBuilder() + .setName(AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString()) + .setDescription("description-1724546052") + .setNetworking(AwsClusterNetworking.newBuilder().build()) + .setAwsRegion("awsRegion-860644271") + .setControlPlane(AwsControlPlane.newBuilder().build()) + .setAuthorization(AwsAuthorization.newBuilder().build()) + .setEndpoint("endpoint1741102485") + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setWorkloadIdentityConfig(WorkloadIdentityConfig.newBuilder().build()) + .setClusterCaCertificate("clusterCaCertificate-683492737") + .setFleet(Fleet.newBuilder().build()) + .setLoggingConfig(LoggingConfig.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createAwsClusterTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + AwsCluster awsCluster = AwsCluster.newBuilder().build(); + String awsClusterId = "awsClusterId1988965944"; + + AwsCluster actualResponse = + client.createAwsClusterAsync(parent, awsCluster, awsClusterId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createAwsClusterExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + AwsCluster awsCluster = AwsCluster.newBuilder().build(); + String awsClusterId = "awsClusterId1988965944"; + client.createAwsClusterAsync(parent, awsCluster, awsClusterId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createAwsClusterTest2() throws Exception { + AwsCluster expectedResponse = + AwsCluster.newBuilder() + .setName(AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString()) + .setDescription("description-1724546052") + .setNetworking(AwsClusterNetworking.newBuilder().build()) + .setAwsRegion("awsRegion-860644271") + .setControlPlane(AwsControlPlane.newBuilder().build()) + .setAuthorization(AwsAuthorization.newBuilder().build()) + .setEndpoint("endpoint1741102485") + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setWorkloadIdentityConfig(WorkloadIdentityConfig.newBuilder().build()) + .setClusterCaCertificate("clusterCaCertificate-683492737") + .setFleet(Fleet.newBuilder().build()) + .setLoggingConfig(LoggingConfig.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createAwsClusterTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + AwsCluster awsCluster = AwsCluster.newBuilder().build(); + String awsClusterId = "awsClusterId1988965944"; + + AwsCluster actualResponse = + client.createAwsClusterAsync(parent, awsCluster, awsClusterId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createAwsClusterExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + AwsCluster awsCluster = AwsCluster.newBuilder().build(); + String awsClusterId = "awsClusterId1988965944"; + client.createAwsClusterAsync(parent, awsCluster, awsClusterId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void updateAwsClusterTest() throws Exception { + AwsCluster expectedResponse = + AwsCluster.newBuilder() + .setName(AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString()) + .setDescription("description-1724546052") + .setNetworking(AwsClusterNetworking.newBuilder().build()) + .setAwsRegion("awsRegion-860644271") + .setControlPlane(AwsControlPlane.newBuilder().build()) + .setAuthorization(AwsAuthorization.newBuilder().build()) + .setEndpoint("endpoint1741102485") + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setWorkloadIdentityConfig(WorkloadIdentityConfig.newBuilder().build()) + .setClusterCaCertificate("clusterCaCertificate-683492737") + .setFleet(Fleet.newBuilder().build()) + .setLoggingConfig(LoggingConfig.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateAwsClusterTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + AwsCluster awsCluster = + AwsCluster.newBuilder() + .setName(AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString()) + .setDescription("description-1724546052") + .setNetworking(AwsClusterNetworking.newBuilder().build()) + .setAwsRegion("awsRegion-860644271") + .setControlPlane(AwsControlPlane.newBuilder().build()) + .setAuthorization(AwsAuthorization.newBuilder().build()) + .setEndpoint("endpoint1741102485") + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setWorkloadIdentityConfig(WorkloadIdentityConfig.newBuilder().build()) + .setClusterCaCertificate("clusterCaCertificate-683492737") + .setFleet(Fleet.newBuilder().build()) + .setLoggingConfig(LoggingConfig.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + AwsCluster actualResponse = client.updateAwsClusterAsync(awsCluster, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateAwsClusterExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AwsCluster awsCluster = + AwsCluster.newBuilder() + .setName(AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString()) + .setDescription("description-1724546052") + .setNetworking(AwsClusterNetworking.newBuilder().build()) + .setAwsRegion("awsRegion-860644271") + .setControlPlane(AwsControlPlane.newBuilder().build()) + .setAuthorization(AwsAuthorization.newBuilder().build()) + .setEndpoint("endpoint1741102485") + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setWorkloadIdentityConfig(WorkloadIdentityConfig.newBuilder().build()) + .setClusterCaCertificate("clusterCaCertificate-683492737") + .setFleet(Fleet.newBuilder().build()) + .setLoggingConfig(LoggingConfig.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateAwsClusterAsync(awsCluster, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getAwsClusterTest() throws Exception { + AwsCluster expectedResponse = + AwsCluster.newBuilder() + .setName(AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString()) + .setDescription("description-1724546052") + .setNetworking(AwsClusterNetworking.newBuilder().build()) + .setAwsRegion("awsRegion-860644271") + .setControlPlane(AwsControlPlane.newBuilder().build()) + .setAuthorization(AwsAuthorization.newBuilder().build()) + .setEndpoint("endpoint1741102485") + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setWorkloadIdentityConfig(WorkloadIdentityConfig.newBuilder().build()) + .setClusterCaCertificate("clusterCaCertificate-683492737") + .setFleet(Fleet.newBuilder().build()) + .setLoggingConfig(LoggingConfig.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + AwsClusterName name = AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]"); + + AwsCluster actualResponse = client.getAwsCluster(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAwsClusterExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AwsClusterName name = AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]"); + client.getAwsCluster(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getAwsClusterTest2() throws Exception { + AwsCluster expectedResponse = + AwsCluster.newBuilder() + .setName(AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString()) + .setDescription("description-1724546052") + .setNetworking(AwsClusterNetworking.newBuilder().build()) + .setAwsRegion("awsRegion-860644271") + .setControlPlane(AwsControlPlane.newBuilder().build()) + .setAuthorization(AwsAuthorization.newBuilder().build()) + .setEndpoint("endpoint1741102485") + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setWorkloadIdentityConfig(WorkloadIdentityConfig.newBuilder().build()) + .setClusterCaCertificate("clusterCaCertificate-683492737") + .setFleet(Fleet.newBuilder().build()) + .setLoggingConfig(LoggingConfig.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-1220/locations/location-1220/awsClusters/awsCluster-1220"; + + AwsCluster actualResponse = client.getAwsCluster(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAwsClusterExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-1220/locations/location-1220/awsClusters/awsCluster-1220"; + client.getAwsCluster(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listAwsClustersTest() throws Exception { + AwsCluster responsesElement = AwsCluster.newBuilder().build(); + ListAwsClustersResponse expectedResponse = + ListAwsClustersResponse.newBuilder() + .setNextPageToken("") + .addAllAwsClusters(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListAwsClustersPagedResponse pagedListResponse = client.listAwsClusters(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getAwsClustersList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listAwsClustersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listAwsClusters(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listAwsClustersTest2() throws Exception { + AwsCluster responsesElement = AwsCluster.newBuilder().build(); + ListAwsClustersResponse expectedResponse = + ListAwsClustersResponse.newBuilder() + .setNextPageToken("") + .addAllAwsClusters(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListAwsClustersPagedResponse pagedListResponse = client.listAwsClusters(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getAwsClustersList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listAwsClustersExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listAwsClusters(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteAwsClusterTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteAwsClusterTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + AwsClusterName name = AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]"); + + client.deleteAwsClusterAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteAwsClusterExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AwsClusterName name = AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]"); + client.deleteAwsClusterAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteAwsClusterTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteAwsClusterTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-1220/locations/location-1220/awsClusters/awsCluster-1220"; + + client.deleteAwsClusterAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteAwsClusterExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-1220/locations/location-1220/awsClusters/awsCluster-1220"; + client.deleteAwsClusterAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void generateAwsAccessTokenTest() throws Exception { + GenerateAwsAccessTokenResponse expectedResponse = + GenerateAwsAccessTokenResponse.newBuilder() + .setAccessToken("accessToken-1042689291") + .setExpirationTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GenerateAwsAccessTokenRequest request = + GenerateAwsAccessTokenRequest.newBuilder() + .setAwsCluster(AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString()) + .build(); + + GenerateAwsAccessTokenResponse actualResponse = client.generateAwsAccessToken(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void generateAwsAccessTokenExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GenerateAwsAccessTokenRequest request = + GenerateAwsAccessTokenRequest.newBuilder() + .setAwsCluster( + AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString()) + .build(); + client.generateAwsAccessToken(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createAwsNodePoolTest() throws Exception { + AwsNodePool expectedResponse = + AwsNodePool.newBuilder() + .setName( + AwsNodePoolName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]", "[AWS_NODE_POOL]") + .toString()) + .setVersion("version351608024") + .setConfig(AwsNodeConfig.newBuilder().build()) + .setAutoscaling(AwsNodePoolAutoscaling.newBuilder().build()) + .setSubnetId("subnetId-2066159272") + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setMaxPodsConstraint(MaxPodsConstraint.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createAwsNodePoolTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + AwsClusterName parent = AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]"); + AwsNodePool awsNodePool = AwsNodePool.newBuilder().build(); + String awsNodePoolId = "awsNodePoolId-1885267498"; + + AwsNodePool actualResponse = + client.createAwsNodePoolAsync(parent, awsNodePool, awsNodePoolId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createAwsNodePoolExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AwsClusterName parent = AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]"); + AwsNodePool awsNodePool = AwsNodePool.newBuilder().build(); + String awsNodePoolId = "awsNodePoolId-1885267498"; + client.createAwsNodePoolAsync(parent, awsNodePool, awsNodePoolId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createAwsNodePoolTest2() throws Exception { + AwsNodePool expectedResponse = + AwsNodePool.newBuilder() + .setName( + AwsNodePoolName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]", "[AWS_NODE_POOL]") + .toString()) + .setVersion("version351608024") + .setConfig(AwsNodeConfig.newBuilder().build()) + .setAutoscaling(AwsNodePoolAutoscaling.newBuilder().build()) + .setSubnetId("subnetId-2066159272") + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setMaxPodsConstraint(MaxPodsConstraint.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createAwsNodePoolTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-2069/locations/location-2069/awsClusters/awsCluster-2069"; + AwsNodePool awsNodePool = AwsNodePool.newBuilder().build(); + String awsNodePoolId = "awsNodePoolId-1885267498"; + + AwsNodePool actualResponse = + client.createAwsNodePoolAsync(parent, awsNodePool, awsNodePoolId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createAwsNodePoolExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-2069/locations/location-2069/awsClusters/awsCluster-2069"; + AwsNodePool awsNodePool = AwsNodePool.newBuilder().build(); + String awsNodePoolId = "awsNodePoolId-1885267498"; + client.createAwsNodePoolAsync(parent, awsNodePool, awsNodePoolId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void updateAwsNodePoolTest() throws Exception { + AwsNodePool expectedResponse = + AwsNodePool.newBuilder() + .setName( + AwsNodePoolName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]", "[AWS_NODE_POOL]") + .toString()) + .setVersion("version351608024") + .setConfig(AwsNodeConfig.newBuilder().build()) + .setAutoscaling(AwsNodePoolAutoscaling.newBuilder().build()) + .setSubnetId("subnetId-2066159272") + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setMaxPodsConstraint(MaxPodsConstraint.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateAwsNodePoolTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + AwsNodePool awsNodePool = + AwsNodePool.newBuilder() + .setName( + AwsNodePoolName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]", "[AWS_NODE_POOL]") + .toString()) + .setVersion("version351608024") + .setConfig(AwsNodeConfig.newBuilder().build()) + .setAutoscaling(AwsNodePoolAutoscaling.newBuilder().build()) + .setSubnetId("subnetId-2066159272") + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setMaxPodsConstraint(MaxPodsConstraint.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + AwsNodePool actualResponse = client.updateAwsNodePoolAsync(awsNodePool, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateAwsNodePoolExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AwsNodePool awsNodePool = + AwsNodePool.newBuilder() + .setName( + AwsNodePoolName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]", "[AWS_NODE_POOL]") + .toString()) + .setVersion("version351608024") + .setConfig(AwsNodeConfig.newBuilder().build()) + .setAutoscaling(AwsNodePoolAutoscaling.newBuilder().build()) + .setSubnetId("subnetId-2066159272") + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setMaxPodsConstraint(MaxPodsConstraint.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateAwsNodePoolAsync(awsNodePool, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getAwsNodePoolTest() throws Exception { + AwsNodePool expectedResponse = + AwsNodePool.newBuilder() + .setName( + AwsNodePoolName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]", "[AWS_NODE_POOL]") + .toString()) + .setVersion("version351608024") + .setConfig(AwsNodeConfig.newBuilder().build()) + .setAutoscaling(AwsNodePoolAutoscaling.newBuilder().build()) + .setSubnetId("subnetId-2066159272") + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setMaxPodsConstraint(MaxPodsConstraint.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + AwsNodePoolName name = + AwsNodePoolName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]", "[AWS_NODE_POOL]"); + + AwsNodePool actualResponse = client.getAwsNodePool(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAwsNodePoolExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AwsNodePoolName name = + AwsNodePoolName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]", "[AWS_NODE_POOL]"); + client.getAwsNodePool(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getAwsNodePoolTest2() throws Exception { + AwsNodePool expectedResponse = + AwsNodePool.newBuilder() + .setName( + AwsNodePoolName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]", "[AWS_NODE_POOL]") + .toString()) + .setVersion("version351608024") + .setConfig(AwsNodeConfig.newBuilder().build()) + .setAutoscaling(AwsNodePoolAutoscaling.newBuilder().build()) + .setSubnetId("subnetId-2066159272") + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setMaxPodsConstraint(MaxPodsConstraint.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-9334/locations/location-9334/awsClusters/awsCluster-9334/awsNodePools/awsNodePool-9334"; + + AwsNodePool actualResponse = client.getAwsNodePool(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAwsNodePoolExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-9334/locations/location-9334/awsClusters/awsCluster-9334/awsNodePools/awsNodePool-9334"; + client.getAwsNodePool(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listAwsNodePoolsTest() throws Exception { + AwsNodePool responsesElement = AwsNodePool.newBuilder().build(); + ListAwsNodePoolsResponse expectedResponse = + ListAwsNodePoolsResponse.newBuilder() + .setNextPageToken("") + .addAllAwsNodePools(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + AwsClusterName parent = AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]"); + + ListAwsNodePoolsPagedResponse pagedListResponse = client.listAwsNodePools(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getAwsNodePoolsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listAwsNodePoolsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AwsClusterName parent = AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]"); + client.listAwsNodePools(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listAwsNodePoolsTest2() throws Exception { + AwsNodePool responsesElement = AwsNodePool.newBuilder().build(); + ListAwsNodePoolsResponse expectedResponse = + ListAwsNodePoolsResponse.newBuilder() + .setNextPageToken("") + .addAllAwsNodePools(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-2069/locations/location-2069/awsClusters/awsCluster-2069"; + + ListAwsNodePoolsPagedResponse pagedListResponse = client.listAwsNodePools(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getAwsNodePoolsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listAwsNodePoolsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-2069/locations/location-2069/awsClusters/awsCluster-2069"; + client.listAwsNodePools(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteAwsNodePoolTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteAwsNodePoolTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + AwsNodePoolName name = + AwsNodePoolName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]", "[AWS_NODE_POOL]"); + + client.deleteAwsNodePoolAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteAwsNodePoolExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AwsNodePoolName name = + AwsNodePoolName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]", "[AWS_NODE_POOL]"); + client.deleteAwsNodePoolAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteAwsNodePoolTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteAwsNodePoolTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-9334/locations/location-9334/awsClusters/awsCluster-9334/awsNodePools/awsNodePool-9334"; + + client.deleteAwsNodePoolAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteAwsNodePoolExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-9334/locations/location-9334/awsClusters/awsCluster-9334/awsNodePools/awsNodePool-9334"; + client.deleteAwsNodePoolAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getAwsServerConfigTest() throws Exception { + AwsServerConfig expectedResponse = + AwsServerConfig.newBuilder() + .setName(AwsServerConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .addAllValidVersions(new ArrayList()) + .addAllSupportedAwsRegions(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + AwsServerConfigName name = AwsServerConfigName.of("[PROJECT]", "[LOCATION]"); + + AwsServerConfig actualResponse = client.getAwsServerConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAwsServerConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AwsServerConfigName name = AwsServerConfigName.of("[PROJECT]", "[LOCATION]"); + client.getAwsServerConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getAwsServerConfigTest2() throws Exception { + AwsServerConfig expectedResponse = + AwsServerConfig.newBuilder() + .setName(AwsServerConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .addAllValidVersions(new ArrayList()) + .addAllSupportedAwsRegions(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-5245/locations/location-5245/awsServerConfig"; + + AwsServerConfig actualResponse = client.getAwsServerConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAwsServerConfigExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-5245/locations/location-5245/awsServerConfig"; + client.getAwsServerConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/google-cloud-gke-multi-cloud/src/test/java/com/google/cloud/gkemulticloud/v1/AzureClustersClientHttpJsonTest.java b/google-cloud-gke-multi-cloud/src/test/java/com/google/cloud/gkemulticloud/v1/AzureClustersClientHttpJsonTest.java new file mode 100644 index 0000000..d1405e2 --- /dev/null +++ b/google-cloud-gke-multi-cloud/src/test/java/com/google/cloud/gkemulticloud/v1/AzureClustersClientHttpJsonTest.java @@ -0,0 +1,1776 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1; + +import static com.google.cloud.gkemulticloud.v1.AzureClustersClient.ListAzureClientsPagedResponse; +import static com.google.cloud.gkemulticloud.v1.AzureClustersClient.ListAzureClustersPagedResponse; +import static com.google.cloud.gkemulticloud.v1.AzureClustersClient.ListAzureNodePoolsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.gkemulticloud.v1.stub.HttpJsonAzureClustersStub; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.Any; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class AzureClustersClientHttpJsonTest { + private static MockHttpService mockService; + private static AzureClustersClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonAzureClustersStub.getMethodDescriptors(), + AzureClustersSettings.getDefaultEndpoint()); + AzureClustersSettings settings = + AzureClustersSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + AzureClustersSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = AzureClustersClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void createAzureClientTest() throws Exception { + AzureClient expectedResponse = + AzureClient.newBuilder() + .setName(AzureClientName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLIENT]").toString()) + .setTenantId("tenantId-1306693787") + .setApplicationId("applicationId-1011352949") + .putAllAnnotations(new HashMap()) + .setPemCertificate("pemCertificate153491807") + .setUid("uid115792") + .setCreateTime(Timestamp.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createAzureClientTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + AzureClient azureClient = AzureClient.newBuilder().build(); + String azureClientId = "azureClientId-1735934475"; + + AzureClient actualResponse = + client.createAzureClientAsync(parent, azureClient, azureClientId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createAzureClientExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + AzureClient azureClient = AzureClient.newBuilder().build(); + String azureClientId = "azureClientId-1735934475"; + client.createAzureClientAsync(parent, azureClient, azureClientId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createAzureClientTest2() throws Exception { + AzureClient expectedResponse = + AzureClient.newBuilder() + .setName(AzureClientName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLIENT]").toString()) + .setTenantId("tenantId-1306693787") + .setApplicationId("applicationId-1011352949") + .putAllAnnotations(new HashMap()) + .setPemCertificate("pemCertificate153491807") + .setUid("uid115792") + .setCreateTime(Timestamp.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createAzureClientTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + AzureClient azureClient = AzureClient.newBuilder().build(); + String azureClientId = "azureClientId-1735934475"; + + AzureClient actualResponse = + client.createAzureClientAsync(parent, azureClient, azureClientId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createAzureClientExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + AzureClient azureClient = AzureClient.newBuilder().build(); + String azureClientId = "azureClientId-1735934475"; + client.createAzureClientAsync(parent, azureClient, azureClientId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getAzureClientTest() throws Exception { + AzureClient expectedResponse = + AzureClient.newBuilder() + .setName(AzureClientName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLIENT]").toString()) + .setTenantId("tenantId-1306693787") + .setApplicationId("applicationId-1011352949") + .putAllAnnotations(new HashMap()) + .setPemCertificate("pemCertificate153491807") + .setUid("uid115792") + .setCreateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + AzureClientName name = AzureClientName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLIENT]"); + + AzureClient actualResponse = client.getAzureClient(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAzureClientExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AzureClientName name = AzureClientName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLIENT]"); + client.getAzureClient(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getAzureClientTest2() throws Exception { + AzureClient expectedResponse = + AzureClient.newBuilder() + .setName(AzureClientName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLIENT]").toString()) + .setTenantId("tenantId-1306693787") + .setApplicationId("applicationId-1011352949") + .putAllAnnotations(new HashMap()) + .setPemCertificate("pemCertificate153491807") + .setUid("uid115792") + .setCreateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-7305/locations/location-7305/azureClients/azureClient-7305"; + + AzureClient actualResponse = client.getAzureClient(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAzureClientExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-7305/locations/location-7305/azureClients/azureClient-7305"; + client.getAzureClient(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listAzureClientsTest() throws Exception { + AzureClient responsesElement = AzureClient.newBuilder().build(); + ListAzureClientsResponse expectedResponse = + ListAzureClientsResponse.newBuilder() + .setNextPageToken("") + .addAllAzureClients(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListAzureClientsPagedResponse pagedListResponse = client.listAzureClients(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getAzureClientsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listAzureClientsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listAzureClients(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listAzureClientsTest2() throws Exception { + AzureClient responsesElement = AzureClient.newBuilder().build(); + ListAzureClientsResponse expectedResponse = + ListAzureClientsResponse.newBuilder() + .setNextPageToken("") + .addAllAzureClients(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListAzureClientsPagedResponse pagedListResponse = client.listAzureClients(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getAzureClientsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listAzureClientsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listAzureClients(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteAzureClientTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteAzureClientTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + AzureClientName name = AzureClientName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLIENT]"); + + client.deleteAzureClientAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteAzureClientExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AzureClientName name = AzureClientName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLIENT]"); + client.deleteAzureClientAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteAzureClientTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteAzureClientTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-7305/locations/location-7305/azureClients/azureClient-7305"; + + client.deleteAzureClientAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteAzureClientExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-7305/locations/location-7305/azureClients/azureClient-7305"; + client.deleteAzureClientAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createAzureClusterTest() throws Exception { + AzureCluster expectedResponse = + AzureCluster.newBuilder() + .setName(AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString()) + .setDescription("description-1724546052") + .setAzureRegion("azureRegion1270271587") + .setResourceGroupId("resourceGroupId928392204") + .setAzureClient("azureClient847354682") + .setNetworking(AzureClusterNetworking.newBuilder().build()) + .setControlPlane(AzureControlPlane.newBuilder().build()) + .setAuthorization(AzureAuthorization.newBuilder().build()) + .setEndpoint("endpoint1741102485") + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setWorkloadIdentityConfig(WorkloadIdentityConfig.newBuilder().build()) + .setClusterCaCertificate("clusterCaCertificate-683492737") + .setFleet(Fleet.newBuilder().build()) + .setManagedResources(AzureClusterResources.newBuilder().build()) + .setLoggingConfig(LoggingConfig.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createAzureClusterTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + AzureCluster azureCluster = AzureCluster.newBuilder().build(); + String azureClusterId = "azureClusterId191689446"; + + AzureCluster actualResponse = + client.createAzureClusterAsync(parent, azureCluster, azureClusterId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createAzureClusterExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + AzureCluster azureCluster = AzureCluster.newBuilder().build(); + String azureClusterId = "azureClusterId191689446"; + client.createAzureClusterAsync(parent, azureCluster, azureClusterId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createAzureClusterTest2() throws Exception { + AzureCluster expectedResponse = + AzureCluster.newBuilder() + .setName(AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString()) + .setDescription("description-1724546052") + .setAzureRegion("azureRegion1270271587") + .setResourceGroupId("resourceGroupId928392204") + .setAzureClient("azureClient847354682") + .setNetworking(AzureClusterNetworking.newBuilder().build()) + .setControlPlane(AzureControlPlane.newBuilder().build()) + .setAuthorization(AzureAuthorization.newBuilder().build()) + .setEndpoint("endpoint1741102485") + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setWorkloadIdentityConfig(WorkloadIdentityConfig.newBuilder().build()) + .setClusterCaCertificate("clusterCaCertificate-683492737") + .setFleet(Fleet.newBuilder().build()) + .setManagedResources(AzureClusterResources.newBuilder().build()) + .setLoggingConfig(LoggingConfig.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createAzureClusterTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + AzureCluster azureCluster = AzureCluster.newBuilder().build(); + String azureClusterId = "azureClusterId191689446"; + + AzureCluster actualResponse = + client.createAzureClusterAsync(parent, azureCluster, azureClusterId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createAzureClusterExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + AzureCluster azureCluster = AzureCluster.newBuilder().build(); + String azureClusterId = "azureClusterId191689446"; + client.createAzureClusterAsync(parent, azureCluster, azureClusterId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void updateAzureClusterTest() throws Exception { + AzureCluster expectedResponse = + AzureCluster.newBuilder() + .setName(AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString()) + .setDescription("description-1724546052") + .setAzureRegion("azureRegion1270271587") + .setResourceGroupId("resourceGroupId928392204") + .setAzureClient("azureClient847354682") + .setNetworking(AzureClusterNetworking.newBuilder().build()) + .setControlPlane(AzureControlPlane.newBuilder().build()) + .setAuthorization(AzureAuthorization.newBuilder().build()) + .setEndpoint("endpoint1741102485") + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setWorkloadIdentityConfig(WorkloadIdentityConfig.newBuilder().build()) + .setClusterCaCertificate("clusterCaCertificate-683492737") + .setFleet(Fleet.newBuilder().build()) + .setManagedResources(AzureClusterResources.newBuilder().build()) + .setLoggingConfig(LoggingConfig.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateAzureClusterTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + AzureCluster azureCluster = + AzureCluster.newBuilder() + .setName(AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString()) + .setDescription("description-1724546052") + .setAzureRegion("azureRegion1270271587") + .setResourceGroupId("resourceGroupId928392204") + .setAzureClient("azureClient847354682") + .setNetworking(AzureClusterNetworking.newBuilder().build()) + .setControlPlane(AzureControlPlane.newBuilder().build()) + .setAuthorization(AzureAuthorization.newBuilder().build()) + .setEndpoint("endpoint1741102485") + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setWorkloadIdentityConfig(WorkloadIdentityConfig.newBuilder().build()) + .setClusterCaCertificate("clusterCaCertificate-683492737") + .setFleet(Fleet.newBuilder().build()) + .setManagedResources(AzureClusterResources.newBuilder().build()) + .setLoggingConfig(LoggingConfig.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + AzureCluster actualResponse = client.updateAzureClusterAsync(azureCluster, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateAzureClusterExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AzureCluster azureCluster = + AzureCluster.newBuilder() + .setName(AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString()) + .setDescription("description-1724546052") + .setAzureRegion("azureRegion1270271587") + .setResourceGroupId("resourceGroupId928392204") + .setAzureClient("azureClient847354682") + .setNetworking(AzureClusterNetworking.newBuilder().build()) + .setControlPlane(AzureControlPlane.newBuilder().build()) + .setAuthorization(AzureAuthorization.newBuilder().build()) + .setEndpoint("endpoint1741102485") + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setWorkloadIdentityConfig(WorkloadIdentityConfig.newBuilder().build()) + .setClusterCaCertificate("clusterCaCertificate-683492737") + .setFleet(Fleet.newBuilder().build()) + .setManagedResources(AzureClusterResources.newBuilder().build()) + .setLoggingConfig(LoggingConfig.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateAzureClusterAsync(azureCluster, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getAzureClusterTest() throws Exception { + AzureCluster expectedResponse = + AzureCluster.newBuilder() + .setName(AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString()) + .setDescription("description-1724546052") + .setAzureRegion("azureRegion1270271587") + .setResourceGroupId("resourceGroupId928392204") + .setAzureClient("azureClient847354682") + .setNetworking(AzureClusterNetworking.newBuilder().build()) + .setControlPlane(AzureControlPlane.newBuilder().build()) + .setAuthorization(AzureAuthorization.newBuilder().build()) + .setEndpoint("endpoint1741102485") + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setWorkloadIdentityConfig(WorkloadIdentityConfig.newBuilder().build()) + .setClusterCaCertificate("clusterCaCertificate-683492737") + .setFleet(Fleet.newBuilder().build()) + .setManagedResources(AzureClusterResources.newBuilder().build()) + .setLoggingConfig(LoggingConfig.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + AzureClusterName name = AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]"); + + AzureCluster actualResponse = client.getAzureCluster(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAzureClusterExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AzureClusterName name = AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]"); + client.getAzureCluster(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getAzureClusterTest2() throws Exception { + AzureCluster expectedResponse = + AzureCluster.newBuilder() + .setName(AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString()) + .setDescription("description-1724546052") + .setAzureRegion("azureRegion1270271587") + .setResourceGroupId("resourceGroupId928392204") + .setAzureClient("azureClient847354682") + .setNetworking(AzureClusterNetworking.newBuilder().build()) + .setControlPlane(AzureControlPlane.newBuilder().build()) + .setAuthorization(AzureAuthorization.newBuilder().build()) + .setEndpoint("endpoint1741102485") + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setWorkloadIdentityConfig(WorkloadIdentityConfig.newBuilder().build()) + .setClusterCaCertificate("clusterCaCertificate-683492737") + .setFleet(Fleet.newBuilder().build()) + .setManagedResources(AzureClusterResources.newBuilder().build()) + .setLoggingConfig(LoggingConfig.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-6894/locations/location-6894/azureClusters/azureCluster-6894"; + + AzureCluster actualResponse = client.getAzureCluster(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAzureClusterExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-6894/locations/location-6894/azureClusters/azureCluster-6894"; + client.getAzureCluster(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listAzureClustersTest() throws Exception { + AzureCluster responsesElement = AzureCluster.newBuilder().build(); + ListAzureClustersResponse expectedResponse = + ListAzureClustersResponse.newBuilder() + .setNextPageToken("") + .addAllAzureClusters(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListAzureClustersPagedResponse pagedListResponse = client.listAzureClusters(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getAzureClustersList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listAzureClustersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listAzureClusters(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listAzureClustersTest2() throws Exception { + AzureCluster responsesElement = AzureCluster.newBuilder().build(); + ListAzureClustersResponse expectedResponse = + ListAzureClustersResponse.newBuilder() + .setNextPageToken("") + .addAllAzureClusters(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListAzureClustersPagedResponse pagedListResponse = client.listAzureClusters(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getAzureClustersList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listAzureClustersExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listAzureClusters(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteAzureClusterTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteAzureClusterTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + AzureClusterName name = AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]"); + + client.deleteAzureClusterAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteAzureClusterExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AzureClusterName name = AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]"); + client.deleteAzureClusterAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteAzureClusterTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteAzureClusterTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-6894/locations/location-6894/azureClusters/azureCluster-6894"; + + client.deleteAzureClusterAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteAzureClusterExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-6894/locations/location-6894/azureClusters/azureCluster-6894"; + client.deleteAzureClusterAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void generateAzureAccessTokenTest() throws Exception { + GenerateAzureAccessTokenResponse expectedResponse = + GenerateAzureAccessTokenResponse.newBuilder() + .setAccessToken("accessToken-1042689291") + .setExpirationTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GenerateAzureAccessTokenRequest request = + GenerateAzureAccessTokenRequest.newBuilder() + .setAzureCluster( + AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString()) + .build(); + + GenerateAzureAccessTokenResponse actualResponse = client.generateAzureAccessToken(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void generateAzureAccessTokenExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GenerateAzureAccessTokenRequest request = + GenerateAzureAccessTokenRequest.newBuilder() + .setAzureCluster( + AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString()) + .build(); + client.generateAzureAccessToken(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createAzureNodePoolTest() throws Exception { + AzureNodePool expectedResponse = + AzureNodePool.newBuilder() + .setName( + AzureNodePoolName.of( + "[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]", "[AZURE_NODE_POOL]") + .toString()) + .setVersion("version351608024") + .setConfig(AzureNodeConfig.newBuilder().build()) + .setSubnetId("subnetId-2066159272") + .setAutoscaling(AzureNodePoolAutoscaling.newBuilder().build()) + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setMaxPodsConstraint(MaxPodsConstraint.newBuilder().build()) + .setAzureAvailabilityZone("azureAvailabilityZone-304222122") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createAzureNodePoolTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + AzureClusterName parent = AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]"); + AzureNodePool azureNodePool = AzureNodePool.newBuilder().build(); + String azureNodePoolId = "azureNodePoolId-1766264088"; + + AzureNodePool actualResponse = + client.createAzureNodePoolAsync(parent, azureNodePool, azureNodePoolId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createAzureNodePoolExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AzureClusterName parent = AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]"); + AzureNodePool azureNodePool = AzureNodePool.newBuilder().build(); + String azureNodePoolId = "azureNodePoolId-1766264088"; + client.createAzureNodePoolAsync(parent, azureNodePool, azureNodePoolId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createAzureNodePoolTest2() throws Exception { + AzureNodePool expectedResponse = + AzureNodePool.newBuilder() + .setName( + AzureNodePoolName.of( + "[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]", "[AZURE_NODE_POOL]") + .toString()) + .setVersion("version351608024") + .setConfig(AzureNodeConfig.newBuilder().build()) + .setSubnetId("subnetId-2066159272") + .setAutoscaling(AzureNodePoolAutoscaling.newBuilder().build()) + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setMaxPodsConstraint(MaxPodsConstraint.newBuilder().build()) + .setAzureAvailabilityZone("azureAvailabilityZone-304222122") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createAzureNodePoolTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-9011/locations/location-9011/azureClusters/azureCluster-9011"; + AzureNodePool azureNodePool = AzureNodePool.newBuilder().build(); + String azureNodePoolId = "azureNodePoolId-1766264088"; + + AzureNodePool actualResponse = + client.createAzureNodePoolAsync(parent, azureNodePool, azureNodePoolId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createAzureNodePoolExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = + "projects/project-9011/locations/location-9011/azureClusters/azureCluster-9011"; + AzureNodePool azureNodePool = AzureNodePool.newBuilder().build(); + String azureNodePoolId = "azureNodePoolId-1766264088"; + client.createAzureNodePoolAsync(parent, azureNodePool, azureNodePoolId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void updateAzureNodePoolTest() throws Exception { + AzureNodePool expectedResponse = + AzureNodePool.newBuilder() + .setName( + AzureNodePoolName.of( + "[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]", "[AZURE_NODE_POOL]") + .toString()) + .setVersion("version351608024") + .setConfig(AzureNodeConfig.newBuilder().build()) + .setSubnetId("subnetId-2066159272") + .setAutoscaling(AzureNodePoolAutoscaling.newBuilder().build()) + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setMaxPodsConstraint(MaxPodsConstraint.newBuilder().build()) + .setAzureAvailabilityZone("azureAvailabilityZone-304222122") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateAzureNodePoolTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + AzureNodePool azureNodePool = + AzureNodePool.newBuilder() + .setName( + AzureNodePoolName.of( + "[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]", "[AZURE_NODE_POOL]") + .toString()) + .setVersion("version351608024") + .setConfig(AzureNodeConfig.newBuilder().build()) + .setSubnetId("subnetId-2066159272") + .setAutoscaling(AzureNodePoolAutoscaling.newBuilder().build()) + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setMaxPodsConstraint(MaxPodsConstraint.newBuilder().build()) + .setAzureAvailabilityZone("azureAvailabilityZone-304222122") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + AzureNodePool actualResponse = client.updateAzureNodePoolAsync(azureNodePool, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateAzureNodePoolExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AzureNodePool azureNodePool = + AzureNodePool.newBuilder() + .setName( + AzureNodePoolName.of( + "[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]", "[AZURE_NODE_POOL]") + .toString()) + .setVersion("version351608024") + .setConfig(AzureNodeConfig.newBuilder().build()) + .setSubnetId("subnetId-2066159272") + .setAutoscaling(AzureNodePoolAutoscaling.newBuilder().build()) + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setMaxPodsConstraint(MaxPodsConstraint.newBuilder().build()) + .setAzureAvailabilityZone("azureAvailabilityZone-304222122") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateAzureNodePoolAsync(azureNodePool, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getAzureNodePoolTest() throws Exception { + AzureNodePool expectedResponse = + AzureNodePool.newBuilder() + .setName( + AzureNodePoolName.of( + "[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]", "[AZURE_NODE_POOL]") + .toString()) + .setVersion("version351608024") + .setConfig(AzureNodeConfig.newBuilder().build()) + .setSubnetId("subnetId-2066159272") + .setAutoscaling(AzureNodePoolAutoscaling.newBuilder().build()) + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setMaxPodsConstraint(MaxPodsConstraint.newBuilder().build()) + .setAzureAvailabilityZone("azureAvailabilityZone-304222122") + .build(); + mockService.addResponse(expectedResponse); + + AzureNodePoolName name = + AzureNodePoolName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]", "[AZURE_NODE_POOL]"); + + AzureNodePool actualResponse = client.getAzureNodePool(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAzureNodePoolExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AzureNodePoolName name = + AzureNodePoolName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]", "[AZURE_NODE_POOL]"); + client.getAzureNodePool(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getAzureNodePoolTest2() throws Exception { + AzureNodePool expectedResponse = + AzureNodePool.newBuilder() + .setName( + AzureNodePoolName.of( + "[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]", "[AZURE_NODE_POOL]") + .toString()) + .setVersion("version351608024") + .setConfig(AzureNodeConfig.newBuilder().build()) + .setSubnetId("subnetId-2066159272") + .setAutoscaling(AzureNodePoolAutoscaling.newBuilder().build()) + .setUid("uid115792") + .setReconciling(true) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .putAllAnnotations(new HashMap()) + .setMaxPodsConstraint(MaxPodsConstraint.newBuilder().build()) + .setAzureAvailabilityZone("azureAvailabilityZone-304222122") + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-2382/locations/location-2382/azureClusters/azureCluster-2382/azureNodePools/azureNodePool-2382"; + + AzureNodePool actualResponse = client.getAzureNodePool(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAzureNodePoolExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-2382/locations/location-2382/azureClusters/azureCluster-2382/azureNodePools/azureNodePool-2382"; + client.getAzureNodePool(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listAzureNodePoolsTest() throws Exception { + AzureNodePool responsesElement = AzureNodePool.newBuilder().build(); + ListAzureNodePoolsResponse expectedResponse = + ListAzureNodePoolsResponse.newBuilder() + .setNextPageToken("") + .addAllAzureNodePools(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + AzureClusterName parent = AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]"); + + ListAzureNodePoolsPagedResponse pagedListResponse = client.listAzureNodePools(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getAzureNodePoolsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listAzureNodePoolsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AzureClusterName parent = AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]"); + client.listAzureNodePools(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listAzureNodePoolsTest2() throws Exception { + AzureNodePool responsesElement = AzureNodePool.newBuilder().build(); + ListAzureNodePoolsResponse expectedResponse = + ListAzureNodePoolsResponse.newBuilder() + .setNextPageToken("") + .addAllAzureNodePools(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-9011/locations/location-9011/azureClusters/azureCluster-9011"; + + ListAzureNodePoolsPagedResponse pagedListResponse = client.listAzureNodePools(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getAzureNodePoolsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listAzureNodePoolsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = + "projects/project-9011/locations/location-9011/azureClusters/azureCluster-9011"; + client.listAzureNodePools(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteAzureNodePoolTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteAzureNodePoolTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + AzureNodePoolName name = + AzureNodePoolName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]", "[AZURE_NODE_POOL]"); + + client.deleteAzureNodePoolAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteAzureNodePoolExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AzureNodePoolName name = + AzureNodePoolName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]", "[AZURE_NODE_POOL]"); + client.deleteAzureNodePoolAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteAzureNodePoolTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteAzureNodePoolTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-2382/locations/location-2382/azureClusters/azureCluster-2382/azureNodePools/azureNodePool-2382"; + + client.deleteAzureNodePoolAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteAzureNodePoolExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-2382/locations/location-2382/azureClusters/azureCluster-2382/azureNodePools/azureNodePool-2382"; + client.deleteAzureNodePoolAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getAzureServerConfigTest() throws Exception { + AzureServerConfig expectedResponse = + AzureServerConfig.newBuilder() + .setName(AzureServerConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .addAllValidVersions(new ArrayList()) + .addAllSupportedAzureRegions(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + AzureServerConfigName name = AzureServerConfigName.of("[PROJECT]", "[LOCATION]"); + + AzureServerConfig actualResponse = client.getAzureServerConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAzureServerConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AzureServerConfigName name = AzureServerConfigName.of("[PROJECT]", "[LOCATION]"); + client.getAzureServerConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getAzureServerConfigTest2() throws Exception { + AzureServerConfig expectedResponse = + AzureServerConfig.newBuilder() + .setName(AzureServerConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .addAllValidVersions(new ArrayList()) + .addAllSupportedAzureRegions(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-9505/locations/location-9505/azureServerConfig"; + + AzureServerConfig actualResponse = client.getAzureServerConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAzureServerConfigExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-9505/locations/location-9505/azureServerConfig"; + client.getAzureServerConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 0000000..107b79b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsClustersSettings; +import com.google.cloud.gkemulticloud.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. + AwsClustersSettings awsClustersSettings = + AwsClustersSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + AwsClustersClient awsClustersClient = AwsClustersClient.create(awsClustersSettings); + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 0000000..b1484b0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_create_setcredentialsprovider1_sync] +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsClustersSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + AwsClustersSettings awsClustersSettings = + AwsClustersSettings.newBuilder() + .setTransportChannelProvider( + AwsClustersSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + AwsClustersClient awsClustersClient = AwsClustersClient.create(awsClustersSettings); + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 0000000..da9cc7f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_create_setendpoint_sync] +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsClustersSettings; +import com.google.cloud.gkemulticloud.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. + AwsClustersSettings awsClustersSettings = + AwsClustersSettings.newBuilder().setEndpoint(myEndpoint).build(); + AwsClustersClient awsClustersClient = AwsClustersClient.create(awsClustersSettings); + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/AsyncCreateAwsCluster.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/AsyncCreateAwsCluster.java new file mode 100644 index 0000000..cd67a9f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/AsyncCreateAwsCluster.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_createawscluster_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AwsCluster; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.CreateAwsClusterRequest; +import com.google.cloud.gkemulticloud.v1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateAwsCluster { + + public static void main(String[] args) throws Exception { + asyncCreateAwsCluster(); + } + + public static void asyncCreateAwsCluster() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + CreateAwsClusterRequest request = + CreateAwsClusterRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setAwsCluster(AwsCluster.newBuilder().build()) + .setAwsClusterId("awsClusterId1988965944") + .setValidateOnly(true) + .build(); + ApiFuture future = + awsClustersClient.createAwsClusterCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_createawscluster_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/AsyncCreateAwsClusterLRO.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/AsyncCreateAwsClusterLRO.java new file mode 100644 index 0000000..bfe9b41 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/AsyncCreateAwsClusterLRO.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_createawscluster_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.gkemulticloud.v1.AwsCluster; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.CreateAwsClusterRequest; +import com.google.cloud.gkemulticloud.v1.LocationName; +import com.google.cloud.gkemulticloud.v1.OperationMetadata; + +public class AsyncCreateAwsClusterLRO { + + public static void main(String[] args) throws Exception { + asyncCreateAwsClusterLRO(); + } + + public static void asyncCreateAwsClusterLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + CreateAwsClusterRequest request = + CreateAwsClusterRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setAwsCluster(AwsCluster.newBuilder().build()) + .setAwsClusterId("awsClusterId1988965944") + .setValidateOnly(true) + .build(); + OperationFuture future = + awsClustersClient.createAwsClusterOperationCallable().futureCall(request); + // Do something. + AwsCluster response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_createawscluster_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/SyncCreateAwsCluster.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/SyncCreateAwsCluster.java new file mode 100644 index 0000000..ec90fb9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/SyncCreateAwsCluster.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_createawscluster_sync] +import com.google.cloud.gkemulticloud.v1.AwsCluster; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.CreateAwsClusterRequest; +import com.google.cloud.gkemulticloud.v1.LocationName; + +public class SyncCreateAwsCluster { + + public static void main(String[] args) throws Exception { + syncCreateAwsCluster(); + } + + public static void syncCreateAwsCluster() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + CreateAwsClusterRequest request = + CreateAwsClusterRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setAwsCluster(AwsCluster.newBuilder().build()) + .setAwsClusterId("awsClusterId1988965944") + .setValidateOnly(true) + .build(); + AwsCluster response = awsClustersClient.createAwsClusterAsync(request).get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_createawscluster_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/SyncCreateAwsClusterLocationnameAwsclusterString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/SyncCreateAwsClusterLocationnameAwsclusterString.java new file mode 100644 index 0000000..35f97db --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/SyncCreateAwsClusterLocationnameAwsclusterString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_createawscluster_locationnameawsclusterstring_sync] +import com.google.cloud.gkemulticloud.v1.AwsCluster; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.LocationName; + +public class SyncCreateAwsClusterLocationnameAwsclusterString { + + public static void main(String[] args) throws Exception { + syncCreateAwsClusterLocationnameAwsclusterString(); + } + + public static void syncCreateAwsClusterLocationnameAwsclusterString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + AwsCluster awsCluster = AwsCluster.newBuilder().build(); + String awsClusterId = "awsClusterId1988965944"; + AwsCluster response = + awsClustersClient.createAwsClusterAsync(parent, awsCluster, awsClusterId).get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_createawscluster_locationnameawsclusterstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/SyncCreateAwsClusterStringAwsclusterString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/SyncCreateAwsClusterStringAwsclusterString.java new file mode 100644 index 0000000..bb6b77e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/SyncCreateAwsClusterStringAwsclusterString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_createawscluster_stringawsclusterstring_sync] +import com.google.cloud.gkemulticloud.v1.AwsCluster; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.LocationName; + +public class SyncCreateAwsClusterStringAwsclusterString { + + public static void main(String[] args) throws Exception { + syncCreateAwsClusterStringAwsclusterString(); + } + + public static void syncCreateAwsClusterStringAwsclusterString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + AwsCluster awsCluster = AwsCluster.newBuilder().build(); + String awsClusterId = "awsClusterId1988965944"; + AwsCluster response = + awsClustersClient.createAwsClusterAsync(parent, awsCluster, awsClusterId).get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_createawscluster_stringawsclusterstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/AsyncCreateAwsNodePool.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/AsyncCreateAwsNodePool.java new file mode 100644 index 0000000..d681f43 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/AsyncCreateAwsNodePool.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_createawsnodepool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AwsClusterName; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePool; +import com.google.cloud.gkemulticloud.v1.CreateAwsNodePoolRequest; +import com.google.longrunning.Operation; + +public class AsyncCreateAwsNodePool { + + public static void main(String[] args) throws Exception { + asyncCreateAwsNodePool(); + } + + public static void asyncCreateAwsNodePool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + CreateAwsNodePoolRequest request = + CreateAwsNodePoolRequest.newBuilder() + .setParent(AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString()) + .setAwsNodePool(AwsNodePool.newBuilder().build()) + .setAwsNodePoolId("awsNodePoolId-1885267498") + .setValidateOnly(true) + .build(); + ApiFuture future = + awsClustersClient.createAwsNodePoolCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_createawsnodepool_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/AsyncCreateAwsNodePoolLRO.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/AsyncCreateAwsNodePoolLRO.java new file mode 100644 index 0000000..053c977 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/AsyncCreateAwsNodePoolLRO.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_createawsnodepool_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.gkemulticloud.v1.AwsClusterName; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePool; +import com.google.cloud.gkemulticloud.v1.CreateAwsNodePoolRequest; +import com.google.cloud.gkemulticloud.v1.OperationMetadata; + +public class AsyncCreateAwsNodePoolLRO { + + public static void main(String[] args) throws Exception { + asyncCreateAwsNodePoolLRO(); + } + + public static void asyncCreateAwsNodePoolLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + CreateAwsNodePoolRequest request = + CreateAwsNodePoolRequest.newBuilder() + .setParent(AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString()) + .setAwsNodePool(AwsNodePool.newBuilder().build()) + .setAwsNodePoolId("awsNodePoolId-1885267498") + .setValidateOnly(true) + .build(); + OperationFuture future = + awsClustersClient.createAwsNodePoolOperationCallable().futureCall(request); + // Do something. + AwsNodePool response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_createawsnodepool_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/SyncCreateAwsNodePool.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/SyncCreateAwsNodePool.java new file mode 100644 index 0000000..efff780 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/SyncCreateAwsNodePool.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_createawsnodepool_sync] +import com.google.cloud.gkemulticloud.v1.AwsClusterName; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePool; +import com.google.cloud.gkemulticloud.v1.CreateAwsNodePoolRequest; + +public class SyncCreateAwsNodePool { + + public static void main(String[] args) throws Exception { + syncCreateAwsNodePool(); + } + + public static void syncCreateAwsNodePool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + CreateAwsNodePoolRequest request = + CreateAwsNodePoolRequest.newBuilder() + .setParent(AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString()) + .setAwsNodePool(AwsNodePool.newBuilder().build()) + .setAwsNodePoolId("awsNodePoolId-1885267498") + .setValidateOnly(true) + .build(); + AwsNodePool response = awsClustersClient.createAwsNodePoolAsync(request).get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_createawsnodepool_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/SyncCreateAwsNodePoolAwsclusternameAwsnodepoolString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/SyncCreateAwsNodePoolAwsclusternameAwsnodepoolString.java new file mode 100644 index 0000000..f7bd087 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/SyncCreateAwsNodePoolAwsclusternameAwsnodepoolString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_createawsnodepool_awsclusternameawsnodepoolstring_sync] +import com.google.cloud.gkemulticloud.v1.AwsClusterName; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePool; + +public class SyncCreateAwsNodePoolAwsclusternameAwsnodepoolString { + + public static void main(String[] args) throws Exception { + syncCreateAwsNodePoolAwsclusternameAwsnodepoolString(); + } + + public static void syncCreateAwsNodePoolAwsclusternameAwsnodepoolString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + AwsClusterName parent = AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]"); + AwsNodePool awsNodePool = AwsNodePool.newBuilder().build(); + String awsNodePoolId = "awsNodePoolId-1885267498"; + AwsNodePool response = + awsClustersClient.createAwsNodePoolAsync(parent, awsNodePool, awsNodePoolId).get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_createawsnodepool_awsclusternameawsnodepoolstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/SyncCreateAwsNodePoolStringAwsnodepoolString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/SyncCreateAwsNodePoolStringAwsnodepoolString.java new file mode 100644 index 0000000..87c1138 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/SyncCreateAwsNodePoolStringAwsnodepoolString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_createawsnodepool_stringawsnodepoolstring_sync] +import com.google.cloud.gkemulticloud.v1.AwsClusterName; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePool; + +public class SyncCreateAwsNodePoolStringAwsnodepoolString { + + public static void main(String[] args) throws Exception { + syncCreateAwsNodePoolStringAwsnodepoolString(); + } + + public static void syncCreateAwsNodePoolStringAwsnodepoolString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + String parent = AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString(); + AwsNodePool awsNodePool = AwsNodePool.newBuilder().build(); + String awsNodePoolId = "awsNodePoolId-1885267498"; + AwsNodePool response = + awsClustersClient.createAwsNodePoolAsync(parent, awsNodePool, awsNodePoolId).get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_createawsnodepool_stringawsnodepoolstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/AsyncDeleteAwsCluster.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/AsyncDeleteAwsCluster.java new file mode 100644 index 0000000..38de192 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/AsyncDeleteAwsCluster.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_deleteawscluster_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AwsClusterName; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.DeleteAwsClusterRequest; +import com.google.longrunning.Operation; + +public class AsyncDeleteAwsCluster { + + public static void main(String[] args) throws Exception { + asyncDeleteAwsCluster(); + } + + public static void asyncDeleteAwsCluster() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + DeleteAwsClusterRequest request = + DeleteAwsClusterRequest.newBuilder() + .setName(AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString()) + .setValidateOnly(true) + .setAllowMissing(true) + .setEtag("etag3123477") + .build(); + ApiFuture future = + awsClustersClient.deleteAwsClusterCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_deleteawscluster_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/AsyncDeleteAwsClusterLRO.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/AsyncDeleteAwsClusterLRO.java new file mode 100644 index 0000000..f01dcc1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/AsyncDeleteAwsClusterLRO.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_deleteawscluster_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.gkemulticloud.v1.AwsClusterName; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.DeleteAwsClusterRequest; +import com.google.cloud.gkemulticloud.v1.OperationMetadata; +import com.google.protobuf.Empty; + +public class AsyncDeleteAwsClusterLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteAwsClusterLRO(); + } + + public static void asyncDeleteAwsClusterLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + DeleteAwsClusterRequest request = + DeleteAwsClusterRequest.newBuilder() + .setName(AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString()) + .setValidateOnly(true) + .setAllowMissing(true) + .setEtag("etag3123477") + .build(); + OperationFuture future = + awsClustersClient.deleteAwsClusterOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_deleteawscluster_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/SyncDeleteAwsCluster.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/SyncDeleteAwsCluster.java new file mode 100644 index 0000000..a1a57dd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/SyncDeleteAwsCluster.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_deleteawscluster_sync] +import com.google.cloud.gkemulticloud.v1.AwsClusterName; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.DeleteAwsClusterRequest; +import com.google.protobuf.Empty; + +public class SyncDeleteAwsCluster { + + public static void main(String[] args) throws Exception { + syncDeleteAwsCluster(); + } + + public static void syncDeleteAwsCluster() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + DeleteAwsClusterRequest request = + DeleteAwsClusterRequest.newBuilder() + .setName(AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString()) + .setValidateOnly(true) + .setAllowMissing(true) + .setEtag("etag3123477") + .build(); + awsClustersClient.deleteAwsClusterAsync(request).get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_deleteawscluster_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/SyncDeleteAwsClusterAwsclustername.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/SyncDeleteAwsClusterAwsclustername.java new file mode 100644 index 0000000..795075a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/SyncDeleteAwsClusterAwsclustername.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_deleteawscluster_awsclustername_sync] +import com.google.cloud.gkemulticloud.v1.AwsClusterName; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.protobuf.Empty; + +public class SyncDeleteAwsClusterAwsclustername { + + public static void main(String[] args) throws Exception { + syncDeleteAwsClusterAwsclustername(); + } + + public static void syncDeleteAwsClusterAwsclustername() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + AwsClusterName name = AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]"); + awsClustersClient.deleteAwsClusterAsync(name).get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_deleteawscluster_awsclustername_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/SyncDeleteAwsClusterString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/SyncDeleteAwsClusterString.java new file mode 100644 index 0000000..e0021a4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/SyncDeleteAwsClusterString.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_deleteawscluster_string_sync] +import com.google.cloud.gkemulticloud.v1.AwsClusterName; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.protobuf.Empty; + +public class SyncDeleteAwsClusterString { + + public static void main(String[] args) throws Exception { + syncDeleteAwsClusterString(); + } + + public static void syncDeleteAwsClusterString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + String name = AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString(); + awsClustersClient.deleteAwsClusterAsync(name).get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_deleteawscluster_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/AsyncDeleteAwsNodePool.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/AsyncDeleteAwsNodePool.java new file mode 100644 index 0000000..6d5560c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/AsyncDeleteAwsNodePool.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_deleteawsnodepool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePoolName; +import com.google.cloud.gkemulticloud.v1.DeleteAwsNodePoolRequest; +import com.google.longrunning.Operation; + +public class AsyncDeleteAwsNodePool { + + public static void main(String[] args) throws Exception { + asyncDeleteAwsNodePool(); + } + + public static void asyncDeleteAwsNodePool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + DeleteAwsNodePoolRequest request = + DeleteAwsNodePoolRequest.newBuilder() + .setName( + AwsNodePoolName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]", "[AWS_NODE_POOL]") + .toString()) + .setValidateOnly(true) + .setAllowMissing(true) + .setEtag("etag3123477") + .build(); + ApiFuture future = + awsClustersClient.deleteAwsNodePoolCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_deleteawsnodepool_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/AsyncDeleteAwsNodePoolLRO.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/AsyncDeleteAwsNodePoolLRO.java new file mode 100644 index 0000000..7805b9e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/AsyncDeleteAwsNodePoolLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_deleteawsnodepool_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePoolName; +import com.google.cloud.gkemulticloud.v1.DeleteAwsNodePoolRequest; +import com.google.cloud.gkemulticloud.v1.OperationMetadata; +import com.google.protobuf.Empty; + +public class AsyncDeleteAwsNodePoolLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteAwsNodePoolLRO(); + } + + public static void asyncDeleteAwsNodePoolLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + DeleteAwsNodePoolRequest request = + DeleteAwsNodePoolRequest.newBuilder() + .setName( + AwsNodePoolName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]", "[AWS_NODE_POOL]") + .toString()) + .setValidateOnly(true) + .setAllowMissing(true) + .setEtag("etag3123477") + .build(); + OperationFuture future = + awsClustersClient.deleteAwsNodePoolOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_deleteawsnodepool_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/SyncDeleteAwsNodePool.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/SyncDeleteAwsNodePool.java new file mode 100644 index 0000000..694616e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/SyncDeleteAwsNodePool.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_deleteawsnodepool_sync] +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePoolName; +import com.google.cloud.gkemulticloud.v1.DeleteAwsNodePoolRequest; +import com.google.protobuf.Empty; + +public class SyncDeleteAwsNodePool { + + public static void main(String[] args) throws Exception { + syncDeleteAwsNodePool(); + } + + public static void syncDeleteAwsNodePool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + DeleteAwsNodePoolRequest request = + DeleteAwsNodePoolRequest.newBuilder() + .setName( + AwsNodePoolName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]", "[AWS_NODE_POOL]") + .toString()) + .setValidateOnly(true) + .setAllowMissing(true) + .setEtag("etag3123477") + .build(); + awsClustersClient.deleteAwsNodePoolAsync(request).get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_deleteawsnodepool_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/SyncDeleteAwsNodePoolAwsnodepoolname.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/SyncDeleteAwsNodePoolAwsnodepoolname.java new file mode 100644 index 0000000..19878ba --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/SyncDeleteAwsNodePoolAwsnodepoolname.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_deleteawsnodepool_awsnodepoolname_sync] +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePoolName; +import com.google.protobuf.Empty; + +public class SyncDeleteAwsNodePoolAwsnodepoolname { + + public static void main(String[] args) throws Exception { + syncDeleteAwsNodePoolAwsnodepoolname(); + } + + public static void syncDeleteAwsNodePoolAwsnodepoolname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + AwsNodePoolName name = + AwsNodePoolName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]", "[AWS_NODE_POOL]"); + awsClustersClient.deleteAwsNodePoolAsync(name).get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_deleteawsnodepool_awsnodepoolname_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/SyncDeleteAwsNodePoolString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/SyncDeleteAwsNodePoolString.java new file mode 100644 index 0000000..2acf9c0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/SyncDeleteAwsNodePoolString.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_deleteawsnodepool_string_sync] +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePoolName; +import com.google.protobuf.Empty; + +public class SyncDeleteAwsNodePoolString { + + public static void main(String[] args) throws Exception { + syncDeleteAwsNodePoolString(); + } + + public static void syncDeleteAwsNodePoolString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + String name = + AwsNodePoolName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]", "[AWS_NODE_POOL]") + .toString(); + awsClustersClient.deleteAwsNodePoolAsync(name).get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_deleteawsnodepool_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/generateawsaccesstoken/AsyncGenerateAwsAccessToken.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/generateawsaccesstoken/AsyncGenerateAwsAccessToken.java new file mode 100644 index 0000000..34a3f3c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/generateawsaccesstoken/AsyncGenerateAwsAccessToken.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_generateawsaccesstoken_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AwsClusterName; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenRequest; +import com.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenResponse; + +public class AsyncGenerateAwsAccessToken { + + public static void main(String[] args) throws Exception { + asyncGenerateAwsAccessToken(); + } + + public static void asyncGenerateAwsAccessToken() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + GenerateAwsAccessTokenRequest request = + GenerateAwsAccessTokenRequest.newBuilder() + .setAwsCluster( + AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString()) + .build(); + ApiFuture future = + awsClustersClient.generateAwsAccessTokenCallable().futureCall(request); + // Do something. + GenerateAwsAccessTokenResponse response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_generateawsaccesstoken_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/generateawsaccesstoken/SyncGenerateAwsAccessToken.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/generateawsaccesstoken/SyncGenerateAwsAccessToken.java new file mode 100644 index 0000000..1032507 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/generateawsaccesstoken/SyncGenerateAwsAccessToken.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_generateawsaccesstoken_sync] +import com.google.cloud.gkemulticloud.v1.AwsClusterName; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenRequest; +import com.google.cloud.gkemulticloud.v1.GenerateAwsAccessTokenResponse; + +public class SyncGenerateAwsAccessToken { + + public static void main(String[] args) throws Exception { + syncGenerateAwsAccessToken(); + } + + public static void syncGenerateAwsAccessToken() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + GenerateAwsAccessTokenRequest request = + GenerateAwsAccessTokenRequest.newBuilder() + .setAwsCluster( + AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString()) + .build(); + GenerateAwsAccessTokenResponse response = awsClustersClient.generateAwsAccessToken(request); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_generateawsaccesstoken_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawscluster/AsyncGetAwsCluster.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawscluster/AsyncGetAwsCluster.java new file mode 100644 index 0000000..f6d25a6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawscluster/AsyncGetAwsCluster.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_getawscluster_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AwsCluster; +import com.google.cloud.gkemulticloud.v1.AwsClusterName; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.GetAwsClusterRequest; + +public class AsyncGetAwsCluster { + + public static void main(String[] args) throws Exception { + asyncGetAwsCluster(); + } + + public static void asyncGetAwsCluster() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + GetAwsClusterRequest request = + GetAwsClusterRequest.newBuilder() + .setName(AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString()) + .build(); + ApiFuture future = awsClustersClient.getAwsClusterCallable().futureCall(request); + // Do something. + AwsCluster response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_getawscluster_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawscluster/SyncGetAwsCluster.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawscluster/SyncGetAwsCluster.java new file mode 100644 index 0000000..8a369dd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawscluster/SyncGetAwsCluster.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_getawscluster_sync] +import com.google.cloud.gkemulticloud.v1.AwsCluster; +import com.google.cloud.gkemulticloud.v1.AwsClusterName; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.GetAwsClusterRequest; + +public class SyncGetAwsCluster { + + public static void main(String[] args) throws Exception { + syncGetAwsCluster(); + } + + public static void syncGetAwsCluster() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + GetAwsClusterRequest request = + GetAwsClusterRequest.newBuilder() + .setName(AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString()) + .build(); + AwsCluster response = awsClustersClient.getAwsCluster(request); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_getawscluster_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawscluster/SyncGetAwsClusterAwsclustername.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawscluster/SyncGetAwsClusterAwsclustername.java new file mode 100644 index 0000000..dfbeb33 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawscluster/SyncGetAwsClusterAwsclustername.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_getawscluster_awsclustername_sync] +import com.google.cloud.gkemulticloud.v1.AwsCluster; +import com.google.cloud.gkemulticloud.v1.AwsClusterName; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; + +public class SyncGetAwsClusterAwsclustername { + + public static void main(String[] args) throws Exception { + syncGetAwsClusterAwsclustername(); + } + + public static void syncGetAwsClusterAwsclustername() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + AwsClusterName name = AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]"); + AwsCluster response = awsClustersClient.getAwsCluster(name); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_getawscluster_awsclustername_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawscluster/SyncGetAwsClusterString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawscluster/SyncGetAwsClusterString.java new file mode 100644 index 0000000..507447c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawscluster/SyncGetAwsClusterString.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_getawscluster_string_sync] +import com.google.cloud.gkemulticloud.v1.AwsCluster; +import com.google.cloud.gkemulticloud.v1.AwsClusterName; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; + +public class SyncGetAwsClusterString { + + public static void main(String[] args) throws Exception { + syncGetAwsClusterString(); + } + + public static void syncGetAwsClusterString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + String name = AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString(); + AwsCluster response = awsClustersClient.getAwsCluster(name); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_getawscluster_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsnodepool/AsyncGetAwsNodePool.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsnodepool/AsyncGetAwsNodePool.java new file mode 100644 index 0000000..3d35edd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsnodepool/AsyncGetAwsNodePool.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_getawsnodepool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePool; +import com.google.cloud.gkemulticloud.v1.AwsNodePoolName; +import com.google.cloud.gkemulticloud.v1.GetAwsNodePoolRequest; + +public class AsyncGetAwsNodePool { + + public static void main(String[] args) throws Exception { + asyncGetAwsNodePool(); + } + + public static void asyncGetAwsNodePool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + GetAwsNodePoolRequest request = + GetAwsNodePoolRequest.newBuilder() + .setName( + AwsNodePoolName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]", "[AWS_NODE_POOL]") + .toString()) + .build(); + ApiFuture future = + awsClustersClient.getAwsNodePoolCallable().futureCall(request); + // Do something. + AwsNodePool response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_getawsnodepool_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsnodepool/SyncGetAwsNodePool.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsnodepool/SyncGetAwsNodePool.java new file mode 100644 index 0000000..8a8a3e2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsnodepool/SyncGetAwsNodePool.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_getawsnodepool_sync] +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePool; +import com.google.cloud.gkemulticloud.v1.AwsNodePoolName; +import com.google.cloud.gkemulticloud.v1.GetAwsNodePoolRequest; + +public class SyncGetAwsNodePool { + + public static void main(String[] args) throws Exception { + syncGetAwsNodePool(); + } + + public static void syncGetAwsNodePool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + GetAwsNodePoolRequest request = + GetAwsNodePoolRequest.newBuilder() + .setName( + AwsNodePoolName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]", "[AWS_NODE_POOL]") + .toString()) + .build(); + AwsNodePool response = awsClustersClient.getAwsNodePool(request); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_getawsnodepool_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsnodepool/SyncGetAwsNodePoolAwsnodepoolname.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsnodepool/SyncGetAwsNodePoolAwsnodepoolname.java new file mode 100644 index 0000000..16d8e29 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsnodepool/SyncGetAwsNodePoolAwsnodepoolname.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_getawsnodepool_awsnodepoolname_sync] +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePool; +import com.google.cloud.gkemulticloud.v1.AwsNodePoolName; + +public class SyncGetAwsNodePoolAwsnodepoolname { + + public static void main(String[] args) throws Exception { + syncGetAwsNodePoolAwsnodepoolname(); + } + + public static void syncGetAwsNodePoolAwsnodepoolname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + AwsNodePoolName name = + AwsNodePoolName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]", "[AWS_NODE_POOL]"); + AwsNodePool response = awsClustersClient.getAwsNodePool(name); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_getawsnodepool_awsnodepoolname_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsnodepool/SyncGetAwsNodePoolString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsnodepool/SyncGetAwsNodePoolString.java new file mode 100644 index 0000000..b0138c4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsnodepool/SyncGetAwsNodePoolString.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_getawsnodepool_string_sync] +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePool; +import com.google.cloud.gkemulticloud.v1.AwsNodePoolName; + +public class SyncGetAwsNodePoolString { + + public static void main(String[] args) throws Exception { + syncGetAwsNodePoolString(); + } + + public static void syncGetAwsNodePoolString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + String name = + AwsNodePoolName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]", "[AWS_NODE_POOL]") + .toString(); + AwsNodePool response = awsClustersClient.getAwsNodePool(name); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_getawsnodepool_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsserverconfig/AsyncGetAwsServerConfig.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsserverconfig/AsyncGetAwsServerConfig.java new file mode 100644 index 0000000..11703b3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsserverconfig/AsyncGetAwsServerConfig.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_getawsserverconfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsServerConfig; +import com.google.cloud.gkemulticloud.v1.AwsServerConfigName; +import com.google.cloud.gkemulticloud.v1.GetAwsServerConfigRequest; + +public class AsyncGetAwsServerConfig { + + public static void main(String[] args) throws Exception { + asyncGetAwsServerConfig(); + } + + public static void asyncGetAwsServerConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + GetAwsServerConfigRequest request = + GetAwsServerConfigRequest.newBuilder() + .setName(AwsServerConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + awsClustersClient.getAwsServerConfigCallable().futureCall(request); + // Do something. + AwsServerConfig response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_getawsserverconfig_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsserverconfig/SyncGetAwsServerConfig.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsserverconfig/SyncGetAwsServerConfig.java new file mode 100644 index 0000000..a100ea9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsserverconfig/SyncGetAwsServerConfig.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_getawsserverconfig_sync] +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsServerConfig; +import com.google.cloud.gkemulticloud.v1.AwsServerConfigName; +import com.google.cloud.gkemulticloud.v1.GetAwsServerConfigRequest; + +public class SyncGetAwsServerConfig { + + public static void main(String[] args) throws Exception { + syncGetAwsServerConfig(); + } + + public static void syncGetAwsServerConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + GetAwsServerConfigRequest request = + GetAwsServerConfigRequest.newBuilder() + .setName(AwsServerConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + AwsServerConfig response = awsClustersClient.getAwsServerConfig(request); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_getawsserverconfig_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsserverconfig/SyncGetAwsServerConfigAwsserverconfigname.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsserverconfig/SyncGetAwsServerConfigAwsserverconfigname.java new file mode 100644 index 0000000..2fe7dd5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsserverconfig/SyncGetAwsServerConfigAwsserverconfigname.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_getawsserverconfig_awsserverconfigname_sync] +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsServerConfig; +import com.google.cloud.gkemulticloud.v1.AwsServerConfigName; + +public class SyncGetAwsServerConfigAwsserverconfigname { + + public static void main(String[] args) throws Exception { + syncGetAwsServerConfigAwsserverconfigname(); + } + + public static void syncGetAwsServerConfigAwsserverconfigname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + AwsServerConfigName name = AwsServerConfigName.of("[PROJECT]", "[LOCATION]"); + AwsServerConfig response = awsClustersClient.getAwsServerConfig(name); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_getawsserverconfig_awsserverconfigname_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsserverconfig/SyncGetAwsServerConfigString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsserverconfig/SyncGetAwsServerConfigString.java new file mode 100644 index 0000000..cfd3543 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsserverconfig/SyncGetAwsServerConfigString.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_getawsserverconfig_string_sync] +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsServerConfig; +import com.google.cloud.gkemulticloud.v1.AwsServerConfigName; + +public class SyncGetAwsServerConfigString { + + public static void main(String[] args) throws Exception { + syncGetAwsServerConfigString(); + } + + public static void syncGetAwsServerConfigString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + String name = AwsServerConfigName.of("[PROJECT]", "[LOCATION]").toString(); + AwsServerConfig response = awsClustersClient.getAwsServerConfig(name); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_getawsserverconfig_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/AsyncListAwsClusters.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/AsyncListAwsClusters.java new file mode 100644 index 0000000..59f44f3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/AsyncListAwsClusters.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_listawsclusters_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AwsCluster; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.ListAwsClustersRequest; +import com.google.cloud.gkemulticloud.v1.LocationName; + +public class AsyncListAwsClusters { + + public static void main(String[] args) throws Exception { + asyncListAwsClusters(); + } + + public static void asyncListAwsClusters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + ListAwsClustersRequest request = + ListAwsClustersRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + awsClustersClient.listAwsClustersPagedCallable().futureCall(request); + // Do something. + for (AwsCluster element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_listawsclusters_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/AsyncListAwsClustersPaged.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/AsyncListAwsClustersPaged.java new file mode 100644 index 0000000..9c3e04d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/AsyncListAwsClustersPaged.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_listawsclusters_paged_async] +import com.google.cloud.gkemulticloud.v1.AwsCluster; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.ListAwsClustersRequest; +import com.google.cloud.gkemulticloud.v1.ListAwsClustersResponse; +import com.google.cloud.gkemulticloud.v1.LocationName; +import com.google.common.base.Strings; + +public class AsyncListAwsClustersPaged { + + public static void main(String[] args) throws Exception { + asyncListAwsClustersPaged(); + } + + public static void asyncListAwsClustersPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + ListAwsClustersRequest request = + ListAwsClustersRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListAwsClustersResponse response = + awsClustersClient.listAwsClustersCallable().call(request); + for (AwsCluster element : response.getAwsClustersList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_listawsclusters_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/SyncListAwsClusters.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/SyncListAwsClusters.java new file mode 100644 index 0000000..624ac85 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/SyncListAwsClusters.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_listawsclusters_sync] +import com.google.cloud.gkemulticloud.v1.AwsCluster; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.ListAwsClustersRequest; +import com.google.cloud.gkemulticloud.v1.LocationName; + +public class SyncListAwsClusters { + + public static void main(String[] args) throws Exception { + syncListAwsClusters(); + } + + public static void syncListAwsClusters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + ListAwsClustersRequest request = + ListAwsClustersRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (AwsCluster element : awsClustersClient.listAwsClusters(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_listawsclusters_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/SyncListAwsClustersLocationname.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/SyncListAwsClustersLocationname.java new file mode 100644 index 0000000..24e2089 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/SyncListAwsClustersLocationname.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_listawsclusters_locationname_sync] +import com.google.cloud.gkemulticloud.v1.AwsCluster; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.LocationName; + +public class SyncListAwsClustersLocationname { + + public static void main(String[] args) throws Exception { + syncListAwsClustersLocationname(); + } + + public static void syncListAwsClustersLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (AwsCluster element : awsClustersClient.listAwsClusters(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_listawsclusters_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/SyncListAwsClustersString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/SyncListAwsClustersString.java new file mode 100644 index 0000000..5d35714 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/SyncListAwsClustersString.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_listawsclusters_string_sync] +import com.google.cloud.gkemulticloud.v1.AwsCluster; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.LocationName; + +public class SyncListAwsClustersString { + + public static void main(String[] args) throws Exception { + syncListAwsClustersString(); + } + + public static void syncListAwsClustersString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (AwsCluster element : awsClustersClient.listAwsClusters(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_listawsclusters_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/AsyncListAwsNodePools.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/AsyncListAwsNodePools.java new file mode 100644 index 0000000..26ebfc5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/AsyncListAwsNodePools.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_listawsnodepools_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AwsClusterName; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePool; +import com.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest; + +public class AsyncListAwsNodePools { + + public static void main(String[] args) throws Exception { + asyncListAwsNodePools(); + } + + public static void asyncListAwsNodePools() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + ListAwsNodePoolsRequest request = + ListAwsNodePoolsRequest.newBuilder() + .setParent(AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + awsClustersClient.listAwsNodePoolsPagedCallable().futureCall(request); + // Do something. + for (AwsNodePool element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_listawsnodepools_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/AsyncListAwsNodePoolsPaged.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/AsyncListAwsNodePoolsPaged.java new file mode 100644 index 0000000..cbbc89f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/AsyncListAwsNodePoolsPaged.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_listawsnodepools_paged_async] +import com.google.cloud.gkemulticloud.v1.AwsClusterName; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePool; +import com.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest; +import com.google.cloud.gkemulticloud.v1.ListAwsNodePoolsResponse; +import com.google.common.base.Strings; + +public class AsyncListAwsNodePoolsPaged { + + public static void main(String[] args) throws Exception { + asyncListAwsNodePoolsPaged(); + } + + public static void asyncListAwsNodePoolsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + ListAwsNodePoolsRequest request = + ListAwsNodePoolsRequest.newBuilder() + .setParent(AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListAwsNodePoolsResponse response = + awsClustersClient.listAwsNodePoolsCallable().call(request); + for (AwsNodePool element : response.getAwsNodePoolsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_listawsnodepools_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/SyncListAwsNodePools.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/SyncListAwsNodePools.java new file mode 100644 index 0000000..49e9ee1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/SyncListAwsNodePools.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_listawsnodepools_sync] +import com.google.cloud.gkemulticloud.v1.AwsClusterName; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePool; +import com.google.cloud.gkemulticloud.v1.ListAwsNodePoolsRequest; + +public class SyncListAwsNodePools { + + public static void main(String[] args) throws Exception { + syncListAwsNodePools(); + } + + public static void syncListAwsNodePools() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + ListAwsNodePoolsRequest request = + ListAwsNodePoolsRequest.newBuilder() + .setParent(AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (AwsNodePool element : awsClustersClient.listAwsNodePools(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_listawsnodepools_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/SyncListAwsNodePoolsAwsclustername.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/SyncListAwsNodePoolsAwsclustername.java new file mode 100644 index 0000000..1059e69 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/SyncListAwsNodePoolsAwsclustername.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_listawsnodepools_awsclustername_sync] +import com.google.cloud.gkemulticloud.v1.AwsClusterName; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePool; + +public class SyncListAwsNodePoolsAwsclustername { + + public static void main(String[] args) throws Exception { + syncListAwsNodePoolsAwsclustername(); + } + + public static void syncListAwsNodePoolsAwsclustername() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + AwsClusterName parent = AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]"); + for (AwsNodePool element : awsClustersClient.listAwsNodePools(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_listawsnodepools_awsclustername_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/SyncListAwsNodePoolsString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/SyncListAwsNodePoolsString.java new file mode 100644 index 0000000..3025d76 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/SyncListAwsNodePoolsString.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_listawsnodepools_string_sync] +import com.google.cloud.gkemulticloud.v1.AwsClusterName; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePool; + +public class SyncListAwsNodePoolsString { + + public static void main(String[] args) throws Exception { + syncListAwsNodePoolsString(); + } + + public static void syncListAwsNodePoolsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + String parent = AwsClusterName.of("[PROJECT]", "[LOCATION]", "[AWS_CLUSTER]").toString(); + for (AwsNodePool element : awsClustersClient.listAwsNodePools(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_listawsnodepools_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawscluster/AsyncUpdateAwsCluster.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawscluster/AsyncUpdateAwsCluster.java new file mode 100644 index 0000000..204ff52 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawscluster/AsyncUpdateAwsCluster.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_updateawscluster_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AwsCluster; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.UpdateAwsClusterRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateAwsCluster { + + public static void main(String[] args) throws Exception { + asyncUpdateAwsCluster(); + } + + public static void asyncUpdateAwsCluster() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + UpdateAwsClusterRequest request = + UpdateAwsClusterRequest.newBuilder() + .setAwsCluster(AwsCluster.newBuilder().build()) + .setValidateOnly(true) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + awsClustersClient.updateAwsClusterCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_updateawscluster_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawscluster/AsyncUpdateAwsClusterLRO.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawscluster/AsyncUpdateAwsClusterLRO.java new file mode 100644 index 0000000..bfeebcf --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawscluster/AsyncUpdateAwsClusterLRO.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_updateawscluster_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.gkemulticloud.v1.AwsCluster; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.OperationMetadata; +import com.google.cloud.gkemulticloud.v1.UpdateAwsClusterRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateAwsClusterLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateAwsClusterLRO(); + } + + public static void asyncUpdateAwsClusterLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + UpdateAwsClusterRequest request = + UpdateAwsClusterRequest.newBuilder() + .setAwsCluster(AwsCluster.newBuilder().build()) + .setValidateOnly(true) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + awsClustersClient.updateAwsClusterOperationCallable().futureCall(request); + // Do something. + AwsCluster response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_updateawscluster_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawscluster/SyncUpdateAwsCluster.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawscluster/SyncUpdateAwsCluster.java new file mode 100644 index 0000000..82d0e86 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawscluster/SyncUpdateAwsCluster.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_updateawscluster_sync] +import com.google.cloud.gkemulticloud.v1.AwsCluster; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.UpdateAwsClusterRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateAwsCluster { + + public static void main(String[] args) throws Exception { + syncUpdateAwsCluster(); + } + + public static void syncUpdateAwsCluster() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + UpdateAwsClusterRequest request = + UpdateAwsClusterRequest.newBuilder() + .setAwsCluster(AwsCluster.newBuilder().build()) + .setValidateOnly(true) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + AwsCluster response = awsClustersClient.updateAwsClusterAsync(request).get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_updateawscluster_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawscluster/SyncUpdateAwsClusterAwsclusterFieldmask.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawscluster/SyncUpdateAwsClusterAwsclusterFieldmask.java new file mode 100644 index 0000000..b93a115 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawscluster/SyncUpdateAwsClusterAwsclusterFieldmask.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_updateawscluster_awsclusterfieldmask_sync] +import com.google.cloud.gkemulticloud.v1.AwsCluster; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateAwsClusterAwsclusterFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateAwsClusterAwsclusterFieldmask(); + } + + public static void syncUpdateAwsClusterAwsclusterFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + AwsCluster awsCluster = AwsCluster.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + AwsCluster response = awsClustersClient.updateAwsClusterAsync(awsCluster, updateMask).get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_updateawscluster_awsclusterfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawsnodepool/AsyncUpdateAwsNodePool.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawsnodepool/AsyncUpdateAwsNodePool.java new file mode 100644 index 0000000..b00ee7a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawsnodepool/AsyncUpdateAwsNodePool.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_updateawsnodepool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePool; +import com.google.cloud.gkemulticloud.v1.UpdateAwsNodePoolRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateAwsNodePool { + + public static void main(String[] args) throws Exception { + asyncUpdateAwsNodePool(); + } + + public static void asyncUpdateAwsNodePool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + UpdateAwsNodePoolRequest request = + UpdateAwsNodePoolRequest.newBuilder() + .setAwsNodePool(AwsNodePool.newBuilder().build()) + .setValidateOnly(true) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + awsClustersClient.updateAwsNodePoolCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_updateawsnodepool_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawsnodepool/AsyncUpdateAwsNodePoolLRO.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawsnodepool/AsyncUpdateAwsNodePoolLRO.java new file mode 100644 index 0000000..8f9f264 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawsnodepool/AsyncUpdateAwsNodePoolLRO.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_updateawsnodepool_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePool; +import com.google.cloud.gkemulticloud.v1.OperationMetadata; +import com.google.cloud.gkemulticloud.v1.UpdateAwsNodePoolRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateAwsNodePoolLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateAwsNodePoolLRO(); + } + + public static void asyncUpdateAwsNodePoolLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + UpdateAwsNodePoolRequest request = + UpdateAwsNodePoolRequest.newBuilder() + .setAwsNodePool(AwsNodePool.newBuilder().build()) + .setValidateOnly(true) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + awsClustersClient.updateAwsNodePoolOperationCallable().futureCall(request); + // Do something. + AwsNodePool response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_updateawsnodepool_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawsnodepool/SyncUpdateAwsNodePool.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawsnodepool/SyncUpdateAwsNodePool.java new file mode 100644 index 0000000..e132501 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawsnodepool/SyncUpdateAwsNodePool.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_updateawsnodepool_sync] +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePool; +import com.google.cloud.gkemulticloud.v1.UpdateAwsNodePoolRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateAwsNodePool { + + public static void main(String[] args) throws Exception { + syncUpdateAwsNodePool(); + } + + public static void syncUpdateAwsNodePool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + UpdateAwsNodePoolRequest request = + UpdateAwsNodePoolRequest.newBuilder() + .setAwsNodePool(AwsNodePool.newBuilder().build()) + .setValidateOnly(true) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + AwsNodePool response = awsClustersClient.updateAwsNodePoolAsync(request).get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_updateawsnodepool_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawsnodepool/SyncUpdateAwsNodePoolAwsnodepoolFieldmask.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawsnodepool/SyncUpdateAwsNodePoolAwsnodepoolFieldmask.java new file mode 100644 index 0000000..3f8052b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawsnodepool/SyncUpdateAwsNodePoolAwsnodepoolFieldmask.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclustersclient_updateawsnodepool_awsnodepoolfieldmask_sync] +import com.google.cloud.gkemulticloud.v1.AwsClustersClient; +import com.google.cloud.gkemulticloud.v1.AwsNodePool; +import com.google.protobuf.FieldMask; + +public class SyncUpdateAwsNodePoolAwsnodepoolFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateAwsNodePoolAwsnodepoolFieldmask(); + } + + public static void syncUpdateAwsNodePoolAwsnodepoolFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AwsClustersClient awsClustersClient = AwsClustersClient.create()) { + AwsNodePool awsNodePool = AwsNodePool.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + AwsNodePool response = + awsClustersClient.updateAwsNodePoolAsync(awsNodePool, updateMask).get(); + } + } +} +// [END gkemulticloud_v1_generated_awsclustersclient_updateawsnodepool_awsnodepoolfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclusterssettings/getawscluster/SyncGetAwsCluster.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclusterssettings/getawscluster/SyncGetAwsCluster.java new file mode 100644 index 0000000..7a72be5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclusterssettings/getawscluster/SyncGetAwsCluster.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_awsclusterssettings_getawscluster_sync] +import com.google.cloud.gkemulticloud.v1.AwsClustersSettings; +import java.time.Duration; + +public class SyncGetAwsCluster { + + public static void main(String[] args) throws Exception { + syncGetAwsCluster(); + } + + public static void syncGetAwsCluster() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + AwsClustersSettings.Builder awsClustersSettingsBuilder = AwsClustersSettings.newBuilder(); + awsClustersSettingsBuilder + .getAwsClusterSettings() + .setRetrySettings( + awsClustersSettingsBuilder + .getAwsClusterSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + AwsClustersSettings awsClustersSettings = awsClustersSettingsBuilder.build(); + } +} +// [END gkemulticloud_v1_generated_awsclusterssettings_getawscluster_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 0000000..d28792b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureClustersSettings; +import com.google.cloud.gkemulticloud.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. + AzureClustersSettings azureClustersSettings = + AzureClustersSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + AzureClustersClient azureClustersClient = AzureClustersClient.create(azureClustersSettings); + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 0000000..c200d79 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_create_setcredentialsprovider1_sync] +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureClustersSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + AzureClustersSettings azureClustersSettings = + AzureClustersSettings.newBuilder() + .setTransportChannelProvider( + AzureClustersSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + AzureClustersClient azureClustersClient = AzureClustersClient.create(azureClustersSettings); + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 0000000..f76ac68 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_create_setendpoint_sync] +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureClustersSettings; +import com.google.cloud.gkemulticloud.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. + AzureClustersSettings azureClustersSettings = + AzureClustersSettings.newBuilder().setEndpoint(myEndpoint).build(); + AzureClustersClient azureClustersClient = AzureClustersClient.create(azureClustersSettings); + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/AsyncCreateAzureClient.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/AsyncCreateAzureClient.java new file mode 100644 index 0000000..d8efbf4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/AsyncCreateAzureClient.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_createazureclient_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AzureClient; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.CreateAzureClientRequest; +import com.google.cloud.gkemulticloud.v1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateAzureClient { + + public static void main(String[] args) throws Exception { + asyncCreateAzureClient(); + } + + public static void asyncCreateAzureClient() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + CreateAzureClientRequest request = + CreateAzureClientRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setAzureClient(AzureClient.newBuilder().build()) + .setAzureClientId("azureClientId-1735934475") + .setValidateOnly(true) + .build(); + ApiFuture future = + azureClustersClient.createAzureClientCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_createazureclient_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/AsyncCreateAzureClientLRO.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/AsyncCreateAzureClientLRO.java new file mode 100644 index 0000000..c609eea --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/AsyncCreateAzureClientLRO.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_createazureclient_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.gkemulticloud.v1.AzureClient; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.CreateAzureClientRequest; +import com.google.cloud.gkemulticloud.v1.LocationName; +import com.google.cloud.gkemulticloud.v1.OperationMetadata; + +public class AsyncCreateAzureClientLRO { + + public static void main(String[] args) throws Exception { + asyncCreateAzureClientLRO(); + } + + public static void asyncCreateAzureClientLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + CreateAzureClientRequest request = + CreateAzureClientRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setAzureClient(AzureClient.newBuilder().build()) + .setAzureClientId("azureClientId-1735934475") + .setValidateOnly(true) + .build(); + OperationFuture future = + azureClustersClient.createAzureClientOperationCallable().futureCall(request); + // Do something. + AzureClient response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_createazureclient_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/SyncCreateAzureClient.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/SyncCreateAzureClient.java new file mode 100644 index 0000000..03df9f8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/SyncCreateAzureClient.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_createazureclient_sync] +import com.google.cloud.gkemulticloud.v1.AzureClient; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.CreateAzureClientRequest; +import com.google.cloud.gkemulticloud.v1.LocationName; + +public class SyncCreateAzureClient { + + public static void main(String[] args) throws Exception { + syncCreateAzureClient(); + } + + public static void syncCreateAzureClient() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + CreateAzureClientRequest request = + CreateAzureClientRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setAzureClient(AzureClient.newBuilder().build()) + .setAzureClientId("azureClientId-1735934475") + .setValidateOnly(true) + .build(); + AzureClient response = azureClustersClient.createAzureClientAsync(request).get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_createazureclient_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/SyncCreateAzureClientLocationnameAzureclientString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/SyncCreateAzureClientLocationnameAzureclientString.java new file mode 100644 index 0000000..b0fd0ac --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/SyncCreateAzureClientLocationnameAzureclientString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_createazureclient_locationnameazureclientstring_sync] +import com.google.cloud.gkemulticloud.v1.AzureClient; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.LocationName; + +public class SyncCreateAzureClientLocationnameAzureclientString { + + public static void main(String[] args) throws Exception { + syncCreateAzureClientLocationnameAzureclientString(); + } + + public static void syncCreateAzureClientLocationnameAzureclientString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + AzureClient azureClient = AzureClient.newBuilder().build(); + String azureClientId = "azureClientId-1735934475"; + AzureClient response = + azureClustersClient.createAzureClientAsync(parent, azureClient, azureClientId).get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_createazureclient_locationnameazureclientstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/SyncCreateAzureClientStringAzureclientString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/SyncCreateAzureClientStringAzureclientString.java new file mode 100644 index 0000000..603a898 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/SyncCreateAzureClientStringAzureclientString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_createazureclient_stringazureclientstring_sync] +import com.google.cloud.gkemulticloud.v1.AzureClient; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.LocationName; + +public class SyncCreateAzureClientStringAzureclientString { + + public static void main(String[] args) throws Exception { + syncCreateAzureClientStringAzureclientString(); + } + + public static void syncCreateAzureClientStringAzureclientString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + AzureClient azureClient = AzureClient.newBuilder().build(); + String azureClientId = "azureClientId-1735934475"; + AzureClient response = + azureClustersClient.createAzureClientAsync(parent, azureClient, azureClientId).get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_createazureclient_stringazureclientstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/AsyncCreateAzureCluster.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/AsyncCreateAzureCluster.java new file mode 100644 index 0000000..327e180 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/AsyncCreateAzureCluster.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_createazurecluster_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AzureCluster; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.CreateAzureClusterRequest; +import com.google.cloud.gkemulticloud.v1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateAzureCluster { + + public static void main(String[] args) throws Exception { + asyncCreateAzureCluster(); + } + + public static void asyncCreateAzureCluster() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + CreateAzureClusterRequest request = + CreateAzureClusterRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setAzureCluster(AzureCluster.newBuilder().build()) + .setAzureClusterId("azureClusterId191689446") + .setValidateOnly(true) + .build(); + ApiFuture future = + azureClustersClient.createAzureClusterCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_createazurecluster_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/AsyncCreateAzureClusterLRO.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/AsyncCreateAzureClusterLRO.java new file mode 100644 index 0000000..5763903 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/AsyncCreateAzureClusterLRO.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_createazurecluster_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.gkemulticloud.v1.AzureCluster; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.CreateAzureClusterRequest; +import com.google.cloud.gkemulticloud.v1.LocationName; +import com.google.cloud.gkemulticloud.v1.OperationMetadata; + +public class AsyncCreateAzureClusterLRO { + + public static void main(String[] args) throws Exception { + asyncCreateAzureClusterLRO(); + } + + public static void asyncCreateAzureClusterLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + CreateAzureClusterRequest request = + CreateAzureClusterRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setAzureCluster(AzureCluster.newBuilder().build()) + .setAzureClusterId("azureClusterId191689446") + .setValidateOnly(true) + .build(); + OperationFuture future = + azureClustersClient.createAzureClusterOperationCallable().futureCall(request); + // Do something. + AzureCluster response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_createazurecluster_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/SyncCreateAzureCluster.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/SyncCreateAzureCluster.java new file mode 100644 index 0000000..665f95f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/SyncCreateAzureCluster.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_createazurecluster_sync] +import com.google.cloud.gkemulticloud.v1.AzureCluster; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.CreateAzureClusterRequest; +import com.google.cloud.gkemulticloud.v1.LocationName; + +public class SyncCreateAzureCluster { + + public static void main(String[] args) throws Exception { + syncCreateAzureCluster(); + } + + public static void syncCreateAzureCluster() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + CreateAzureClusterRequest request = + CreateAzureClusterRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setAzureCluster(AzureCluster.newBuilder().build()) + .setAzureClusterId("azureClusterId191689446") + .setValidateOnly(true) + .build(); + AzureCluster response = azureClustersClient.createAzureClusterAsync(request).get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_createazurecluster_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/SyncCreateAzureClusterLocationnameAzureclusterString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/SyncCreateAzureClusterLocationnameAzureclusterString.java new file mode 100644 index 0000000..f6b5501 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/SyncCreateAzureClusterLocationnameAzureclusterString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_createazurecluster_locationnameazureclusterstring_sync] +import com.google.cloud.gkemulticloud.v1.AzureCluster; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.LocationName; + +public class SyncCreateAzureClusterLocationnameAzureclusterString { + + public static void main(String[] args) throws Exception { + syncCreateAzureClusterLocationnameAzureclusterString(); + } + + public static void syncCreateAzureClusterLocationnameAzureclusterString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + AzureCluster azureCluster = AzureCluster.newBuilder().build(); + String azureClusterId = "azureClusterId191689446"; + AzureCluster response = + azureClustersClient.createAzureClusterAsync(parent, azureCluster, azureClusterId).get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_createazurecluster_locationnameazureclusterstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/SyncCreateAzureClusterStringAzureclusterString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/SyncCreateAzureClusterStringAzureclusterString.java new file mode 100644 index 0000000..18f2985 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/SyncCreateAzureClusterStringAzureclusterString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_createazurecluster_stringazureclusterstring_sync] +import com.google.cloud.gkemulticloud.v1.AzureCluster; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.LocationName; + +public class SyncCreateAzureClusterStringAzureclusterString { + + public static void main(String[] args) throws Exception { + syncCreateAzureClusterStringAzureclusterString(); + } + + public static void syncCreateAzureClusterStringAzureclusterString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + AzureCluster azureCluster = AzureCluster.newBuilder().build(); + String azureClusterId = "azureClusterId191689446"; + AzureCluster response = + azureClustersClient.createAzureClusterAsync(parent, azureCluster, azureClusterId).get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_createazurecluster_stringazureclusterstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/AsyncCreateAzureNodePool.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/AsyncCreateAzureNodePool.java new file mode 100644 index 0000000..6610ac6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/AsyncCreateAzureNodePool.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_createazurenodepool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AzureClusterName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePool; +import com.google.cloud.gkemulticloud.v1.CreateAzureNodePoolRequest; +import com.google.longrunning.Operation; + +public class AsyncCreateAzureNodePool { + + public static void main(String[] args) throws Exception { + asyncCreateAzureNodePool(); + } + + public static void asyncCreateAzureNodePool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + CreateAzureNodePoolRequest request = + CreateAzureNodePoolRequest.newBuilder() + .setParent( + AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString()) + .setAzureNodePool(AzureNodePool.newBuilder().build()) + .setAzureNodePoolId("azureNodePoolId-1766264088") + .setValidateOnly(true) + .build(); + ApiFuture future = + azureClustersClient.createAzureNodePoolCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_createazurenodepool_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/AsyncCreateAzureNodePoolLRO.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/AsyncCreateAzureNodePoolLRO.java new file mode 100644 index 0000000..6481db5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/AsyncCreateAzureNodePoolLRO.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_createazurenodepool_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.gkemulticloud.v1.AzureClusterName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePool; +import com.google.cloud.gkemulticloud.v1.CreateAzureNodePoolRequest; +import com.google.cloud.gkemulticloud.v1.OperationMetadata; + +public class AsyncCreateAzureNodePoolLRO { + + public static void main(String[] args) throws Exception { + asyncCreateAzureNodePoolLRO(); + } + + public static void asyncCreateAzureNodePoolLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + CreateAzureNodePoolRequest request = + CreateAzureNodePoolRequest.newBuilder() + .setParent( + AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString()) + .setAzureNodePool(AzureNodePool.newBuilder().build()) + .setAzureNodePoolId("azureNodePoolId-1766264088") + .setValidateOnly(true) + .build(); + OperationFuture future = + azureClustersClient.createAzureNodePoolOperationCallable().futureCall(request); + // Do something. + AzureNodePool response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_createazurenodepool_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/SyncCreateAzureNodePool.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/SyncCreateAzureNodePool.java new file mode 100644 index 0000000..346ed1a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/SyncCreateAzureNodePool.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_createazurenodepool_sync] +import com.google.cloud.gkemulticloud.v1.AzureClusterName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePool; +import com.google.cloud.gkemulticloud.v1.CreateAzureNodePoolRequest; + +public class SyncCreateAzureNodePool { + + public static void main(String[] args) throws Exception { + syncCreateAzureNodePool(); + } + + public static void syncCreateAzureNodePool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + CreateAzureNodePoolRequest request = + CreateAzureNodePoolRequest.newBuilder() + .setParent( + AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString()) + .setAzureNodePool(AzureNodePool.newBuilder().build()) + .setAzureNodePoolId("azureNodePoolId-1766264088") + .setValidateOnly(true) + .build(); + AzureNodePool response = azureClustersClient.createAzureNodePoolAsync(request).get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_createazurenodepool_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/SyncCreateAzureNodePoolAzureclusternameAzurenodepoolString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/SyncCreateAzureNodePoolAzureclusternameAzurenodepoolString.java new file mode 100644 index 0000000..5d83303 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/SyncCreateAzureNodePoolAzureclusternameAzurenodepoolString.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_createazurenodepool_azureclusternameazurenodepoolstring_sync] +import com.google.cloud.gkemulticloud.v1.AzureClusterName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePool; + +public class SyncCreateAzureNodePoolAzureclusternameAzurenodepoolString { + + public static void main(String[] args) throws Exception { + syncCreateAzureNodePoolAzureclusternameAzurenodepoolString(); + } + + public static void syncCreateAzureNodePoolAzureclusternameAzurenodepoolString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + AzureClusterName parent = AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]"); + AzureNodePool azureNodePool = AzureNodePool.newBuilder().build(); + String azureNodePoolId = "azureNodePoolId-1766264088"; + AzureNodePool response = + azureClustersClient + .createAzureNodePoolAsync(parent, azureNodePool, azureNodePoolId) + .get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_createazurenodepool_azureclusternameazurenodepoolstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/SyncCreateAzureNodePoolStringAzurenodepoolString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/SyncCreateAzureNodePoolStringAzurenodepoolString.java new file mode 100644 index 0000000..e3b2742 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/SyncCreateAzureNodePoolStringAzurenodepoolString.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_createazurenodepool_stringazurenodepoolstring_sync] +import com.google.cloud.gkemulticloud.v1.AzureClusterName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePool; + +public class SyncCreateAzureNodePoolStringAzurenodepoolString { + + public static void main(String[] args) throws Exception { + syncCreateAzureNodePoolStringAzurenodepoolString(); + } + + public static void syncCreateAzureNodePoolStringAzurenodepoolString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + String parent = AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString(); + AzureNodePool azureNodePool = AzureNodePool.newBuilder().build(); + String azureNodePoolId = "azureNodePoolId-1766264088"; + AzureNodePool response = + azureClustersClient + .createAzureNodePoolAsync(parent, azureNodePool, azureNodePoolId) + .get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_createazurenodepool_stringazurenodepoolstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/AsyncDeleteAzureClient.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/AsyncDeleteAzureClient.java new file mode 100644 index 0000000..0bb072d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/AsyncDeleteAzureClient.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_deleteazureclient_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AzureClientName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.DeleteAzureClientRequest; +import com.google.longrunning.Operation; + +public class AsyncDeleteAzureClient { + + public static void main(String[] args) throws Exception { + asyncDeleteAzureClient(); + } + + public static void asyncDeleteAzureClient() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + DeleteAzureClientRequest request = + DeleteAzureClientRequest.newBuilder() + .setName(AzureClientName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLIENT]").toString()) + .setAllowMissing(true) + .setValidateOnly(true) + .build(); + ApiFuture future = + azureClustersClient.deleteAzureClientCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_deleteazureclient_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/AsyncDeleteAzureClientLRO.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/AsyncDeleteAzureClientLRO.java new file mode 100644 index 0000000..00c8718 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/AsyncDeleteAzureClientLRO.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_deleteazureclient_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.gkemulticloud.v1.AzureClientName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.DeleteAzureClientRequest; +import com.google.cloud.gkemulticloud.v1.OperationMetadata; +import com.google.protobuf.Empty; + +public class AsyncDeleteAzureClientLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteAzureClientLRO(); + } + + public static void asyncDeleteAzureClientLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + DeleteAzureClientRequest request = + DeleteAzureClientRequest.newBuilder() + .setName(AzureClientName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLIENT]").toString()) + .setAllowMissing(true) + .setValidateOnly(true) + .build(); + OperationFuture future = + azureClustersClient.deleteAzureClientOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_deleteazureclient_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/SyncDeleteAzureClient.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/SyncDeleteAzureClient.java new file mode 100644 index 0000000..df1e726 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/SyncDeleteAzureClient.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_deleteazureclient_sync] +import com.google.cloud.gkemulticloud.v1.AzureClientName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.DeleteAzureClientRequest; +import com.google.protobuf.Empty; + +public class SyncDeleteAzureClient { + + public static void main(String[] args) throws Exception { + syncDeleteAzureClient(); + } + + public static void syncDeleteAzureClient() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + DeleteAzureClientRequest request = + DeleteAzureClientRequest.newBuilder() + .setName(AzureClientName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLIENT]").toString()) + .setAllowMissing(true) + .setValidateOnly(true) + .build(); + azureClustersClient.deleteAzureClientAsync(request).get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_deleteazureclient_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/SyncDeleteAzureClientAzureclientname.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/SyncDeleteAzureClientAzureclientname.java new file mode 100644 index 0000000..2df7f7c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/SyncDeleteAzureClientAzureclientname.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_deleteazureclient_azureclientname_sync] +import com.google.cloud.gkemulticloud.v1.AzureClientName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.protobuf.Empty; + +public class SyncDeleteAzureClientAzureclientname { + + public static void main(String[] args) throws Exception { + syncDeleteAzureClientAzureclientname(); + } + + public static void syncDeleteAzureClientAzureclientname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + AzureClientName name = AzureClientName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLIENT]"); + azureClustersClient.deleteAzureClientAsync(name).get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_deleteazureclient_azureclientname_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/SyncDeleteAzureClientString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/SyncDeleteAzureClientString.java new file mode 100644 index 0000000..5ac317c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/SyncDeleteAzureClientString.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_deleteazureclient_string_sync] +import com.google.cloud.gkemulticloud.v1.AzureClientName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.protobuf.Empty; + +public class SyncDeleteAzureClientString { + + public static void main(String[] args) throws Exception { + syncDeleteAzureClientString(); + } + + public static void syncDeleteAzureClientString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + String name = AzureClientName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLIENT]").toString(); + azureClustersClient.deleteAzureClientAsync(name).get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_deleteazureclient_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/AsyncDeleteAzureCluster.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/AsyncDeleteAzureCluster.java new file mode 100644 index 0000000..a7b8e20 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/AsyncDeleteAzureCluster.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_deleteazurecluster_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AzureClusterName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.DeleteAzureClusterRequest; +import com.google.longrunning.Operation; + +public class AsyncDeleteAzureCluster { + + public static void main(String[] args) throws Exception { + asyncDeleteAzureCluster(); + } + + public static void asyncDeleteAzureCluster() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + DeleteAzureClusterRequest request = + DeleteAzureClusterRequest.newBuilder() + .setName(AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString()) + .setAllowMissing(true) + .setValidateOnly(true) + .setEtag("etag3123477") + .build(); + ApiFuture future = + azureClustersClient.deleteAzureClusterCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_deleteazurecluster_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/AsyncDeleteAzureClusterLRO.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/AsyncDeleteAzureClusterLRO.java new file mode 100644 index 0000000..f7a2a73 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/AsyncDeleteAzureClusterLRO.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_deleteazurecluster_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.gkemulticloud.v1.AzureClusterName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.DeleteAzureClusterRequest; +import com.google.cloud.gkemulticloud.v1.OperationMetadata; +import com.google.protobuf.Empty; + +public class AsyncDeleteAzureClusterLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteAzureClusterLRO(); + } + + public static void asyncDeleteAzureClusterLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + DeleteAzureClusterRequest request = + DeleteAzureClusterRequest.newBuilder() + .setName(AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString()) + .setAllowMissing(true) + .setValidateOnly(true) + .setEtag("etag3123477") + .build(); + OperationFuture future = + azureClustersClient.deleteAzureClusterOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_deleteazurecluster_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/SyncDeleteAzureCluster.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/SyncDeleteAzureCluster.java new file mode 100644 index 0000000..258ffd2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/SyncDeleteAzureCluster.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_deleteazurecluster_sync] +import com.google.cloud.gkemulticloud.v1.AzureClusterName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.DeleteAzureClusterRequest; +import com.google.protobuf.Empty; + +public class SyncDeleteAzureCluster { + + public static void main(String[] args) throws Exception { + syncDeleteAzureCluster(); + } + + public static void syncDeleteAzureCluster() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + DeleteAzureClusterRequest request = + DeleteAzureClusterRequest.newBuilder() + .setName(AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString()) + .setAllowMissing(true) + .setValidateOnly(true) + .setEtag("etag3123477") + .build(); + azureClustersClient.deleteAzureClusterAsync(request).get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_deleteazurecluster_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/SyncDeleteAzureClusterAzureclustername.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/SyncDeleteAzureClusterAzureclustername.java new file mode 100644 index 0000000..ecd35d5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/SyncDeleteAzureClusterAzureclustername.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_deleteazurecluster_azureclustername_sync] +import com.google.cloud.gkemulticloud.v1.AzureClusterName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.protobuf.Empty; + +public class SyncDeleteAzureClusterAzureclustername { + + public static void main(String[] args) throws Exception { + syncDeleteAzureClusterAzureclustername(); + } + + public static void syncDeleteAzureClusterAzureclustername() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + AzureClusterName name = AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]"); + azureClustersClient.deleteAzureClusterAsync(name).get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_deleteazurecluster_azureclustername_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/SyncDeleteAzureClusterString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/SyncDeleteAzureClusterString.java new file mode 100644 index 0000000..44c167c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/SyncDeleteAzureClusterString.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_deleteazurecluster_string_sync] +import com.google.cloud.gkemulticloud.v1.AzureClusterName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.protobuf.Empty; + +public class SyncDeleteAzureClusterString { + + public static void main(String[] args) throws Exception { + syncDeleteAzureClusterString(); + } + + public static void syncDeleteAzureClusterString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + String name = AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString(); + azureClustersClient.deleteAzureClusterAsync(name).get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_deleteazurecluster_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/AsyncDeleteAzureNodePool.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/AsyncDeleteAzureNodePool.java new file mode 100644 index 0000000..b30f383 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/AsyncDeleteAzureNodePool.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_deleteazurenodepool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePoolName; +import com.google.cloud.gkemulticloud.v1.DeleteAzureNodePoolRequest; +import com.google.longrunning.Operation; + +public class AsyncDeleteAzureNodePool { + + public static void main(String[] args) throws Exception { + asyncDeleteAzureNodePool(); + } + + public static void asyncDeleteAzureNodePool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + DeleteAzureNodePoolRequest request = + DeleteAzureNodePoolRequest.newBuilder() + .setName( + AzureNodePoolName.of( + "[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]", "[AZURE_NODE_POOL]") + .toString()) + .setValidateOnly(true) + .setAllowMissing(true) + .setEtag("etag3123477") + .build(); + ApiFuture future = + azureClustersClient.deleteAzureNodePoolCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_deleteazurenodepool_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/AsyncDeleteAzureNodePoolLRO.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/AsyncDeleteAzureNodePoolLRO.java new file mode 100644 index 0000000..31a4bdc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/AsyncDeleteAzureNodePoolLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_deleteazurenodepool_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePoolName; +import com.google.cloud.gkemulticloud.v1.DeleteAzureNodePoolRequest; +import com.google.cloud.gkemulticloud.v1.OperationMetadata; +import com.google.protobuf.Empty; + +public class AsyncDeleteAzureNodePoolLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteAzureNodePoolLRO(); + } + + public static void asyncDeleteAzureNodePoolLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + DeleteAzureNodePoolRequest request = + DeleteAzureNodePoolRequest.newBuilder() + .setName( + AzureNodePoolName.of( + "[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]", "[AZURE_NODE_POOL]") + .toString()) + .setValidateOnly(true) + .setAllowMissing(true) + .setEtag("etag3123477") + .build(); + OperationFuture future = + azureClustersClient.deleteAzureNodePoolOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_deleteazurenodepool_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/SyncDeleteAzureNodePool.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/SyncDeleteAzureNodePool.java new file mode 100644 index 0000000..bbafcd0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/SyncDeleteAzureNodePool.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_deleteazurenodepool_sync] +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePoolName; +import com.google.cloud.gkemulticloud.v1.DeleteAzureNodePoolRequest; +import com.google.protobuf.Empty; + +public class SyncDeleteAzureNodePool { + + public static void main(String[] args) throws Exception { + syncDeleteAzureNodePool(); + } + + public static void syncDeleteAzureNodePool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + DeleteAzureNodePoolRequest request = + DeleteAzureNodePoolRequest.newBuilder() + .setName( + AzureNodePoolName.of( + "[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]", "[AZURE_NODE_POOL]") + .toString()) + .setValidateOnly(true) + .setAllowMissing(true) + .setEtag("etag3123477") + .build(); + azureClustersClient.deleteAzureNodePoolAsync(request).get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_deleteazurenodepool_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/SyncDeleteAzureNodePoolAzurenodepoolname.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/SyncDeleteAzureNodePoolAzurenodepoolname.java new file mode 100644 index 0000000..1764166 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/SyncDeleteAzureNodePoolAzurenodepoolname.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_deleteazurenodepool_azurenodepoolname_sync] +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePoolName; +import com.google.protobuf.Empty; + +public class SyncDeleteAzureNodePoolAzurenodepoolname { + + public static void main(String[] args) throws Exception { + syncDeleteAzureNodePoolAzurenodepoolname(); + } + + public static void syncDeleteAzureNodePoolAzurenodepoolname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + AzureNodePoolName name = + AzureNodePoolName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]", "[AZURE_NODE_POOL]"); + azureClustersClient.deleteAzureNodePoolAsync(name).get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_deleteazurenodepool_azurenodepoolname_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/SyncDeleteAzureNodePoolString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/SyncDeleteAzureNodePoolString.java new file mode 100644 index 0000000..b3ad945 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/SyncDeleteAzureNodePoolString.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_deleteazurenodepool_string_sync] +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePoolName; +import com.google.protobuf.Empty; + +public class SyncDeleteAzureNodePoolString { + + public static void main(String[] args) throws Exception { + syncDeleteAzureNodePoolString(); + } + + public static void syncDeleteAzureNodePoolString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + String name = + AzureNodePoolName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]", "[AZURE_NODE_POOL]") + .toString(); + azureClustersClient.deleteAzureNodePoolAsync(name).get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_deleteazurenodepool_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/generateazureaccesstoken/AsyncGenerateAzureAccessToken.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/generateazureaccesstoken/AsyncGenerateAzureAccessToken.java new file mode 100644 index 0000000..c08a905 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/generateazureaccesstoken/AsyncGenerateAzureAccessToken.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_generateazureaccesstoken_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AzureClusterName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenRequest; +import com.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenResponse; + +public class AsyncGenerateAzureAccessToken { + + public static void main(String[] args) throws Exception { + asyncGenerateAzureAccessToken(); + } + + public static void asyncGenerateAzureAccessToken() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + GenerateAzureAccessTokenRequest request = + GenerateAzureAccessTokenRequest.newBuilder() + .setAzureCluster( + AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString()) + .build(); + ApiFuture future = + azureClustersClient.generateAzureAccessTokenCallable().futureCall(request); + // Do something. + GenerateAzureAccessTokenResponse response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_generateazureaccesstoken_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/generateazureaccesstoken/SyncGenerateAzureAccessToken.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/generateazureaccesstoken/SyncGenerateAzureAccessToken.java new file mode 100644 index 0000000..cf3099f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/generateazureaccesstoken/SyncGenerateAzureAccessToken.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_generateazureaccesstoken_sync] +import com.google.cloud.gkemulticloud.v1.AzureClusterName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenRequest; +import com.google.cloud.gkemulticloud.v1.GenerateAzureAccessTokenResponse; + +public class SyncGenerateAzureAccessToken { + + public static void main(String[] args) throws Exception { + syncGenerateAzureAccessToken(); + } + + public static void syncGenerateAzureAccessToken() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + GenerateAzureAccessTokenRequest request = + GenerateAzureAccessTokenRequest.newBuilder() + .setAzureCluster( + AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString()) + .build(); + GenerateAzureAccessTokenResponse response = + azureClustersClient.generateAzureAccessToken(request); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_generateazureaccesstoken_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureclient/AsyncGetAzureClient.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureclient/AsyncGetAzureClient.java new file mode 100644 index 0000000..0bf9b06 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureclient/AsyncGetAzureClient.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_getazureclient_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AzureClient; +import com.google.cloud.gkemulticloud.v1.AzureClientName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.GetAzureClientRequest; + +public class AsyncGetAzureClient { + + public static void main(String[] args) throws Exception { + asyncGetAzureClient(); + } + + public static void asyncGetAzureClient() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + GetAzureClientRequest request = + GetAzureClientRequest.newBuilder() + .setName(AzureClientName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLIENT]").toString()) + .build(); + ApiFuture future = + azureClustersClient.getAzureClientCallable().futureCall(request); + // Do something. + AzureClient response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_getazureclient_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureclient/SyncGetAzureClient.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureclient/SyncGetAzureClient.java new file mode 100644 index 0000000..e6a4fee --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureclient/SyncGetAzureClient.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_getazureclient_sync] +import com.google.cloud.gkemulticloud.v1.AzureClient; +import com.google.cloud.gkemulticloud.v1.AzureClientName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.GetAzureClientRequest; + +public class SyncGetAzureClient { + + public static void main(String[] args) throws Exception { + syncGetAzureClient(); + } + + public static void syncGetAzureClient() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + GetAzureClientRequest request = + GetAzureClientRequest.newBuilder() + .setName(AzureClientName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLIENT]").toString()) + .build(); + AzureClient response = azureClustersClient.getAzureClient(request); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_getazureclient_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureclient/SyncGetAzureClientAzureclientname.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureclient/SyncGetAzureClientAzureclientname.java new file mode 100644 index 0000000..ceb053f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureclient/SyncGetAzureClientAzureclientname.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_getazureclient_azureclientname_sync] +import com.google.cloud.gkemulticloud.v1.AzureClient; +import com.google.cloud.gkemulticloud.v1.AzureClientName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; + +public class SyncGetAzureClientAzureclientname { + + public static void main(String[] args) throws Exception { + syncGetAzureClientAzureclientname(); + } + + public static void syncGetAzureClientAzureclientname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + AzureClientName name = AzureClientName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLIENT]"); + AzureClient response = azureClustersClient.getAzureClient(name); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_getazureclient_azureclientname_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureclient/SyncGetAzureClientString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureclient/SyncGetAzureClientString.java new file mode 100644 index 0000000..d425e09 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureclient/SyncGetAzureClientString.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_getazureclient_string_sync] +import com.google.cloud.gkemulticloud.v1.AzureClient; +import com.google.cloud.gkemulticloud.v1.AzureClientName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; + +public class SyncGetAzureClientString { + + public static void main(String[] args) throws Exception { + syncGetAzureClientString(); + } + + public static void syncGetAzureClientString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + String name = AzureClientName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLIENT]").toString(); + AzureClient response = azureClustersClient.getAzureClient(name); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_getazureclient_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurecluster/AsyncGetAzureCluster.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurecluster/AsyncGetAzureCluster.java new file mode 100644 index 0000000..ca57c9b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurecluster/AsyncGetAzureCluster.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_getazurecluster_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AzureCluster; +import com.google.cloud.gkemulticloud.v1.AzureClusterName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.GetAzureClusterRequest; + +public class AsyncGetAzureCluster { + + public static void main(String[] args) throws Exception { + asyncGetAzureCluster(); + } + + public static void asyncGetAzureCluster() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + GetAzureClusterRequest request = + GetAzureClusterRequest.newBuilder() + .setName(AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString()) + .build(); + ApiFuture future = + azureClustersClient.getAzureClusterCallable().futureCall(request); + // Do something. + AzureCluster response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_getazurecluster_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurecluster/SyncGetAzureCluster.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurecluster/SyncGetAzureCluster.java new file mode 100644 index 0000000..37d615f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurecluster/SyncGetAzureCluster.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_getazurecluster_sync] +import com.google.cloud.gkemulticloud.v1.AzureCluster; +import com.google.cloud.gkemulticloud.v1.AzureClusterName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.GetAzureClusterRequest; + +public class SyncGetAzureCluster { + + public static void main(String[] args) throws Exception { + syncGetAzureCluster(); + } + + public static void syncGetAzureCluster() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + GetAzureClusterRequest request = + GetAzureClusterRequest.newBuilder() + .setName(AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString()) + .build(); + AzureCluster response = azureClustersClient.getAzureCluster(request); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_getazurecluster_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurecluster/SyncGetAzureClusterAzureclustername.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurecluster/SyncGetAzureClusterAzureclustername.java new file mode 100644 index 0000000..37fe7bc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurecluster/SyncGetAzureClusterAzureclustername.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_getazurecluster_azureclustername_sync] +import com.google.cloud.gkemulticloud.v1.AzureCluster; +import com.google.cloud.gkemulticloud.v1.AzureClusterName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; + +public class SyncGetAzureClusterAzureclustername { + + public static void main(String[] args) throws Exception { + syncGetAzureClusterAzureclustername(); + } + + public static void syncGetAzureClusterAzureclustername() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + AzureClusterName name = AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]"); + AzureCluster response = azureClustersClient.getAzureCluster(name); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_getazurecluster_azureclustername_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurecluster/SyncGetAzureClusterString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurecluster/SyncGetAzureClusterString.java new file mode 100644 index 0000000..e533e84 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurecluster/SyncGetAzureClusterString.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_getazurecluster_string_sync] +import com.google.cloud.gkemulticloud.v1.AzureCluster; +import com.google.cloud.gkemulticloud.v1.AzureClusterName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; + +public class SyncGetAzureClusterString { + + public static void main(String[] args) throws Exception { + syncGetAzureClusterString(); + } + + public static void syncGetAzureClusterString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + String name = AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString(); + AzureCluster response = azureClustersClient.getAzureCluster(name); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_getazurecluster_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurenodepool/AsyncGetAzureNodePool.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurenodepool/AsyncGetAzureNodePool.java new file mode 100644 index 0000000..2645713 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurenodepool/AsyncGetAzureNodePool.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_getazurenodepool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePool; +import com.google.cloud.gkemulticloud.v1.AzureNodePoolName; +import com.google.cloud.gkemulticloud.v1.GetAzureNodePoolRequest; + +public class AsyncGetAzureNodePool { + + public static void main(String[] args) throws Exception { + asyncGetAzureNodePool(); + } + + public static void asyncGetAzureNodePool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + GetAzureNodePoolRequest request = + GetAzureNodePoolRequest.newBuilder() + .setName( + AzureNodePoolName.of( + "[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]", "[AZURE_NODE_POOL]") + .toString()) + .build(); + ApiFuture future = + azureClustersClient.getAzureNodePoolCallable().futureCall(request); + // Do something. + AzureNodePool response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_getazurenodepool_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurenodepool/SyncGetAzureNodePool.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurenodepool/SyncGetAzureNodePool.java new file mode 100644 index 0000000..2429727 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurenodepool/SyncGetAzureNodePool.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_getazurenodepool_sync] +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePool; +import com.google.cloud.gkemulticloud.v1.AzureNodePoolName; +import com.google.cloud.gkemulticloud.v1.GetAzureNodePoolRequest; + +public class SyncGetAzureNodePool { + + public static void main(String[] args) throws Exception { + syncGetAzureNodePool(); + } + + public static void syncGetAzureNodePool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + GetAzureNodePoolRequest request = + GetAzureNodePoolRequest.newBuilder() + .setName( + AzureNodePoolName.of( + "[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]", "[AZURE_NODE_POOL]") + .toString()) + .build(); + AzureNodePool response = azureClustersClient.getAzureNodePool(request); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_getazurenodepool_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurenodepool/SyncGetAzureNodePoolAzurenodepoolname.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurenodepool/SyncGetAzureNodePoolAzurenodepoolname.java new file mode 100644 index 0000000..724f0dc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurenodepool/SyncGetAzureNodePoolAzurenodepoolname.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_getazurenodepool_azurenodepoolname_sync] +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePool; +import com.google.cloud.gkemulticloud.v1.AzureNodePoolName; + +public class SyncGetAzureNodePoolAzurenodepoolname { + + public static void main(String[] args) throws Exception { + syncGetAzureNodePoolAzurenodepoolname(); + } + + public static void syncGetAzureNodePoolAzurenodepoolname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + AzureNodePoolName name = + AzureNodePoolName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]", "[AZURE_NODE_POOL]"); + AzureNodePool response = azureClustersClient.getAzureNodePool(name); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_getazurenodepool_azurenodepoolname_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurenodepool/SyncGetAzureNodePoolString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurenodepool/SyncGetAzureNodePoolString.java new file mode 100644 index 0000000..c1d477c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurenodepool/SyncGetAzureNodePoolString.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_getazurenodepool_string_sync] +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePool; +import com.google.cloud.gkemulticloud.v1.AzureNodePoolName; + +public class SyncGetAzureNodePoolString { + + public static void main(String[] args) throws Exception { + syncGetAzureNodePoolString(); + } + + public static void syncGetAzureNodePoolString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + String name = + AzureNodePoolName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]", "[AZURE_NODE_POOL]") + .toString(); + AzureNodePool response = azureClustersClient.getAzureNodePool(name); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_getazurenodepool_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureserverconfig/AsyncGetAzureServerConfig.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureserverconfig/AsyncGetAzureServerConfig.java new file mode 100644 index 0000000..1cd0b9c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureserverconfig/AsyncGetAzureServerConfig.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_getazureserverconfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureServerConfig; +import com.google.cloud.gkemulticloud.v1.AzureServerConfigName; +import com.google.cloud.gkemulticloud.v1.GetAzureServerConfigRequest; + +public class AsyncGetAzureServerConfig { + + public static void main(String[] args) throws Exception { + asyncGetAzureServerConfig(); + } + + public static void asyncGetAzureServerConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + GetAzureServerConfigRequest request = + GetAzureServerConfigRequest.newBuilder() + .setName(AzureServerConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + azureClustersClient.getAzureServerConfigCallable().futureCall(request); + // Do something. + AzureServerConfig response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_getazureserverconfig_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureserverconfig/SyncGetAzureServerConfig.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureserverconfig/SyncGetAzureServerConfig.java new file mode 100644 index 0000000..09c0cd1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureserverconfig/SyncGetAzureServerConfig.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_getazureserverconfig_sync] +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureServerConfig; +import com.google.cloud.gkemulticloud.v1.AzureServerConfigName; +import com.google.cloud.gkemulticloud.v1.GetAzureServerConfigRequest; + +public class SyncGetAzureServerConfig { + + public static void main(String[] args) throws Exception { + syncGetAzureServerConfig(); + } + + public static void syncGetAzureServerConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + GetAzureServerConfigRequest request = + GetAzureServerConfigRequest.newBuilder() + .setName(AzureServerConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + AzureServerConfig response = azureClustersClient.getAzureServerConfig(request); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_getazureserverconfig_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureserverconfig/SyncGetAzureServerConfigAzureserverconfigname.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureserverconfig/SyncGetAzureServerConfigAzureserverconfigname.java new file mode 100644 index 0000000..ceca057 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureserverconfig/SyncGetAzureServerConfigAzureserverconfigname.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_getazureserverconfig_azureserverconfigname_sync] +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureServerConfig; +import com.google.cloud.gkemulticloud.v1.AzureServerConfigName; + +public class SyncGetAzureServerConfigAzureserverconfigname { + + public static void main(String[] args) throws Exception { + syncGetAzureServerConfigAzureserverconfigname(); + } + + public static void syncGetAzureServerConfigAzureserverconfigname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + AzureServerConfigName name = AzureServerConfigName.of("[PROJECT]", "[LOCATION]"); + AzureServerConfig response = azureClustersClient.getAzureServerConfig(name); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_getazureserverconfig_azureserverconfigname_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureserverconfig/SyncGetAzureServerConfigString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureserverconfig/SyncGetAzureServerConfigString.java new file mode 100644 index 0000000..9685e4a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureserverconfig/SyncGetAzureServerConfigString.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_getazureserverconfig_string_sync] +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureServerConfig; +import com.google.cloud.gkemulticloud.v1.AzureServerConfigName; + +public class SyncGetAzureServerConfigString { + + public static void main(String[] args) throws Exception { + syncGetAzureServerConfigString(); + } + + public static void syncGetAzureServerConfigString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + String name = AzureServerConfigName.of("[PROJECT]", "[LOCATION]").toString(); + AzureServerConfig response = azureClustersClient.getAzureServerConfig(name); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_getazureserverconfig_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/AsyncListAzureClients.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/AsyncListAzureClients.java new file mode 100644 index 0000000..4d808df --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/AsyncListAzureClients.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_listazureclients_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AzureClient; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.ListAzureClientsRequest; +import com.google.cloud.gkemulticloud.v1.LocationName; + +public class AsyncListAzureClients { + + public static void main(String[] args) throws Exception { + asyncListAzureClients(); + } + + public static void asyncListAzureClients() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + ListAzureClientsRequest request = + ListAzureClientsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + azureClustersClient.listAzureClientsPagedCallable().futureCall(request); + // Do something. + for (AzureClient element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_listazureclients_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/AsyncListAzureClientsPaged.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/AsyncListAzureClientsPaged.java new file mode 100644 index 0000000..9ce4b48 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/AsyncListAzureClientsPaged.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_listazureclients_paged_async] +import com.google.cloud.gkemulticloud.v1.AzureClient; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.ListAzureClientsRequest; +import com.google.cloud.gkemulticloud.v1.ListAzureClientsResponse; +import com.google.cloud.gkemulticloud.v1.LocationName; +import com.google.common.base.Strings; + +public class AsyncListAzureClientsPaged { + + public static void main(String[] args) throws Exception { + asyncListAzureClientsPaged(); + } + + public static void asyncListAzureClientsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + ListAzureClientsRequest request = + ListAzureClientsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListAzureClientsResponse response = + azureClustersClient.listAzureClientsCallable().call(request); + for (AzureClient element : response.getAzureClientsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_listazureclients_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/SyncListAzureClients.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/SyncListAzureClients.java new file mode 100644 index 0000000..4793319 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/SyncListAzureClients.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_listazureclients_sync] +import com.google.cloud.gkemulticloud.v1.AzureClient; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.ListAzureClientsRequest; +import com.google.cloud.gkemulticloud.v1.LocationName; + +public class SyncListAzureClients { + + public static void main(String[] args) throws Exception { + syncListAzureClients(); + } + + public static void syncListAzureClients() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + ListAzureClientsRequest request = + ListAzureClientsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (AzureClient element : azureClustersClient.listAzureClients(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_listazureclients_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/SyncListAzureClientsLocationname.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/SyncListAzureClientsLocationname.java new file mode 100644 index 0000000..9ceacf6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/SyncListAzureClientsLocationname.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_listazureclients_locationname_sync] +import com.google.cloud.gkemulticloud.v1.AzureClient; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.LocationName; + +public class SyncListAzureClientsLocationname { + + public static void main(String[] args) throws Exception { + syncListAzureClientsLocationname(); + } + + public static void syncListAzureClientsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (AzureClient element : azureClustersClient.listAzureClients(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_listazureclients_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/SyncListAzureClientsString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/SyncListAzureClientsString.java new file mode 100644 index 0000000..27721fc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/SyncListAzureClientsString.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_listazureclients_string_sync] +import com.google.cloud.gkemulticloud.v1.AzureClient; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.LocationName; + +public class SyncListAzureClientsString { + + public static void main(String[] args) throws Exception { + syncListAzureClientsString(); + } + + public static void syncListAzureClientsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (AzureClient element : azureClustersClient.listAzureClients(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_listazureclients_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/AsyncListAzureClusters.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/AsyncListAzureClusters.java new file mode 100644 index 0000000..a033d1f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/AsyncListAzureClusters.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_listazureclusters_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AzureCluster; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.ListAzureClustersRequest; +import com.google.cloud.gkemulticloud.v1.LocationName; + +public class AsyncListAzureClusters { + + public static void main(String[] args) throws Exception { + asyncListAzureClusters(); + } + + public static void asyncListAzureClusters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + ListAzureClustersRequest request = + ListAzureClustersRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + azureClustersClient.listAzureClustersPagedCallable().futureCall(request); + // Do something. + for (AzureCluster element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_listazureclusters_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/AsyncListAzureClustersPaged.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/AsyncListAzureClustersPaged.java new file mode 100644 index 0000000..379bcb1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/AsyncListAzureClustersPaged.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_listazureclusters_paged_async] +import com.google.cloud.gkemulticloud.v1.AzureCluster; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.ListAzureClustersRequest; +import com.google.cloud.gkemulticloud.v1.ListAzureClustersResponse; +import com.google.cloud.gkemulticloud.v1.LocationName; +import com.google.common.base.Strings; + +public class AsyncListAzureClustersPaged { + + public static void main(String[] args) throws Exception { + asyncListAzureClustersPaged(); + } + + public static void asyncListAzureClustersPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + ListAzureClustersRequest request = + ListAzureClustersRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListAzureClustersResponse response = + azureClustersClient.listAzureClustersCallable().call(request); + for (AzureCluster element : response.getAzureClustersList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_listazureclusters_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/SyncListAzureClusters.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/SyncListAzureClusters.java new file mode 100644 index 0000000..11d421e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/SyncListAzureClusters.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_listazureclusters_sync] +import com.google.cloud.gkemulticloud.v1.AzureCluster; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.ListAzureClustersRequest; +import com.google.cloud.gkemulticloud.v1.LocationName; + +public class SyncListAzureClusters { + + public static void main(String[] args) throws Exception { + syncListAzureClusters(); + } + + public static void syncListAzureClusters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + ListAzureClustersRequest request = + ListAzureClustersRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (AzureCluster element : azureClustersClient.listAzureClusters(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_listazureclusters_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/SyncListAzureClustersLocationname.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/SyncListAzureClustersLocationname.java new file mode 100644 index 0000000..0681f36 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/SyncListAzureClustersLocationname.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_listazureclusters_locationname_sync] +import com.google.cloud.gkemulticloud.v1.AzureCluster; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.LocationName; + +public class SyncListAzureClustersLocationname { + + public static void main(String[] args) throws Exception { + syncListAzureClustersLocationname(); + } + + public static void syncListAzureClustersLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (AzureCluster element : azureClustersClient.listAzureClusters(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_listazureclusters_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/SyncListAzureClustersString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/SyncListAzureClustersString.java new file mode 100644 index 0000000..638edd7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/SyncListAzureClustersString.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_listazureclusters_string_sync] +import com.google.cloud.gkemulticloud.v1.AzureCluster; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.LocationName; + +public class SyncListAzureClustersString { + + public static void main(String[] args) throws Exception { + syncListAzureClustersString(); + } + + public static void syncListAzureClustersString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (AzureCluster element : azureClustersClient.listAzureClusters(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_listazureclusters_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/AsyncListAzureNodePools.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/AsyncListAzureNodePools.java new file mode 100644 index 0000000..bf2b761 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/AsyncListAzureNodePools.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_listazurenodepools_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AzureClusterName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePool; +import com.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest; + +public class AsyncListAzureNodePools { + + public static void main(String[] args) throws Exception { + asyncListAzureNodePools(); + } + + public static void asyncListAzureNodePools() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + ListAzureNodePoolsRequest request = + ListAzureNodePoolsRequest.newBuilder() + .setParent( + AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + azureClustersClient.listAzureNodePoolsPagedCallable().futureCall(request); + // Do something. + for (AzureNodePool element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_listazurenodepools_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/AsyncListAzureNodePoolsPaged.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/AsyncListAzureNodePoolsPaged.java new file mode 100644 index 0000000..7313702 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/AsyncListAzureNodePoolsPaged.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_listazurenodepools_paged_async] +import com.google.cloud.gkemulticloud.v1.AzureClusterName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePool; +import com.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest; +import com.google.cloud.gkemulticloud.v1.ListAzureNodePoolsResponse; +import com.google.common.base.Strings; + +public class AsyncListAzureNodePoolsPaged { + + public static void main(String[] args) throws Exception { + asyncListAzureNodePoolsPaged(); + } + + public static void asyncListAzureNodePoolsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + ListAzureNodePoolsRequest request = + ListAzureNodePoolsRequest.newBuilder() + .setParent( + AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListAzureNodePoolsResponse response = + azureClustersClient.listAzureNodePoolsCallable().call(request); + for (AzureNodePool element : response.getAzureNodePoolsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_listazurenodepools_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/SyncListAzureNodePools.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/SyncListAzureNodePools.java new file mode 100644 index 0000000..ac05fcd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/SyncListAzureNodePools.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_listazurenodepools_sync] +import com.google.cloud.gkemulticloud.v1.AzureClusterName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePool; +import com.google.cloud.gkemulticloud.v1.ListAzureNodePoolsRequest; + +public class SyncListAzureNodePools { + + public static void main(String[] args) throws Exception { + syncListAzureNodePools(); + } + + public static void syncListAzureNodePools() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + ListAzureNodePoolsRequest request = + ListAzureNodePoolsRequest.newBuilder() + .setParent( + AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (AzureNodePool element : azureClustersClient.listAzureNodePools(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_listazurenodepools_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/SyncListAzureNodePoolsAzureclustername.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/SyncListAzureNodePoolsAzureclustername.java new file mode 100644 index 0000000..d336d5e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/SyncListAzureNodePoolsAzureclustername.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_listazurenodepools_azureclustername_sync] +import com.google.cloud.gkemulticloud.v1.AzureClusterName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePool; + +public class SyncListAzureNodePoolsAzureclustername { + + public static void main(String[] args) throws Exception { + syncListAzureNodePoolsAzureclustername(); + } + + public static void syncListAzureNodePoolsAzureclustername() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + AzureClusterName parent = AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]"); + for (AzureNodePool element : azureClustersClient.listAzureNodePools(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_listazurenodepools_azureclustername_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/SyncListAzureNodePoolsString.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/SyncListAzureNodePoolsString.java new file mode 100644 index 0000000..3500b71 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/SyncListAzureNodePoolsString.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_listazurenodepools_string_sync] +import com.google.cloud.gkemulticloud.v1.AzureClusterName; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePool; + +public class SyncListAzureNodePoolsString { + + public static void main(String[] args) throws Exception { + syncListAzureNodePoolsString(); + } + + public static void syncListAzureNodePoolsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + String parent = AzureClusterName.of("[PROJECT]", "[LOCATION]", "[AZURE_CLUSTER]").toString(); + for (AzureNodePool element : azureClustersClient.listAzureNodePools(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_listazurenodepools_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurecluster/AsyncUpdateAzureCluster.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurecluster/AsyncUpdateAzureCluster.java new file mode 100644 index 0000000..f705919 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurecluster/AsyncUpdateAzureCluster.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_updateazurecluster_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AzureCluster; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.UpdateAzureClusterRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateAzureCluster { + + public static void main(String[] args) throws Exception { + asyncUpdateAzureCluster(); + } + + public static void asyncUpdateAzureCluster() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + UpdateAzureClusterRequest request = + UpdateAzureClusterRequest.newBuilder() + .setAzureCluster(AzureCluster.newBuilder().build()) + .setValidateOnly(true) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + azureClustersClient.updateAzureClusterCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_updateazurecluster_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurecluster/AsyncUpdateAzureClusterLRO.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurecluster/AsyncUpdateAzureClusterLRO.java new file mode 100644 index 0000000..44431d3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurecluster/AsyncUpdateAzureClusterLRO.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_updateazurecluster_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.gkemulticloud.v1.AzureCluster; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.OperationMetadata; +import com.google.cloud.gkemulticloud.v1.UpdateAzureClusterRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateAzureClusterLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateAzureClusterLRO(); + } + + public static void asyncUpdateAzureClusterLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + UpdateAzureClusterRequest request = + UpdateAzureClusterRequest.newBuilder() + .setAzureCluster(AzureCluster.newBuilder().build()) + .setValidateOnly(true) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + azureClustersClient.updateAzureClusterOperationCallable().futureCall(request); + // Do something. + AzureCluster response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_updateazurecluster_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurecluster/SyncUpdateAzureCluster.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurecluster/SyncUpdateAzureCluster.java new file mode 100644 index 0000000..5e4fe5a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurecluster/SyncUpdateAzureCluster.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_updateazurecluster_sync] +import com.google.cloud.gkemulticloud.v1.AzureCluster; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.UpdateAzureClusterRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateAzureCluster { + + public static void main(String[] args) throws Exception { + syncUpdateAzureCluster(); + } + + public static void syncUpdateAzureCluster() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + UpdateAzureClusterRequest request = + UpdateAzureClusterRequest.newBuilder() + .setAzureCluster(AzureCluster.newBuilder().build()) + .setValidateOnly(true) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + AzureCluster response = azureClustersClient.updateAzureClusterAsync(request).get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_updateazurecluster_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurecluster/SyncUpdateAzureClusterAzureclusterFieldmask.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurecluster/SyncUpdateAzureClusterAzureclusterFieldmask.java new file mode 100644 index 0000000..a8696ff --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurecluster/SyncUpdateAzureClusterAzureclusterFieldmask.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_updateazurecluster_azureclusterfieldmask_sync] +import com.google.cloud.gkemulticloud.v1.AzureCluster; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateAzureClusterAzureclusterFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateAzureClusterAzureclusterFieldmask(); + } + + public static void syncUpdateAzureClusterAzureclusterFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + AzureCluster azureCluster = AzureCluster.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + AzureCluster response = + azureClustersClient.updateAzureClusterAsync(azureCluster, updateMask).get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_updateazurecluster_azureclusterfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurenodepool/AsyncUpdateAzureNodePool.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurenodepool/AsyncUpdateAzureNodePool.java new file mode 100644 index 0000000..d9f7745 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurenodepool/AsyncUpdateAzureNodePool.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_updateazurenodepool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePool; +import com.google.cloud.gkemulticloud.v1.UpdateAzureNodePoolRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateAzureNodePool { + + public static void main(String[] args) throws Exception { + asyncUpdateAzureNodePool(); + } + + public static void asyncUpdateAzureNodePool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + UpdateAzureNodePoolRequest request = + UpdateAzureNodePoolRequest.newBuilder() + .setAzureNodePool(AzureNodePool.newBuilder().build()) + .setValidateOnly(true) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + azureClustersClient.updateAzureNodePoolCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_updateazurenodepool_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurenodepool/AsyncUpdateAzureNodePoolLRO.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurenodepool/AsyncUpdateAzureNodePoolLRO.java new file mode 100644 index 0000000..1264248 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurenodepool/AsyncUpdateAzureNodePoolLRO.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_updateazurenodepool_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePool; +import com.google.cloud.gkemulticloud.v1.OperationMetadata; +import com.google.cloud.gkemulticloud.v1.UpdateAzureNodePoolRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateAzureNodePoolLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateAzureNodePoolLRO(); + } + + public static void asyncUpdateAzureNodePoolLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + UpdateAzureNodePoolRequest request = + UpdateAzureNodePoolRequest.newBuilder() + .setAzureNodePool(AzureNodePool.newBuilder().build()) + .setValidateOnly(true) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + azureClustersClient.updateAzureNodePoolOperationCallable().futureCall(request); + // Do something. + AzureNodePool response = future.get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_updateazurenodepool_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurenodepool/SyncUpdateAzureNodePool.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurenodepool/SyncUpdateAzureNodePool.java new file mode 100644 index 0000000..0ea8916 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurenodepool/SyncUpdateAzureNodePool.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_updateazurenodepool_sync] +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePool; +import com.google.cloud.gkemulticloud.v1.UpdateAzureNodePoolRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateAzureNodePool { + + public static void main(String[] args) throws Exception { + syncUpdateAzureNodePool(); + } + + public static void syncUpdateAzureNodePool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + UpdateAzureNodePoolRequest request = + UpdateAzureNodePoolRequest.newBuilder() + .setAzureNodePool(AzureNodePool.newBuilder().build()) + .setValidateOnly(true) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + AzureNodePool response = azureClustersClient.updateAzureNodePoolAsync(request).get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_updateazurenodepool_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurenodepool/SyncUpdateAzureNodePoolAzurenodepoolFieldmask.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurenodepool/SyncUpdateAzureNodePoolAzurenodepoolFieldmask.java new file mode 100644 index 0000000..068b965 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurenodepool/SyncUpdateAzureNodePoolAzurenodepoolFieldmask.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclustersclient_updateazurenodepool_azurenodepoolfieldmask_sync] +import com.google.cloud.gkemulticloud.v1.AzureClustersClient; +import com.google.cloud.gkemulticloud.v1.AzureNodePool; +import com.google.protobuf.FieldMask; + +public class SyncUpdateAzureNodePoolAzurenodepoolFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateAzureNodePoolAzurenodepoolFieldmask(); + } + + public static void syncUpdateAzureNodePoolAzurenodepoolFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AzureClustersClient azureClustersClient = AzureClustersClient.create()) { + AzureNodePool azureNodePool = AzureNodePool.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + AzureNodePool response = + azureClustersClient.updateAzureNodePoolAsync(azureNodePool, updateMask).get(); + } + } +} +// [END gkemulticloud_v1_generated_azureclustersclient_updateazurenodepool_azurenodepoolfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclusterssettings/getazureclient/SyncGetAzureClient.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclusterssettings/getazureclient/SyncGetAzureClient.java new file mode 100644 index 0000000..280a43c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclusterssettings/getazureclient/SyncGetAzureClient.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.gkemulticloud.v1.samples; + +// [START gkemulticloud_v1_generated_azureclusterssettings_getazureclient_sync] +import com.google.cloud.gkemulticloud.v1.AzureClustersSettings; +import java.time.Duration; + +public class SyncGetAzureClient { + + public static void main(String[] args) throws Exception { + syncGetAzureClient(); + } + + public static void syncGetAzureClient() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + AzureClustersSettings.Builder azureClustersSettingsBuilder = AzureClustersSettings.newBuilder(); + azureClustersSettingsBuilder + .getAzureClientSettings() + .setRetrySettings( + azureClustersSettingsBuilder + .getAzureClientSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + AzureClustersSettings azureClustersSettings = azureClustersSettingsBuilder.build(); + } +} +// [END gkemulticloud_v1_generated_azureclusterssettings_getazureclient_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/stub/awsclustersstubsettings/getawscluster/SyncGetAwsCluster.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/stub/awsclustersstubsettings/getawscluster/SyncGetAwsCluster.java new file mode 100644 index 0000000..d464022 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/stub/awsclustersstubsettings/getawscluster/SyncGetAwsCluster.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.gkemulticloud.v1.stub.samples; + +// [START gkemulticloud_v1_generated_awsclustersstubsettings_getawscluster_sync] +import com.google.cloud.gkemulticloud.v1.stub.AwsClustersStubSettings; +import java.time.Duration; + +public class SyncGetAwsCluster { + + public static void main(String[] args) throws Exception { + syncGetAwsCluster(); + } + + public static void syncGetAwsCluster() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + AwsClustersStubSettings.Builder awsClustersSettingsBuilder = + AwsClustersStubSettings.newBuilder(); + awsClustersSettingsBuilder + .getAwsClusterSettings() + .setRetrySettings( + awsClustersSettingsBuilder + .getAwsClusterSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + AwsClustersStubSettings awsClustersSettings = awsClustersSettingsBuilder.build(); + } +} +// [END gkemulticloud_v1_generated_awsclustersstubsettings_getawscluster_sync] diff --git a/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/stub/azureclustersstubsettings/getazureclient/SyncGetAzureClient.java b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/stub/azureclustersstubsettings/getazureclient/SyncGetAzureClient.java new file mode 100644 index 0000000..3f10e3a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/stub/azureclustersstubsettings/getazureclient/SyncGetAzureClient.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.gkemulticloud.v1.stub.samples; + +// [START gkemulticloud_v1_generated_azureclustersstubsettings_getazureclient_sync] +import com.google.cloud.gkemulticloud.v1.stub.AzureClustersStubSettings; +import java.time.Duration; + +public class SyncGetAzureClient { + + public static void main(String[] args) throws Exception { + syncGetAzureClient(); + } + + public static void syncGetAzureClient() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + AzureClustersStubSettings.Builder azureClustersSettingsBuilder = + AzureClustersStubSettings.newBuilder(); + azureClustersSettingsBuilder + .getAzureClientSettings() + .setRetrySettings( + azureClustersSettingsBuilder + .getAzureClientSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + AzureClustersStubSettings azureClustersSettings = azureClustersSettingsBuilder.build(); + } +} +// [END gkemulticloud_v1_generated_azureclustersstubsettings_getazureclient_sync]