diff --git a/java-gke-multi-cloud/README.md b/java-gke-multi-cloud/README.md index 03b990613644..14a8978c80c0 100644 --- a/java-gke-multi-cloud/README.md +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/google-cloud-gke-multi-cloud/pom.xml b/java-gke-multi-cloud/google-cloud-gke-multi-cloud/pom.xml index 6d6e960aaec7..908696bb884e 100644 --- a/java-gke-multi-cloud/google-cloud-gke-multi-cloud/pom.xml +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AwsClustersClient.java b/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AwsClustersClient.java index fe73a5aa899c..b03b742b5868 100644 --- a/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AwsClustersClient.java +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AwsClustersSettings.java b/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AwsClustersSettings.java index 2361c6d53a23..5a8579aca7cd 100644 --- a/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AwsClustersSettings.java +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AzureClustersClient.java b/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AzureClustersClient.java index 91e8551ab643..bc36485c985c 100644 --- a/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AzureClustersClient.java +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AzureClustersSettings.java b/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AzureClustersSettings.java index 9d08bfd6b896..77c4b9025feb 100644 --- a/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/AzureClustersSettings.java +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AwsClustersStub.java b/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AwsClustersStub.java index fac79eb515a9..0c2602949737 100644 --- a/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AwsClustersStub.java +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AwsClustersStubSettings.java b/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AwsClustersStubSettings.java index eeaa39c4b165..2a33709339c4 100644 --- a/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AwsClustersStubSettings.java +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AzureClustersStub.java b/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AzureClustersStub.java index a3ade7e0a39a..e3f73eb65bd9 100644 --- a/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AzureClustersStub.java +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AzureClustersStubSettings.java b/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AzureClustersStubSettings.java index 8d1328790764..359848f48096 100644 --- a/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/AzureClustersStubSettings.java +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/HttpJsonAwsClustersCallableFactory.java b/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/HttpJsonAwsClustersCallableFactory.java new file mode 100644 index 000000000000..9a5a634b2aed --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/HttpJsonAwsClustersStub.java b/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/HttpJsonAwsClustersStub.java new file mode 100644 index 000000000000..7bf2af1777df --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/HttpJsonAzureClustersCallableFactory.java b/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/HttpJsonAzureClustersCallableFactory.java new file mode 100644 index 000000000000..39086ef7eb98 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/HttpJsonAzureClustersStub.java b/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/main/java/com/google/cloud/gkemulticloud/v1/stub/HttpJsonAzureClustersStub.java new file mode 100644 index 000000000000..68556637652b --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/test/java/com/google/cloud/gkemulticloud/v1/AwsClustersClientHttpJsonTest.java b/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/test/java/com/google/cloud/gkemulticloud/v1/AwsClustersClientHttpJsonTest.java new file mode 100644 index 000000000000..d45b2cb96a2d --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/test/java/com/google/cloud/gkemulticloud/v1/AzureClustersClientHttpJsonTest.java b/java-gke-multi-cloud/google-cloud-gke-multi-cloud/src/test/java/com/google/cloud/gkemulticloud/v1/AzureClustersClientHttpJsonTest.java new file mode 100644 index 000000000000..d1405e2f38be --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/create/SyncCreateSetCredentialsProvider.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..107b79b3cf26 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/create/SyncCreateSetCredentialsProvider1.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 000000000000..b1484b0b6740 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/create/SyncCreateSetEndpoint.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..da9cc7fbddfa --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/AsyncCreateAwsCluster.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/AsyncCreateAwsCluster.java new file mode 100644 index 000000000000..cd67a9f64bf9 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/AsyncCreateAwsClusterLRO.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/AsyncCreateAwsClusterLRO.java new file mode 100644 index 000000000000..bfe9b410c721 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/SyncCreateAwsCluster.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/SyncCreateAwsCluster.java new file mode 100644 index 000000000000..ec90fb9c6041 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/SyncCreateAwsClusterLocationnameAwsclusterString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/SyncCreateAwsClusterLocationnameAwsclusterString.java new file mode 100644 index 000000000000..35f97db0ab4e --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/SyncCreateAwsClusterStringAwsclusterString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawscluster/SyncCreateAwsClusterStringAwsclusterString.java new file mode 100644 index 000000000000..bb6b77eafdab --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/AsyncCreateAwsNodePool.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/AsyncCreateAwsNodePool.java new file mode 100644 index 000000000000..d681f43942b8 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/AsyncCreateAwsNodePoolLRO.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/AsyncCreateAwsNodePoolLRO.java new file mode 100644 index 000000000000..053c9779d103 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/SyncCreateAwsNodePool.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/SyncCreateAwsNodePool.java new file mode 100644 index 000000000000..efff780063ec --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/SyncCreateAwsNodePoolAwsclusternameAwsnodepoolString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/SyncCreateAwsNodePoolAwsclusternameAwsnodepoolString.java new file mode 100644 index 000000000000..f7bd08725bc4 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/SyncCreateAwsNodePoolStringAwsnodepoolString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/createawsnodepool/SyncCreateAwsNodePoolStringAwsnodepoolString.java new file mode 100644 index 000000000000..87c11386055d --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/AsyncDeleteAwsCluster.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/AsyncDeleteAwsCluster.java new file mode 100644 index 000000000000..38de192b64f4 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/AsyncDeleteAwsClusterLRO.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/AsyncDeleteAwsClusterLRO.java new file mode 100644 index 000000000000..f01dcc161678 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/SyncDeleteAwsCluster.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/SyncDeleteAwsCluster.java new file mode 100644 index 000000000000..a1a57ddce116 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/SyncDeleteAwsClusterAwsclustername.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/SyncDeleteAwsClusterAwsclustername.java new file mode 100644 index 000000000000..795075adc867 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/SyncDeleteAwsClusterString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawscluster/SyncDeleteAwsClusterString.java new file mode 100644 index 000000000000..e0021a434e4a --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/AsyncDeleteAwsNodePool.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/AsyncDeleteAwsNodePool.java new file mode 100644 index 000000000000..6d5560c901ff --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/AsyncDeleteAwsNodePoolLRO.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/AsyncDeleteAwsNodePoolLRO.java new file mode 100644 index 000000000000..7805b9e3576f --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/SyncDeleteAwsNodePool.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/SyncDeleteAwsNodePool.java new file mode 100644 index 000000000000..694616ea2755 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/SyncDeleteAwsNodePoolAwsnodepoolname.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/SyncDeleteAwsNodePoolAwsnodepoolname.java new file mode 100644 index 000000000000..19878ba3f503 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/SyncDeleteAwsNodePoolString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/deleteawsnodepool/SyncDeleteAwsNodePoolString.java new file mode 100644 index 000000000000..2acf9c0ef4e5 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/generateawsaccesstoken/AsyncGenerateAwsAccessToken.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/generateawsaccesstoken/AsyncGenerateAwsAccessToken.java new file mode 100644 index 000000000000..34a3f3c8a87f --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/generateawsaccesstoken/SyncGenerateAwsAccessToken.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/generateawsaccesstoken/SyncGenerateAwsAccessToken.java new file mode 100644 index 000000000000..10325076b02d --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawscluster/AsyncGetAwsCluster.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawscluster/AsyncGetAwsCluster.java new file mode 100644 index 000000000000..f6d25a63d40d --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawscluster/SyncGetAwsCluster.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawscluster/SyncGetAwsCluster.java new file mode 100644 index 000000000000..8a369ddbdc98 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawscluster/SyncGetAwsClusterAwsclustername.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawscluster/SyncGetAwsClusterAwsclustername.java new file mode 100644 index 000000000000..dfbeb3320090 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawscluster/SyncGetAwsClusterString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawscluster/SyncGetAwsClusterString.java new file mode 100644 index 000000000000..507447c03f13 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsnodepool/AsyncGetAwsNodePool.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsnodepool/AsyncGetAwsNodePool.java new file mode 100644 index 000000000000..3d35edd6e99a --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsnodepool/SyncGetAwsNodePool.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsnodepool/SyncGetAwsNodePool.java new file mode 100644 index 000000000000..8a8a3e2b9c7e --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsnodepool/SyncGetAwsNodePoolAwsnodepoolname.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsnodepool/SyncGetAwsNodePoolAwsnodepoolname.java new file mode 100644 index 000000000000..16d8e296039d --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsnodepool/SyncGetAwsNodePoolString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsnodepool/SyncGetAwsNodePoolString.java new file mode 100644 index 000000000000..b0138c403528 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsserverconfig/AsyncGetAwsServerConfig.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsserverconfig/AsyncGetAwsServerConfig.java new file mode 100644 index 000000000000..11703b319c68 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsserverconfig/SyncGetAwsServerConfig.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsserverconfig/SyncGetAwsServerConfig.java new file mode 100644 index 000000000000..a100ea99b448 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsserverconfig/SyncGetAwsServerConfigAwsserverconfigname.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsserverconfig/SyncGetAwsServerConfigAwsserverconfigname.java new file mode 100644 index 000000000000..2fe7dd5c7bc0 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsserverconfig/SyncGetAwsServerConfigString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/getawsserverconfig/SyncGetAwsServerConfigString.java new file mode 100644 index 000000000000..cfd3543a0612 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/AsyncListAwsClusters.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/AsyncListAwsClusters.java new file mode 100644 index 000000000000..59f44f3899ff --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/AsyncListAwsClustersPaged.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/AsyncListAwsClustersPaged.java new file mode 100644 index 000000000000..9c3e04d846e6 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/SyncListAwsClusters.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/SyncListAwsClusters.java new file mode 100644 index 000000000000..624ac853cbfa --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/SyncListAwsClustersLocationname.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/SyncListAwsClustersLocationname.java new file mode 100644 index 000000000000..24e2089c55be --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/SyncListAwsClustersString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsclusters/SyncListAwsClustersString.java new file mode 100644 index 000000000000..5d357149718e --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/AsyncListAwsNodePools.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/AsyncListAwsNodePools.java new file mode 100644 index 000000000000..26ebfc556d95 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/AsyncListAwsNodePoolsPaged.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/AsyncListAwsNodePoolsPaged.java new file mode 100644 index 000000000000..cbbc89f78b86 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/SyncListAwsNodePools.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/SyncListAwsNodePools.java new file mode 100644 index 000000000000..49e9ee1297df --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/SyncListAwsNodePoolsAwsclustername.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/SyncListAwsNodePoolsAwsclustername.java new file mode 100644 index 000000000000..1059e699ea50 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/SyncListAwsNodePoolsString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/listawsnodepools/SyncListAwsNodePoolsString.java new file mode 100644 index 000000000000..3025d767a865 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawscluster/AsyncUpdateAwsCluster.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawscluster/AsyncUpdateAwsCluster.java new file mode 100644 index 000000000000..204ff52351c7 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawscluster/AsyncUpdateAwsClusterLRO.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawscluster/AsyncUpdateAwsClusterLRO.java new file mode 100644 index 000000000000..bfeebcfa9c7d --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawscluster/SyncUpdateAwsCluster.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawscluster/SyncUpdateAwsCluster.java new file mode 100644 index 000000000000..82d0e86ca171 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawscluster/SyncUpdateAwsClusterAwsclusterFieldmask.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawscluster/SyncUpdateAwsClusterAwsclusterFieldmask.java new file mode 100644 index 000000000000..b93a11565b2e --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawsnodepool/AsyncUpdateAwsNodePool.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawsnodepool/AsyncUpdateAwsNodePool.java new file mode 100644 index 000000000000..b00ee7a2eeab --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawsnodepool/AsyncUpdateAwsNodePoolLRO.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawsnodepool/AsyncUpdateAwsNodePoolLRO.java new file mode 100644 index 000000000000..8f9f26425630 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawsnodepool/SyncUpdateAwsNodePool.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawsnodepool/SyncUpdateAwsNodePool.java new file mode 100644 index 000000000000..e132501cc43d --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawsnodepool/SyncUpdateAwsNodePoolAwsnodepoolFieldmask.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclustersclient/updateawsnodepool/SyncUpdateAwsNodePoolAwsnodepoolFieldmask.java new file mode 100644 index 000000000000..3f8052ba87ea --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclusterssettings/getawscluster/SyncGetAwsCluster.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/awsclusterssettings/getawscluster/SyncGetAwsCluster.java new file mode 100644 index 000000000000..7a72be52acec --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/create/SyncCreateSetCredentialsProvider.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..d28792b8df8f --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/create/SyncCreateSetCredentialsProvider1.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 000000000000..c200d792d235 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/create/SyncCreateSetEndpoint.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..f76ac688b752 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/AsyncCreateAzureClient.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/AsyncCreateAzureClient.java new file mode 100644 index 000000000000..d8efbf46d2e7 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/AsyncCreateAzureClientLRO.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/AsyncCreateAzureClientLRO.java new file mode 100644 index 000000000000..c609eea5904d --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/SyncCreateAzureClient.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/SyncCreateAzureClient.java new file mode 100644 index 000000000000..03df9f8c1298 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/SyncCreateAzureClientLocationnameAzureclientString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/SyncCreateAzureClientLocationnameAzureclientString.java new file mode 100644 index 000000000000..b0fd0ac3dc5c --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/SyncCreateAzureClientStringAzureclientString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazureclient/SyncCreateAzureClientStringAzureclientString.java new file mode 100644 index 000000000000..603a898ba15e --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/AsyncCreateAzureCluster.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/AsyncCreateAzureCluster.java new file mode 100644 index 000000000000..327e18067778 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/AsyncCreateAzureClusterLRO.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/AsyncCreateAzureClusterLRO.java new file mode 100644 index 000000000000..576390395c1b --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/SyncCreateAzureCluster.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/SyncCreateAzureCluster.java new file mode 100644 index 000000000000..665f95f6de51 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/SyncCreateAzureClusterLocationnameAzureclusterString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/SyncCreateAzureClusterLocationnameAzureclusterString.java new file mode 100644 index 000000000000..f6b5501cbb3e --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/SyncCreateAzureClusterStringAzureclusterString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurecluster/SyncCreateAzureClusterStringAzureclusterString.java new file mode 100644 index 000000000000..18f29853684d --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/AsyncCreateAzureNodePool.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/AsyncCreateAzureNodePool.java new file mode 100644 index 000000000000..6610ac6a95f6 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/AsyncCreateAzureNodePoolLRO.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/AsyncCreateAzureNodePoolLRO.java new file mode 100644 index 000000000000..6481db5df134 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/SyncCreateAzureNodePool.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/SyncCreateAzureNodePool.java new file mode 100644 index 000000000000..346ed1a163c0 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/SyncCreateAzureNodePoolAzureclusternameAzurenodepoolString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/SyncCreateAzureNodePoolAzureclusternameAzurenodepoolString.java new file mode 100644 index 000000000000..5d83303800de --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/SyncCreateAzureNodePoolStringAzurenodepoolString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/createazurenodepool/SyncCreateAzureNodePoolStringAzurenodepoolString.java new file mode 100644 index 000000000000..e3b274213c42 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/AsyncDeleteAzureClient.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/AsyncDeleteAzureClient.java new file mode 100644 index 000000000000..0bb072deb77d --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/AsyncDeleteAzureClientLRO.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/AsyncDeleteAzureClientLRO.java new file mode 100644 index 000000000000..00c8718ae6ec --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/SyncDeleteAzureClient.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/SyncDeleteAzureClient.java new file mode 100644 index 000000000000..df1e7260f54f --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/SyncDeleteAzureClientAzureclientname.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/SyncDeleteAzureClientAzureclientname.java new file mode 100644 index 000000000000..2df7f7cda1ea --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/SyncDeleteAzureClientString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazureclient/SyncDeleteAzureClientString.java new file mode 100644 index 000000000000..5ac317c2eac0 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/AsyncDeleteAzureCluster.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/AsyncDeleteAzureCluster.java new file mode 100644 index 000000000000..a7b8e203c445 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/AsyncDeleteAzureClusterLRO.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/AsyncDeleteAzureClusterLRO.java new file mode 100644 index 000000000000..f7a2a73cc949 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/SyncDeleteAzureCluster.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/SyncDeleteAzureCluster.java new file mode 100644 index 000000000000..258ffd22dbae --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/SyncDeleteAzureClusterAzureclustername.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/SyncDeleteAzureClusterAzureclustername.java new file mode 100644 index 000000000000..ecd35d50028a --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/SyncDeleteAzureClusterString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurecluster/SyncDeleteAzureClusterString.java new file mode 100644 index 000000000000..44c167cb5912 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/AsyncDeleteAzureNodePool.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/AsyncDeleteAzureNodePool.java new file mode 100644 index 000000000000..b30f383ee460 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/AsyncDeleteAzureNodePoolLRO.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/AsyncDeleteAzureNodePoolLRO.java new file mode 100644 index 000000000000..31a4bdc00c44 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/SyncDeleteAzureNodePool.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/SyncDeleteAzureNodePool.java new file mode 100644 index 000000000000..bbafcd06106f --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/SyncDeleteAzureNodePoolAzurenodepoolname.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/SyncDeleteAzureNodePoolAzurenodepoolname.java new file mode 100644 index 000000000000..1764166958cf --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/SyncDeleteAzureNodePoolString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/deleteazurenodepool/SyncDeleteAzureNodePoolString.java new file mode 100644 index 000000000000..b3ad945e58bc --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/generateazureaccesstoken/AsyncGenerateAzureAccessToken.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/generateazureaccesstoken/AsyncGenerateAzureAccessToken.java new file mode 100644 index 000000000000..c08a905dc61f --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/generateazureaccesstoken/SyncGenerateAzureAccessToken.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/generateazureaccesstoken/SyncGenerateAzureAccessToken.java new file mode 100644 index 000000000000..cf3099fe420c --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureclient/AsyncGetAzureClient.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureclient/AsyncGetAzureClient.java new file mode 100644 index 000000000000..0bf9b06bfd79 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureclient/SyncGetAzureClient.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureclient/SyncGetAzureClient.java new file mode 100644 index 000000000000..e6a4feeae5f7 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureclient/SyncGetAzureClientAzureclientname.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureclient/SyncGetAzureClientAzureclientname.java new file mode 100644 index 000000000000..ceb053fcb357 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureclient/SyncGetAzureClientString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureclient/SyncGetAzureClientString.java new file mode 100644 index 000000000000..d425e0969ef7 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurecluster/AsyncGetAzureCluster.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurecluster/AsyncGetAzureCluster.java new file mode 100644 index 000000000000..ca57c9b060b3 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurecluster/SyncGetAzureCluster.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurecluster/SyncGetAzureCluster.java new file mode 100644 index 000000000000..37d615f725e3 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurecluster/SyncGetAzureClusterAzureclustername.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurecluster/SyncGetAzureClusterAzureclustername.java new file mode 100644 index 000000000000..37fe7bc04629 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurecluster/SyncGetAzureClusterString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurecluster/SyncGetAzureClusterString.java new file mode 100644 index 000000000000..e533e84f9547 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurenodepool/AsyncGetAzureNodePool.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurenodepool/AsyncGetAzureNodePool.java new file mode 100644 index 000000000000..264571363696 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurenodepool/SyncGetAzureNodePool.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurenodepool/SyncGetAzureNodePool.java new file mode 100644 index 000000000000..242972775da7 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurenodepool/SyncGetAzureNodePoolAzurenodepoolname.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurenodepool/SyncGetAzureNodePoolAzurenodepoolname.java new file mode 100644 index 000000000000..724f0dcff0ca --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurenodepool/SyncGetAzureNodePoolString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazurenodepool/SyncGetAzureNodePoolString.java new file mode 100644 index 000000000000..c1d477c907df --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureserverconfig/AsyncGetAzureServerConfig.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureserverconfig/AsyncGetAzureServerConfig.java new file mode 100644 index 000000000000..1cd0b9c7b319 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureserverconfig/SyncGetAzureServerConfig.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureserverconfig/SyncGetAzureServerConfig.java new file mode 100644 index 000000000000..09c0cd15116d --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureserverconfig/SyncGetAzureServerConfigAzureserverconfigname.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureserverconfig/SyncGetAzureServerConfigAzureserverconfigname.java new file mode 100644 index 000000000000..ceca057fae69 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureserverconfig/SyncGetAzureServerConfigString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/getazureserverconfig/SyncGetAzureServerConfigString.java new file mode 100644 index 000000000000..9685e4a6098a --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/AsyncListAzureClients.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/AsyncListAzureClients.java new file mode 100644 index 000000000000..4d808dfcb578 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/AsyncListAzureClientsPaged.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/AsyncListAzureClientsPaged.java new file mode 100644 index 000000000000..9ce4b4848d83 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/SyncListAzureClients.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/SyncListAzureClients.java new file mode 100644 index 000000000000..4793319a9ad3 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/SyncListAzureClientsLocationname.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/SyncListAzureClientsLocationname.java new file mode 100644 index 000000000000..9ceacf62e2cd --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/SyncListAzureClientsString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclients/SyncListAzureClientsString.java new file mode 100644 index 000000000000..27721fca9806 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/AsyncListAzureClusters.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/AsyncListAzureClusters.java new file mode 100644 index 000000000000..a033d1f6cfce --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/AsyncListAzureClustersPaged.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/AsyncListAzureClustersPaged.java new file mode 100644 index 000000000000..379bcb104452 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/SyncListAzureClusters.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/SyncListAzureClusters.java new file mode 100644 index 000000000000..11d421e75830 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/SyncListAzureClustersLocationname.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/SyncListAzureClustersLocationname.java new file mode 100644 index 000000000000..0681f36bf82a --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/SyncListAzureClustersString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazureclusters/SyncListAzureClustersString.java new file mode 100644 index 000000000000..638edd7824a4 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/AsyncListAzureNodePools.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/AsyncListAzureNodePools.java new file mode 100644 index 000000000000..bf2b761e8852 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/AsyncListAzureNodePoolsPaged.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/AsyncListAzureNodePoolsPaged.java new file mode 100644 index 000000000000..7313702fb568 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/SyncListAzureNodePools.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/SyncListAzureNodePools.java new file mode 100644 index 000000000000..ac05fcd2702c --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/SyncListAzureNodePoolsAzureclustername.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/SyncListAzureNodePoolsAzureclustername.java new file mode 100644 index 000000000000..d336d5e32e98 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/SyncListAzureNodePoolsString.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/listazurenodepools/SyncListAzureNodePoolsString.java new file mode 100644 index 000000000000..3500b71a711b --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurecluster/AsyncUpdateAzureCluster.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurecluster/AsyncUpdateAzureCluster.java new file mode 100644 index 000000000000..f705919aea13 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurecluster/AsyncUpdateAzureClusterLRO.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurecluster/AsyncUpdateAzureClusterLRO.java new file mode 100644 index 000000000000..44431d3e9897 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurecluster/SyncUpdateAzureCluster.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurecluster/SyncUpdateAzureCluster.java new file mode 100644 index 000000000000..5e4fe5a264ad --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurecluster/SyncUpdateAzureClusterAzureclusterFieldmask.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurecluster/SyncUpdateAzureClusterAzureclusterFieldmask.java new file mode 100644 index 000000000000..a8696ff7657b --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurenodepool/AsyncUpdateAzureNodePool.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurenodepool/AsyncUpdateAzureNodePool.java new file mode 100644 index 000000000000..d9f77456533f --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurenodepool/AsyncUpdateAzureNodePoolLRO.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurenodepool/AsyncUpdateAzureNodePoolLRO.java new file mode 100644 index 000000000000..1264248659fc --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurenodepool/SyncUpdateAzureNodePool.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurenodepool/SyncUpdateAzureNodePool.java new file mode 100644 index 000000000000..0ea8916fff9f --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurenodepool/SyncUpdateAzureNodePoolAzurenodepoolFieldmask.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclustersclient/updateazurenodepool/SyncUpdateAzureNodePoolAzurenodepoolFieldmask.java new file mode 100644 index 000000000000..068b9656bb37 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclusterssettings/getazureclient/SyncGetAzureClient.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/azureclusterssettings/getazureclient/SyncGetAzureClient.java new file mode 100644 index 000000000000..280a43c1ae52 --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/stub/awsclustersstubsettings/getawscluster/SyncGetAwsCluster.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/stub/awsclustersstubsettings/getawscluster/SyncGetAwsCluster.java new file mode 100644 index 000000000000..d46402227b0d --- /dev/null +++ b/java-gke-multi-cloud/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/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/stub/azureclustersstubsettings/getazureclient/SyncGetAzureClient.java b/java-gke-multi-cloud/samples/snippets/generated/com/google/cloud/gkemulticloud/v1/stub/azureclustersstubsettings/getazureclient/SyncGetAzureClient.java new file mode 100644 index 000000000000..3f10e3a71b14 --- /dev/null +++ b/java-gke-multi-cloud/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]