diff --git a/google-cloud-certificate-manager/pom.xml b/google-cloud-certificate-manager/pom.xml index a7b32ce..aa13d5d 100644 --- a/google-cloud-certificate-manager/pom.xml +++ b/google-cloud-certificate-manager/pom.xml @@ -58,6 +58,10 @@ com.google.api gax-grpc + + com.google.api + gax-httpjson + org.threeten threetenbp @@ -77,12 +81,24 @@ test + + com.google.api + gax + testlib + test + com.google.api gax-grpc testlib test + + com.google.api + gax-httpjson + testlib + test + diff --git a/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/CertificateManagerClient.java b/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/CertificateManagerClient.java index 8fba821..2abf310 100644 --- a/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/CertificateManagerClient.java +++ b/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/CertificateManagerClient.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.certificatemanager.v1.stub.CertificateManagerStubSettings; 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; @@ -129,13 +129,29 @@ * CertificateManagerClient.create(certificateManagerSettings); * } * + *

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.
+ * CertificateManagerSettings certificateManagerSettings =
+ *     CertificateManagerSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             CertificateManagerSettings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * CertificateManagerClient certificateManagerClient =
+ *     CertificateManagerClient.create(certificateManagerSettings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") public class CertificateManagerClient implements BackgroundResource { private final CertificateManagerSettings settings; private final CertificateManagerStub stub; - private final OperationsClient operationsClient; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of CertificateManagerClient with default settings. */ public static final CertificateManagerClient create() throws IOException { @@ -167,13 +183,17 @@ public static final CertificateManagerClient create(CertificateManagerStub stub) protected CertificateManagerClient(CertificateManagerSettings settings) throws IOException { this.settings = settings; this.stub = ((CertificateManagerStubSettings) 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 CertificateManagerClient(CertificateManagerStub 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 CertificateManagerSettings getSettings() { @@ -188,10 +208,18 @@ public CertificateManagerStub 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. /** * Lists Certificates in a given project and location. diff --git a/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/CertificateManagerSettings.java b/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/CertificateManagerSettings.java index 9c23009..972dcfc 100644 --- a/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/CertificateManagerSettings.java +++ b/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/CertificateManagerSettings.java @@ -26,6 +26,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; @@ -310,11 +311,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return CertificateManagerStubSettings.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 CertificateManagerStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return CertificateManagerStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return CertificateManagerStubSettings.defaultTransportChannelProvider(); } @@ -324,11 +332,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return CertificateManagerStubSettings.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); @@ -366,6 +380,11 @@ private static Builder createDefault() { return new Builder(CertificateManagerStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(CertificateManagerStubSettings.newHttpJsonBuilder()); + } + public CertificateManagerStubSettings.Builder getStubSettingsBuilder() { return ((CertificateManagerStubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/CertificateManagerStub.java b/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/CertificateManagerStub.java index 19ccb4d..b91593e 100644 --- a/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/CertificateManagerStub.java +++ b/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/CertificateManagerStub.java @@ -68,7 +68,11 @@ public abstract class CertificateManagerStub implements BackgroundResource { public OperationsStub getOperationsStub() { - throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); + return null; + } + + public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { + return null; } public UnaryCallable diff --git a/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/CertificateManagerStubSettings.java b/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/CertificateManagerStubSettings.java index 6dd5846..66f842a 100644 --- a/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/CertificateManagerStubSettings.java +++ b/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/CertificateManagerStubSettings.java @@ -31,6 +31,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; @@ -664,6 +667,11 @@ public CertificateManagerStub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcCertificateManagerStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonCertificateManagerStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -696,18 +704,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(CertificateManagerStubSettings.class)) @@ -715,11 +730,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(CertificateManagerStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return CertificateManagerStubSettings.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); @@ -1049,6 +1083,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 .listCertificatesSettings() diff --git a/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/HttpJsonCertificateManagerCallableFactory.java b/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/HttpJsonCertificateManagerCallableFactory.java new file mode 100644 index 0000000..caabb41 --- /dev/null +++ b/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/HttpJsonCertificateManagerCallableFactory.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.certificatemanager.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 CertificateManager service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonCertificateManagerCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/HttpJsonCertificateManagerStub.java b/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/HttpJsonCertificateManagerStub.java new file mode 100644 index 0000000..0683ebe --- /dev/null +++ b/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/HttpJsonCertificateManagerStub.java @@ -0,0 +1,1579 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.certificatemanager.v1.stub; + +import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListCertificateMapEntriesPagedResponse; +import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListCertificateMapsPagedResponse; +import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListCertificatesPagedResponse; +import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListDnsAuthorizationsPagedResponse; + +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.certificatemanager.v1.Certificate; +import com.google.cloud.certificatemanager.v1.CertificateMap; +import com.google.cloud.certificatemanager.v1.CertificateMapEntry; +import com.google.cloud.certificatemanager.v1.CreateCertificateMapEntryRequest; +import com.google.cloud.certificatemanager.v1.CreateCertificateMapRequest; +import com.google.cloud.certificatemanager.v1.CreateCertificateRequest; +import com.google.cloud.certificatemanager.v1.CreateDnsAuthorizationRequest; +import com.google.cloud.certificatemanager.v1.DeleteCertificateMapEntryRequest; +import com.google.cloud.certificatemanager.v1.DeleteCertificateMapRequest; +import com.google.cloud.certificatemanager.v1.DeleteCertificateRequest; +import com.google.cloud.certificatemanager.v1.DeleteDnsAuthorizationRequest; +import com.google.cloud.certificatemanager.v1.DnsAuthorization; +import com.google.cloud.certificatemanager.v1.GetCertificateMapEntryRequest; +import com.google.cloud.certificatemanager.v1.GetCertificateMapRequest; +import com.google.cloud.certificatemanager.v1.GetCertificateRequest; +import com.google.cloud.certificatemanager.v1.GetDnsAuthorizationRequest; +import com.google.cloud.certificatemanager.v1.ListCertificateMapEntriesRequest; +import com.google.cloud.certificatemanager.v1.ListCertificateMapEntriesResponse; +import com.google.cloud.certificatemanager.v1.ListCertificateMapsRequest; +import com.google.cloud.certificatemanager.v1.ListCertificateMapsResponse; +import com.google.cloud.certificatemanager.v1.ListCertificatesRequest; +import com.google.cloud.certificatemanager.v1.ListCertificatesResponse; +import com.google.cloud.certificatemanager.v1.ListDnsAuthorizationsRequest; +import com.google.cloud.certificatemanager.v1.ListDnsAuthorizationsResponse; +import com.google.cloud.certificatemanager.v1.OperationMetadata; +import com.google.cloud.certificatemanager.v1.UpdateCertificateMapEntryRequest; +import com.google.cloud.certificatemanager.v1.UpdateCertificateMapRequest; +import com.google.cloud.certificatemanager.v1.UpdateCertificateRequest; +import com.google.cloud.certificatemanager.v1.UpdateDnsAuthorizationRequest; +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 CertificateManager service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonCertificateManagerStub extends CertificateManagerStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(Empty.getDescriptor()) + .add(CertificateMap.getDescriptor()) + .add(Certificate.getDescriptor()) + .add(CertificateMapEntry.getDescriptor()) + .add(OperationMetadata.getDescriptor()) + .add(DnsAuthorization.getDescriptor()) + .build(); + + private static final ApiMethodDescriptor + listCertificatesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.certificatemanager.v1.CertificateManager/ListCertificates") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/certificates", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam(fields, "orderBy", request.getOrderBy()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListCertificatesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getCertificateMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.certificatemanager.v1.CertificateManager/GetCertificate") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/certificates/*}", + 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(Certificate.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createCertificateMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.certificatemanager.v1.CertificateManager/CreateCertificate") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/certificates", + 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, "certificateId", request.getCertificateId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("certificate", request.getCertificate())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateCertificateRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + updateCertificateMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.certificatemanager.v1.CertificateManager/UpdateCertificate") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{certificate.name=projects/*/locations/*/certificates/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "certificate.name", request.getCertificate().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("certificate", request.getCertificate())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateCertificateRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + deleteCertificateMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.certificatemanager.v1.CertificateManager/DeleteCertificate") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/certificates/*}", + 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(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteCertificateRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + listCertificateMapsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.certificatemanager.v1.CertificateManager/ListCertificateMaps") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/certificateMaps", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam(fields, "orderBy", request.getOrderBy()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListCertificateMapsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getCertificateMapMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.certificatemanager.v1.CertificateManager/GetCertificateMap") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/certificateMaps/*}", + 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(CertificateMap.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createCertificateMapMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.certificatemanager.v1.CertificateManager/CreateCertificateMap") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/certificateMaps", + 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, "certificateMapId", request.getCertificateMapId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("certificateMap", request.getCertificateMap())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateCertificateMapRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + updateCertificateMapMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.certificatemanager.v1.CertificateManager/UpdateCertificateMap") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{certificateMap.name=projects/*/locations/*/certificateMaps/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "certificateMap.name", + request.getCertificateMap().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("certificateMap", request.getCertificateMap())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateCertificateMapRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + deleteCertificateMapMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.certificatemanager.v1.CertificateManager/DeleteCertificateMap") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/certificateMaps/*}", + 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(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteCertificateMapRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor< + ListCertificateMapEntriesRequest, ListCertificateMapEntriesResponse> + listCertificateMapEntriesMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.certificatemanager.v1.CertificateManager/ListCertificateMapEntries") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*/certificateMaps/*}/certificateMapEntries", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam(fields, "orderBy", request.getOrderBy()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListCertificateMapEntriesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getCertificateMapEntryMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.certificatemanager.v1.CertificateManager/GetCertificateMapEntry") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/certificateMaps/*/certificateMapEntries/*}", + 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(CertificateMapEntry.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createCertificateMapEntryMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.certificatemanager.v1.CertificateManager/CreateCertificateMapEntry") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*/certificateMaps/*}/certificateMapEntries", + 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, + "certificateMapEntryId", + request.getCertificateMapEntryId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("certificateMapEntry", request.getCertificateMapEntry())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateCertificateMapEntryRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + updateCertificateMapEntryMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.certificatemanager.v1.CertificateManager/UpdateCertificateMapEntry") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{certificateMapEntry.name=projects/*/locations/*/certificateMaps/*/certificateMapEntries/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "certificateMapEntry.name", + request.getCertificateMapEntry().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("certificateMapEntry", request.getCertificateMapEntry())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateCertificateMapEntryRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + deleteCertificateMapEntryMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.certificatemanager.v1.CertificateManager/DeleteCertificateMapEntry") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/certificateMaps/*/certificateMapEntries/*}", + 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(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteCertificateMapEntryRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor< + ListDnsAuthorizationsRequest, ListDnsAuthorizationsResponse> + listDnsAuthorizationsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.certificatemanager.v1.CertificateManager/ListDnsAuthorizations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/dnsAuthorizations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam(fields, "orderBy", request.getOrderBy()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListDnsAuthorizationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getDnsAuthorizationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.certificatemanager.v1.CertificateManager/GetDnsAuthorization") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/dnsAuthorizations/*}", + 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(DnsAuthorization.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createDnsAuthorizationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.certificatemanager.v1.CertificateManager/CreateDnsAuthorization") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/dnsAuthorizations", + 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, "dnsAuthorizationId", request.getDnsAuthorizationId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("dnsAuthorization", request.getDnsAuthorization())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateDnsAuthorizationRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + updateDnsAuthorizationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.certificatemanager.v1.CertificateManager/UpdateDnsAuthorization") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{dnsAuthorization.name=projects/*/locations/*/dnsAuthorizations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "dnsAuthorization.name", + request.getDnsAuthorization().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("dnsAuthorization", request.getDnsAuthorization())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateDnsAuthorizationRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + deleteDnsAuthorizationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.certificatemanager.v1.CertificateManager/DeleteDnsAuthorization") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/dnsAuthorizations/*}", + 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(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteDnsAuthorizationRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private final UnaryCallable + listCertificatesCallable; + private final UnaryCallable + listCertificatesPagedCallable; + private final UnaryCallable getCertificateCallable; + private final UnaryCallable createCertificateCallable; + private final OperationCallable + createCertificateOperationCallable; + private final UnaryCallable updateCertificateCallable; + private final OperationCallable + updateCertificateOperationCallable; + private final UnaryCallable deleteCertificateCallable; + private final OperationCallable + deleteCertificateOperationCallable; + private final UnaryCallable + listCertificateMapsCallable; + private final UnaryCallable + listCertificateMapsPagedCallable; + private final UnaryCallable getCertificateMapCallable; + private final UnaryCallable createCertificateMapCallable; + private final OperationCallable + createCertificateMapOperationCallable; + private final UnaryCallable updateCertificateMapCallable; + private final OperationCallable + updateCertificateMapOperationCallable; + private final UnaryCallable deleteCertificateMapCallable; + private final OperationCallable + deleteCertificateMapOperationCallable; + private final UnaryCallable + listCertificateMapEntriesCallable; + private final UnaryCallable< + ListCertificateMapEntriesRequest, ListCertificateMapEntriesPagedResponse> + listCertificateMapEntriesPagedCallable; + private final UnaryCallable + getCertificateMapEntryCallable; + private final UnaryCallable + createCertificateMapEntryCallable; + private final OperationCallable< + CreateCertificateMapEntryRequest, CertificateMapEntry, OperationMetadata> + createCertificateMapEntryOperationCallable; + private final UnaryCallable + updateCertificateMapEntryCallable; + private final OperationCallable< + UpdateCertificateMapEntryRequest, CertificateMapEntry, OperationMetadata> + updateCertificateMapEntryOperationCallable; + private final UnaryCallable + deleteCertificateMapEntryCallable; + private final OperationCallable + deleteCertificateMapEntryOperationCallable; + private final UnaryCallable + listDnsAuthorizationsCallable; + private final UnaryCallable + listDnsAuthorizationsPagedCallable; + private final UnaryCallable + getDnsAuthorizationCallable; + private final UnaryCallable + createDnsAuthorizationCallable; + private final OperationCallable< + CreateDnsAuthorizationRequest, DnsAuthorization, OperationMetadata> + createDnsAuthorizationOperationCallable; + private final UnaryCallable + updateDnsAuthorizationCallable; + private final OperationCallable< + UpdateDnsAuthorizationRequest, DnsAuthorization, OperationMetadata> + updateDnsAuthorizationOperationCallable; + private final UnaryCallable + deleteDnsAuthorizationCallable; + private final OperationCallable + deleteDnsAuthorizationOperationCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonCertificateManagerStub create(CertificateManagerStubSettings settings) + throws IOException { + return new HttpJsonCertificateManagerStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonCertificateManagerStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonCertificateManagerStub( + CertificateManagerStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonCertificateManagerStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonCertificateManagerStub( + CertificateManagerStubSettings.newHttpJsonBuilder().build(), + clientContext, + callableFactory); + } + + /** + * Constructs an instance of HttpJsonCertificateManagerStub, 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 HttpJsonCertificateManagerStub( + CertificateManagerStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonCertificateManagerCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonCertificateManagerStub, 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 HttpJsonCertificateManagerStub( + CertificateManagerStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings + listCertificatesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listCertificatesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getCertificateTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getCertificateMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings createCertificateTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createCertificateMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateCertificateTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateCertificateMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteCertificateTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteCertificateMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listCertificateMapsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listCertificateMapsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getCertificateMapTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getCertificateMapMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createCertificateMapTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createCertificateMapMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateCertificateMapTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateCertificateMapMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + deleteCertificateMapTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteCertificateMapMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listCertificateMapEntriesTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listCertificateMapEntriesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getCertificateMapEntryTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getCertificateMapEntryMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createCertificateMapEntryTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createCertificateMapEntryMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateCertificateMapEntryTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateCertificateMapEntryMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + deleteCertificateMapEntryTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteCertificateMapEntryMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listDnsAuthorizationsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listDnsAuthorizationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getDnsAuthorizationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getDnsAuthorizationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createDnsAuthorizationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createDnsAuthorizationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateDnsAuthorizationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateDnsAuthorizationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + deleteDnsAuthorizationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteDnsAuthorizationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.listCertificatesCallable = + callableFactory.createUnaryCallable( + listCertificatesTransportSettings, settings.listCertificatesSettings(), clientContext); + this.listCertificatesPagedCallable = + callableFactory.createPagedCallable( + listCertificatesTransportSettings, settings.listCertificatesSettings(), clientContext); + this.getCertificateCallable = + callableFactory.createUnaryCallable( + getCertificateTransportSettings, settings.getCertificateSettings(), clientContext); + this.createCertificateCallable = + callableFactory.createUnaryCallable( + createCertificateTransportSettings, + settings.createCertificateSettings(), + clientContext); + this.createCertificateOperationCallable = + callableFactory.createOperationCallable( + createCertificateTransportSettings, + settings.createCertificateOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.updateCertificateCallable = + callableFactory.createUnaryCallable( + updateCertificateTransportSettings, + settings.updateCertificateSettings(), + clientContext); + this.updateCertificateOperationCallable = + callableFactory.createOperationCallable( + updateCertificateTransportSettings, + settings.updateCertificateOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deleteCertificateCallable = + callableFactory.createUnaryCallable( + deleteCertificateTransportSettings, + settings.deleteCertificateSettings(), + clientContext); + this.deleteCertificateOperationCallable = + callableFactory.createOperationCallable( + deleteCertificateTransportSettings, + settings.deleteCertificateOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.listCertificateMapsCallable = + callableFactory.createUnaryCallable( + listCertificateMapsTransportSettings, + settings.listCertificateMapsSettings(), + clientContext); + this.listCertificateMapsPagedCallable = + callableFactory.createPagedCallable( + listCertificateMapsTransportSettings, + settings.listCertificateMapsSettings(), + clientContext); + this.getCertificateMapCallable = + callableFactory.createUnaryCallable( + getCertificateMapTransportSettings, + settings.getCertificateMapSettings(), + clientContext); + this.createCertificateMapCallable = + callableFactory.createUnaryCallable( + createCertificateMapTransportSettings, + settings.createCertificateMapSettings(), + clientContext); + this.createCertificateMapOperationCallable = + callableFactory.createOperationCallable( + createCertificateMapTransportSettings, + settings.createCertificateMapOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.updateCertificateMapCallable = + callableFactory.createUnaryCallable( + updateCertificateMapTransportSettings, + settings.updateCertificateMapSettings(), + clientContext); + this.updateCertificateMapOperationCallable = + callableFactory.createOperationCallable( + updateCertificateMapTransportSettings, + settings.updateCertificateMapOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deleteCertificateMapCallable = + callableFactory.createUnaryCallable( + deleteCertificateMapTransportSettings, + settings.deleteCertificateMapSettings(), + clientContext); + this.deleteCertificateMapOperationCallable = + callableFactory.createOperationCallable( + deleteCertificateMapTransportSettings, + settings.deleteCertificateMapOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.listCertificateMapEntriesCallable = + callableFactory.createUnaryCallable( + listCertificateMapEntriesTransportSettings, + settings.listCertificateMapEntriesSettings(), + clientContext); + this.listCertificateMapEntriesPagedCallable = + callableFactory.createPagedCallable( + listCertificateMapEntriesTransportSettings, + settings.listCertificateMapEntriesSettings(), + clientContext); + this.getCertificateMapEntryCallable = + callableFactory.createUnaryCallable( + getCertificateMapEntryTransportSettings, + settings.getCertificateMapEntrySettings(), + clientContext); + this.createCertificateMapEntryCallable = + callableFactory.createUnaryCallable( + createCertificateMapEntryTransportSettings, + settings.createCertificateMapEntrySettings(), + clientContext); + this.createCertificateMapEntryOperationCallable = + callableFactory.createOperationCallable( + createCertificateMapEntryTransportSettings, + settings.createCertificateMapEntryOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.updateCertificateMapEntryCallable = + callableFactory.createUnaryCallable( + updateCertificateMapEntryTransportSettings, + settings.updateCertificateMapEntrySettings(), + clientContext); + this.updateCertificateMapEntryOperationCallable = + callableFactory.createOperationCallable( + updateCertificateMapEntryTransportSettings, + settings.updateCertificateMapEntryOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deleteCertificateMapEntryCallable = + callableFactory.createUnaryCallable( + deleteCertificateMapEntryTransportSettings, + settings.deleteCertificateMapEntrySettings(), + clientContext); + this.deleteCertificateMapEntryOperationCallable = + callableFactory.createOperationCallable( + deleteCertificateMapEntryTransportSettings, + settings.deleteCertificateMapEntryOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.listDnsAuthorizationsCallable = + callableFactory.createUnaryCallable( + listDnsAuthorizationsTransportSettings, + settings.listDnsAuthorizationsSettings(), + clientContext); + this.listDnsAuthorizationsPagedCallable = + callableFactory.createPagedCallable( + listDnsAuthorizationsTransportSettings, + settings.listDnsAuthorizationsSettings(), + clientContext); + this.getDnsAuthorizationCallable = + callableFactory.createUnaryCallable( + getDnsAuthorizationTransportSettings, + settings.getDnsAuthorizationSettings(), + clientContext); + this.createDnsAuthorizationCallable = + callableFactory.createUnaryCallable( + createDnsAuthorizationTransportSettings, + settings.createDnsAuthorizationSettings(), + clientContext); + this.createDnsAuthorizationOperationCallable = + callableFactory.createOperationCallable( + createDnsAuthorizationTransportSettings, + settings.createDnsAuthorizationOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.updateDnsAuthorizationCallable = + callableFactory.createUnaryCallable( + updateDnsAuthorizationTransportSettings, + settings.updateDnsAuthorizationSettings(), + clientContext); + this.updateDnsAuthorizationOperationCallable = + callableFactory.createOperationCallable( + updateDnsAuthorizationTransportSettings, + settings.updateDnsAuthorizationOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deleteDnsAuthorizationCallable = + callableFactory.createUnaryCallable( + deleteDnsAuthorizationTransportSettings, + settings.deleteDnsAuthorizationSettings(), + clientContext); + this.deleteDnsAuthorizationOperationCallable = + callableFactory.createOperationCallable( + deleteDnsAuthorizationTransportSettings, + settings.deleteDnsAuthorizationOperationSettings(), + clientContext, + httpJsonOperationsStub); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(listCertificatesMethodDescriptor); + methodDescriptors.add(getCertificateMethodDescriptor); + methodDescriptors.add(createCertificateMethodDescriptor); + methodDescriptors.add(updateCertificateMethodDescriptor); + methodDescriptors.add(deleteCertificateMethodDescriptor); + methodDescriptors.add(listCertificateMapsMethodDescriptor); + methodDescriptors.add(getCertificateMapMethodDescriptor); + methodDescriptors.add(createCertificateMapMethodDescriptor); + methodDescriptors.add(updateCertificateMapMethodDescriptor); + methodDescriptors.add(deleteCertificateMapMethodDescriptor); + methodDescriptors.add(listCertificateMapEntriesMethodDescriptor); + methodDescriptors.add(getCertificateMapEntryMethodDescriptor); + methodDescriptors.add(createCertificateMapEntryMethodDescriptor); + methodDescriptors.add(updateCertificateMapEntryMethodDescriptor); + methodDescriptors.add(deleteCertificateMapEntryMethodDescriptor); + methodDescriptors.add(listDnsAuthorizationsMethodDescriptor); + methodDescriptors.add(getDnsAuthorizationMethodDescriptor); + methodDescriptors.add(createDnsAuthorizationMethodDescriptor); + methodDescriptors.add(updateDnsAuthorizationMethodDescriptor); + methodDescriptors.add(deleteDnsAuthorizationMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable + listCertificatesCallable() { + return listCertificatesCallable; + } + + @Override + public UnaryCallable + listCertificatesPagedCallable() { + return listCertificatesPagedCallable; + } + + @Override + public UnaryCallable getCertificateCallable() { + return getCertificateCallable; + } + + @Override + public UnaryCallable createCertificateCallable() { + return createCertificateCallable; + } + + @Override + public OperationCallable + createCertificateOperationCallable() { + return createCertificateOperationCallable; + } + + @Override + public UnaryCallable updateCertificateCallable() { + return updateCertificateCallable; + } + + @Override + public OperationCallable + updateCertificateOperationCallable() { + return updateCertificateOperationCallable; + } + + @Override + public UnaryCallable deleteCertificateCallable() { + return deleteCertificateCallable; + } + + @Override + public OperationCallable + deleteCertificateOperationCallable() { + return deleteCertificateOperationCallable; + } + + @Override + public UnaryCallable + listCertificateMapsCallable() { + return listCertificateMapsCallable; + } + + @Override + public UnaryCallable + listCertificateMapsPagedCallable() { + return listCertificateMapsPagedCallable; + } + + @Override + public UnaryCallable getCertificateMapCallable() { + return getCertificateMapCallable; + } + + @Override + public UnaryCallable createCertificateMapCallable() { + return createCertificateMapCallable; + } + + @Override + public OperationCallable + createCertificateMapOperationCallable() { + return createCertificateMapOperationCallable; + } + + @Override + public UnaryCallable updateCertificateMapCallable() { + return updateCertificateMapCallable; + } + + @Override + public OperationCallable + updateCertificateMapOperationCallable() { + return updateCertificateMapOperationCallable; + } + + @Override + public UnaryCallable deleteCertificateMapCallable() { + return deleteCertificateMapCallable; + } + + @Override + public OperationCallable + deleteCertificateMapOperationCallable() { + return deleteCertificateMapOperationCallable; + } + + @Override + public UnaryCallable + listCertificateMapEntriesCallable() { + return listCertificateMapEntriesCallable; + } + + @Override + public UnaryCallable + listCertificateMapEntriesPagedCallable() { + return listCertificateMapEntriesPagedCallable; + } + + @Override + public UnaryCallable + getCertificateMapEntryCallable() { + return getCertificateMapEntryCallable; + } + + @Override + public UnaryCallable + createCertificateMapEntryCallable() { + return createCertificateMapEntryCallable; + } + + @Override + public OperationCallable + createCertificateMapEntryOperationCallable() { + return createCertificateMapEntryOperationCallable; + } + + @Override + public UnaryCallable + updateCertificateMapEntryCallable() { + return updateCertificateMapEntryCallable; + } + + @Override + public OperationCallable + updateCertificateMapEntryOperationCallable() { + return updateCertificateMapEntryOperationCallable; + } + + @Override + public UnaryCallable + deleteCertificateMapEntryCallable() { + return deleteCertificateMapEntryCallable; + } + + @Override + public OperationCallable + deleteCertificateMapEntryOperationCallable() { + return deleteCertificateMapEntryOperationCallable; + } + + @Override + public UnaryCallable + listDnsAuthorizationsCallable() { + return listDnsAuthorizationsCallable; + } + + @Override + public UnaryCallable + listDnsAuthorizationsPagedCallable() { + return listDnsAuthorizationsPagedCallable; + } + + @Override + public UnaryCallable getDnsAuthorizationCallable() { + return getDnsAuthorizationCallable; + } + + @Override + public UnaryCallable createDnsAuthorizationCallable() { + return createDnsAuthorizationCallable; + } + + @Override + public OperationCallable + createDnsAuthorizationOperationCallable() { + return createDnsAuthorizationOperationCallable; + } + + @Override + public UnaryCallable updateDnsAuthorizationCallable() { + return updateDnsAuthorizationCallable; + } + + @Override + public OperationCallable + updateDnsAuthorizationOperationCallable() { + return updateDnsAuthorizationOperationCallable; + } + + @Override + public UnaryCallable deleteDnsAuthorizationCallable() { + return deleteDnsAuthorizationCallable; + } + + @Override + public OperationCallable + deleteDnsAuthorizationOperationCallable() { + return deleteDnsAuthorizationOperationCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-certificate-manager/src/test/java/com/google/cloud/certificatemanager/v1/CertificateManagerClientHttpJsonTest.java b/google-cloud-certificate-manager/src/test/java/com/google/cloud/certificatemanager/v1/CertificateManagerClientHttpJsonTest.java new file mode 100644 index 0000000..349b1e0 --- /dev/null +++ b/google-cloud-certificate-manager/src/test/java/com/google/cloud/certificatemanager/v1/CertificateManagerClientHttpJsonTest.java @@ -0,0 +1,2115 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.certificatemanager.v1; + +import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListCertificateMapEntriesPagedResponse; +import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListCertificateMapsPagedResponse; +import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListCertificatesPagedResponse; +import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListDnsAuthorizationsPagedResponse; + +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.certificatemanager.v1.stub.HttpJsonCertificateManagerStub; +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 CertificateManagerClientHttpJsonTest { + private static MockHttpService mockService; + private static CertificateManagerClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonCertificateManagerStub.getMethodDescriptors(), + CertificateManagerSettings.getDefaultEndpoint()); + CertificateManagerSettings settings = + CertificateManagerSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + CertificateManagerSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = CertificateManagerClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void listCertificatesTest() throws Exception { + Certificate responsesElement = Certificate.newBuilder().build(); + ListCertificatesResponse expectedResponse = + ListCertificatesResponse.newBuilder() + .setNextPageToken("") + .addAllCertificates(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListCertificatesPagedResponse pagedListResponse = client.listCertificates(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCertificatesList().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 listCertificatesExceptionTest() 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.listCertificates(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCertificatesTest2() throws Exception { + Certificate responsesElement = Certificate.newBuilder().build(); + ListCertificatesResponse expectedResponse = + ListCertificatesResponse.newBuilder() + .setNextPageToken("") + .addAllCertificates(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListCertificatesPagedResponse pagedListResponse = client.listCertificates(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCertificatesList().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 listCertificatesExceptionTest2() 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.listCertificates(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCertificateTest() throws Exception { + Certificate expectedResponse = + Certificate.newBuilder() + .setName(CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE]").toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .addAllSanDnsnames(new ArrayList()) + .setPemCertificate("pemCertificate153491807") + .setExpireTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + CertificateName name = CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE]"); + + Certificate actualResponse = client.getCertificate(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 getCertificateExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateName name = CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE]"); + client.getCertificate(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCertificateTest2() throws Exception { + Certificate expectedResponse = + Certificate.newBuilder() + .setName(CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE]").toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .addAllSanDnsnames(new ArrayList()) + .setPemCertificate("pemCertificate153491807") + .setExpireTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-9300/locations/location-9300/certificates/certificate-9300"; + + Certificate actualResponse = client.getCertificate(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 getCertificateExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-9300/locations/location-9300/certificates/certificate-9300"; + client.getCertificate(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createCertificateTest() throws Exception { + Certificate expectedResponse = + Certificate.newBuilder() + .setName(CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE]").toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .addAllSanDnsnames(new ArrayList()) + .setPemCertificate("pemCertificate153491807") + .setExpireTime(Timestamp.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createCertificateTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Certificate certificate = Certificate.newBuilder().build(); + String certificateId = "certificateId-644529902"; + + Certificate actualResponse = + client.createCertificateAsync(parent, certificate, certificateId).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 createCertificateExceptionTest() 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]"); + Certificate certificate = Certificate.newBuilder().build(); + String certificateId = "certificateId-644529902"; + client.createCertificateAsync(parent, certificate, certificateId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createCertificateTest2() throws Exception { + Certificate expectedResponse = + Certificate.newBuilder() + .setName(CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE]").toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .addAllSanDnsnames(new ArrayList()) + .setPemCertificate("pemCertificate153491807") + .setExpireTime(Timestamp.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createCertificateTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + Certificate certificate = Certificate.newBuilder().build(); + String certificateId = "certificateId-644529902"; + + Certificate actualResponse = + client.createCertificateAsync(parent, certificate, certificateId).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 createCertificateExceptionTest2() 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"; + Certificate certificate = Certificate.newBuilder().build(); + String certificateId = "certificateId-644529902"; + client.createCertificateAsync(parent, certificate, certificateId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void updateCertificateTest() throws Exception { + Certificate expectedResponse = + Certificate.newBuilder() + .setName(CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE]").toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .addAllSanDnsnames(new ArrayList()) + .setPemCertificate("pemCertificate153491807") + .setExpireTime(Timestamp.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateCertificateTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + Certificate certificate = + Certificate.newBuilder() + .setName(CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE]").toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .addAllSanDnsnames(new ArrayList()) + .setPemCertificate("pemCertificate153491807") + .setExpireTime(Timestamp.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Certificate actualResponse = client.updateCertificateAsync(certificate, 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 updateCertificateExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Certificate certificate = + Certificate.newBuilder() + .setName(CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE]").toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .addAllSanDnsnames(new ArrayList()) + .setPemCertificate("pemCertificate153491807") + .setExpireTime(Timestamp.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateCertificateAsync(certificate, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteCertificateTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteCertificateTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CertificateName name = CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE]"); + + client.deleteCertificateAsync(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 deleteCertificateExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateName name = CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE]"); + client.deleteCertificateAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteCertificateTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteCertificateTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-9300/locations/location-9300/certificates/certificate-9300"; + + client.deleteCertificateAsync(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 deleteCertificateExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-9300/locations/location-9300/certificates/certificate-9300"; + client.deleteCertificateAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void listCertificateMapsTest() throws Exception { + CertificateMap responsesElement = CertificateMap.newBuilder().build(); + ListCertificateMapsResponse expectedResponse = + ListCertificateMapsResponse.newBuilder() + .setNextPageToken("") + .addAllCertificateMaps(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListCertificateMapsPagedResponse pagedListResponse = client.listCertificateMaps(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCertificateMapsList().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 listCertificateMapsExceptionTest() 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.listCertificateMaps(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCertificateMapsTest2() throws Exception { + CertificateMap responsesElement = CertificateMap.newBuilder().build(); + ListCertificateMapsResponse expectedResponse = + ListCertificateMapsResponse.newBuilder() + .setNextPageToken("") + .addAllCertificateMaps(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListCertificateMapsPagedResponse pagedListResponse = client.listCertificateMaps(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCertificateMapsList().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 listCertificateMapsExceptionTest2() 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.listCertificateMaps(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCertificateMapTest() throws Exception { + CertificateMap expectedResponse = + CertificateMap.newBuilder() + .setName( + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]").toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .addAllGclbTargets(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + CertificateMapName name = CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]"); + + CertificateMap actualResponse = client.getCertificateMap(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 getCertificateMapExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateMapName name = + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]"); + client.getCertificateMap(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCertificateMapTest2() throws Exception { + CertificateMap expectedResponse = + CertificateMap.newBuilder() + .setName( + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]").toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .addAllGclbTargets(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-180/locations/location-180/certificateMaps/certificateMap-180"; + + CertificateMap actualResponse = client.getCertificateMap(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 getCertificateMapExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-180/locations/location-180/certificateMaps/certificateMap-180"; + client.getCertificateMap(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createCertificateMapTest() throws Exception { + CertificateMap expectedResponse = + CertificateMap.newBuilder() + .setName( + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]").toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .addAllGclbTargets(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createCertificateMapTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + CertificateMap certificateMap = CertificateMap.newBuilder().build(); + String certificateMapId = "certificateMapId1612184640"; + + CertificateMap actualResponse = + client.createCertificateMapAsync(parent, certificateMap, certificateMapId).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 createCertificateMapExceptionTest() 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]"); + CertificateMap certificateMap = CertificateMap.newBuilder().build(); + String certificateMapId = "certificateMapId1612184640"; + client.createCertificateMapAsync(parent, certificateMap, certificateMapId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createCertificateMapTest2() throws Exception { + CertificateMap expectedResponse = + CertificateMap.newBuilder() + .setName( + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]").toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .addAllGclbTargets(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createCertificateMapTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + CertificateMap certificateMap = CertificateMap.newBuilder().build(); + String certificateMapId = "certificateMapId1612184640"; + + CertificateMap actualResponse = + client.createCertificateMapAsync(parent, certificateMap, certificateMapId).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 createCertificateMapExceptionTest2() 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"; + CertificateMap certificateMap = CertificateMap.newBuilder().build(); + String certificateMapId = "certificateMapId1612184640"; + client.createCertificateMapAsync(parent, certificateMap, certificateMapId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void updateCertificateMapTest() throws Exception { + CertificateMap expectedResponse = + CertificateMap.newBuilder() + .setName( + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]").toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .addAllGclbTargets(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateCertificateMapTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CertificateMap certificateMap = + CertificateMap.newBuilder() + .setName( + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]").toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .addAllGclbTargets(new ArrayList()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + CertificateMap actualResponse = + client.updateCertificateMapAsync(certificateMap, 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 updateCertificateMapExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateMap certificateMap = + CertificateMap.newBuilder() + .setName( + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]").toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .addAllGclbTargets(new ArrayList()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateCertificateMapAsync(certificateMap, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteCertificateMapTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteCertificateMapTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CertificateMapName name = CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]"); + + client.deleteCertificateMapAsync(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 deleteCertificateMapExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateMapName name = + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]"); + client.deleteCertificateMapAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteCertificateMapTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteCertificateMapTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-180/locations/location-180/certificateMaps/certificateMap-180"; + + client.deleteCertificateMapAsync(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 deleteCertificateMapExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-180/locations/location-180/certificateMaps/certificateMap-180"; + client.deleteCertificateMapAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void listCertificateMapEntriesTest() throws Exception { + CertificateMapEntry responsesElement = CertificateMapEntry.newBuilder().build(); + ListCertificateMapEntriesResponse expectedResponse = + ListCertificateMapEntriesResponse.newBuilder() + .setNextPageToken("") + .addAllCertificateMapEntries(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + CertificateMapName parent = + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]"); + + ListCertificateMapEntriesPagedResponse pagedListResponse = + client.listCertificateMapEntries(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCertificateMapEntriesList().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 listCertificateMapEntriesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateMapName parent = + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]"); + client.listCertificateMapEntries(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCertificateMapEntriesTest2() throws Exception { + CertificateMapEntry responsesElement = CertificateMapEntry.newBuilder().build(); + ListCertificateMapEntriesResponse expectedResponse = + ListCertificateMapEntriesResponse.newBuilder() + .setNextPageToken("") + .addAllCertificateMapEntries(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = + "projects/project-5053/locations/location-5053/certificateMaps/certificateMap-5053"; + + ListCertificateMapEntriesPagedResponse pagedListResponse = + client.listCertificateMapEntries(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCertificateMapEntriesList().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 listCertificateMapEntriesExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = + "projects/project-5053/locations/location-5053/certificateMaps/certificateMap-5053"; + client.listCertificateMapEntries(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCertificateMapEntryTest() throws Exception { + CertificateMapEntry expectedResponse = + CertificateMapEntry.newBuilder() + .setName( + CertificateMapEntryName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]", "[CERTIFICATE_MAP_ENTRY]") + .toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .addAllCertificates(new ArrayList()) + .setState(ServingState.forNumber(0)) + .build(); + mockService.addResponse(expectedResponse); + + CertificateMapEntryName name = + CertificateMapEntryName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]", "[CERTIFICATE_MAP_ENTRY]"); + + CertificateMapEntry actualResponse = client.getCertificateMapEntry(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 getCertificateMapEntryExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateMapEntryName name = + CertificateMapEntryName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]", "[CERTIFICATE_MAP_ENTRY]"); + client.getCertificateMapEntry(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCertificateMapEntryTest2() throws Exception { + CertificateMapEntry expectedResponse = + CertificateMapEntry.newBuilder() + .setName( + CertificateMapEntryName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]", "[CERTIFICATE_MAP_ENTRY]") + .toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .addAllCertificates(new ArrayList()) + .setState(ServingState.forNumber(0)) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-53/locations/location-53/certificateMaps/certificateMap-53/certificateMapEntries/certificateMapEntrie-53"; + + CertificateMapEntry actualResponse = client.getCertificateMapEntry(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 getCertificateMapEntryExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-53/locations/location-53/certificateMaps/certificateMap-53/certificateMapEntries/certificateMapEntrie-53"; + client.getCertificateMapEntry(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createCertificateMapEntryTest() throws Exception { + CertificateMapEntry expectedResponse = + CertificateMapEntry.newBuilder() + .setName( + CertificateMapEntryName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]", "[CERTIFICATE_MAP_ENTRY]") + .toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .addAllCertificates(new ArrayList()) + .setState(ServingState.forNumber(0)) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createCertificateMapEntryTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CertificateMapName parent = + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]"); + CertificateMapEntry certificateMapEntry = CertificateMapEntry.newBuilder().build(); + String certificateMapEntryId = "certificateMapEntryId-859079384"; + + CertificateMapEntry actualResponse = + client + .createCertificateMapEntryAsync(parent, certificateMapEntry, certificateMapEntryId) + .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 createCertificateMapEntryExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateMapName parent = + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]"); + CertificateMapEntry certificateMapEntry = CertificateMapEntry.newBuilder().build(); + String certificateMapEntryId = "certificateMapEntryId-859079384"; + client + .createCertificateMapEntryAsync(parent, certificateMapEntry, certificateMapEntryId) + .get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createCertificateMapEntryTest2() throws Exception { + CertificateMapEntry expectedResponse = + CertificateMapEntry.newBuilder() + .setName( + CertificateMapEntryName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]", "[CERTIFICATE_MAP_ENTRY]") + .toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .addAllCertificates(new ArrayList()) + .setState(ServingState.forNumber(0)) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createCertificateMapEntryTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = + "projects/project-5053/locations/location-5053/certificateMaps/certificateMap-5053"; + CertificateMapEntry certificateMapEntry = CertificateMapEntry.newBuilder().build(); + String certificateMapEntryId = "certificateMapEntryId-859079384"; + + CertificateMapEntry actualResponse = + client + .createCertificateMapEntryAsync(parent, certificateMapEntry, certificateMapEntryId) + .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 createCertificateMapEntryExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = + "projects/project-5053/locations/location-5053/certificateMaps/certificateMap-5053"; + CertificateMapEntry certificateMapEntry = CertificateMapEntry.newBuilder().build(); + String certificateMapEntryId = "certificateMapEntryId-859079384"; + client + .createCertificateMapEntryAsync(parent, certificateMapEntry, certificateMapEntryId) + .get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void updateCertificateMapEntryTest() throws Exception { + CertificateMapEntry expectedResponse = + CertificateMapEntry.newBuilder() + .setName( + CertificateMapEntryName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]", "[CERTIFICATE_MAP_ENTRY]") + .toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .addAllCertificates(new ArrayList()) + .setState(ServingState.forNumber(0)) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateCertificateMapEntryTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CertificateMapEntry certificateMapEntry = + CertificateMapEntry.newBuilder() + .setName( + CertificateMapEntryName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]", "[CERTIFICATE_MAP_ENTRY]") + .toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .addAllCertificates(new ArrayList()) + .setState(ServingState.forNumber(0)) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + CertificateMapEntry actualResponse = + client.updateCertificateMapEntryAsync(certificateMapEntry, 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 updateCertificateMapEntryExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateMapEntry certificateMapEntry = + CertificateMapEntry.newBuilder() + .setName( + CertificateMapEntryName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]", "[CERTIFICATE_MAP_ENTRY]") + .toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .addAllCertificates(new ArrayList()) + .setState(ServingState.forNumber(0)) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateCertificateMapEntryAsync(certificateMapEntry, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteCertificateMapEntryTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteCertificateMapEntryTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CertificateMapEntryName name = + CertificateMapEntryName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]", "[CERTIFICATE_MAP_ENTRY]"); + + client.deleteCertificateMapEntryAsync(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 deleteCertificateMapEntryExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateMapEntryName name = + CertificateMapEntryName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]", "[CERTIFICATE_MAP_ENTRY]"); + client.deleteCertificateMapEntryAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteCertificateMapEntryTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteCertificateMapEntryTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-53/locations/location-53/certificateMaps/certificateMap-53/certificateMapEntries/certificateMapEntrie-53"; + + client.deleteCertificateMapEntryAsync(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 deleteCertificateMapEntryExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-53/locations/location-53/certificateMaps/certificateMap-53/certificateMapEntries/certificateMapEntrie-53"; + client.deleteCertificateMapEntryAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void listDnsAuthorizationsTest() throws Exception { + DnsAuthorization responsesElement = DnsAuthorization.newBuilder().build(); + ListDnsAuthorizationsResponse expectedResponse = + ListDnsAuthorizationsResponse.newBuilder() + .setNextPageToken("") + .addAllDnsAuthorizations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListDnsAuthorizationsPagedResponse pagedListResponse = client.listDnsAuthorizations(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getDnsAuthorizationsList().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 listDnsAuthorizationsExceptionTest() 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.listDnsAuthorizations(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listDnsAuthorizationsTest2() throws Exception { + DnsAuthorization responsesElement = DnsAuthorization.newBuilder().build(); + ListDnsAuthorizationsResponse expectedResponse = + ListDnsAuthorizationsResponse.newBuilder() + .setNextPageToken("") + .addAllDnsAuthorizations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListDnsAuthorizationsPagedResponse pagedListResponse = client.listDnsAuthorizations(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getDnsAuthorizationsList().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 listDnsAuthorizationsExceptionTest2() 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.listDnsAuthorizations(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getDnsAuthorizationTest() throws Exception { + DnsAuthorization expectedResponse = + DnsAuthorization.newBuilder() + .setName( + DnsAuthorizationName.of("[PROJECT]", "[LOCATION]", "[DNS_AUTHORIZATION]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDescription("description-1724546052") + .setDomain("domain-1326197564") + .setDnsResourceRecord(DnsAuthorization.DnsResourceRecord.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + DnsAuthorizationName name = + DnsAuthorizationName.of("[PROJECT]", "[LOCATION]", "[DNS_AUTHORIZATION]"); + + DnsAuthorization actualResponse = client.getDnsAuthorization(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 getDnsAuthorizationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + DnsAuthorizationName name = + DnsAuthorizationName.of("[PROJECT]", "[LOCATION]", "[DNS_AUTHORIZATION]"); + client.getDnsAuthorization(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getDnsAuthorizationTest2() throws Exception { + DnsAuthorization expectedResponse = + DnsAuthorization.newBuilder() + .setName( + DnsAuthorizationName.of("[PROJECT]", "[LOCATION]", "[DNS_AUTHORIZATION]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDescription("description-1724546052") + .setDomain("domain-1326197564") + .setDnsResourceRecord(DnsAuthorization.DnsResourceRecord.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-3639/locations/location-3639/dnsAuthorizations/dnsAuthorization-3639"; + + DnsAuthorization actualResponse = client.getDnsAuthorization(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 getDnsAuthorizationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-3639/locations/location-3639/dnsAuthorizations/dnsAuthorization-3639"; + client.getDnsAuthorization(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createDnsAuthorizationTest() throws Exception { + DnsAuthorization expectedResponse = + DnsAuthorization.newBuilder() + .setName( + DnsAuthorizationName.of("[PROJECT]", "[LOCATION]", "[DNS_AUTHORIZATION]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDescription("description-1724546052") + .setDomain("domain-1326197564") + .setDnsResourceRecord(DnsAuthorization.DnsResourceRecord.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createDnsAuthorizationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + DnsAuthorization dnsAuthorization = DnsAuthorization.newBuilder().build(); + String dnsAuthorizationId = "dnsAuthorizationId-2054763765"; + + DnsAuthorization actualResponse = + client.createDnsAuthorizationAsync(parent, dnsAuthorization, dnsAuthorizationId).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 createDnsAuthorizationExceptionTest() 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]"); + DnsAuthorization dnsAuthorization = DnsAuthorization.newBuilder().build(); + String dnsAuthorizationId = "dnsAuthorizationId-2054763765"; + client.createDnsAuthorizationAsync(parent, dnsAuthorization, dnsAuthorizationId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createDnsAuthorizationTest2() throws Exception { + DnsAuthorization expectedResponse = + DnsAuthorization.newBuilder() + .setName( + DnsAuthorizationName.of("[PROJECT]", "[LOCATION]", "[DNS_AUTHORIZATION]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDescription("description-1724546052") + .setDomain("domain-1326197564") + .setDnsResourceRecord(DnsAuthorization.DnsResourceRecord.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createDnsAuthorizationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + DnsAuthorization dnsAuthorization = DnsAuthorization.newBuilder().build(); + String dnsAuthorizationId = "dnsAuthorizationId-2054763765"; + + DnsAuthorization actualResponse = + client.createDnsAuthorizationAsync(parent, dnsAuthorization, dnsAuthorizationId).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 createDnsAuthorizationExceptionTest2() 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"; + DnsAuthorization dnsAuthorization = DnsAuthorization.newBuilder().build(); + String dnsAuthorizationId = "dnsAuthorizationId-2054763765"; + client.createDnsAuthorizationAsync(parent, dnsAuthorization, dnsAuthorizationId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void updateDnsAuthorizationTest() throws Exception { + DnsAuthorization expectedResponse = + DnsAuthorization.newBuilder() + .setName( + DnsAuthorizationName.of("[PROJECT]", "[LOCATION]", "[DNS_AUTHORIZATION]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDescription("description-1724546052") + .setDomain("domain-1326197564") + .setDnsResourceRecord(DnsAuthorization.DnsResourceRecord.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateDnsAuthorizationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + DnsAuthorization dnsAuthorization = + DnsAuthorization.newBuilder() + .setName( + DnsAuthorizationName.of("[PROJECT]", "[LOCATION]", "[DNS_AUTHORIZATION]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDescription("description-1724546052") + .setDomain("domain-1326197564") + .setDnsResourceRecord(DnsAuthorization.DnsResourceRecord.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + DnsAuthorization actualResponse = + client.updateDnsAuthorizationAsync(dnsAuthorization, 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 updateDnsAuthorizationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + DnsAuthorization dnsAuthorization = + DnsAuthorization.newBuilder() + .setName( + DnsAuthorizationName.of("[PROJECT]", "[LOCATION]", "[DNS_AUTHORIZATION]") + .toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .setDescription("description-1724546052") + .setDomain("domain-1326197564") + .setDnsResourceRecord(DnsAuthorization.DnsResourceRecord.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateDnsAuthorizationAsync(dnsAuthorization, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteDnsAuthorizationTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteDnsAuthorizationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + DnsAuthorizationName name = + DnsAuthorizationName.of("[PROJECT]", "[LOCATION]", "[DNS_AUTHORIZATION]"); + + client.deleteDnsAuthorizationAsync(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 deleteDnsAuthorizationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + DnsAuthorizationName name = + DnsAuthorizationName.of("[PROJECT]", "[LOCATION]", "[DNS_AUTHORIZATION]"); + client.deleteDnsAuthorizationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteDnsAuthorizationTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteDnsAuthorizationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-3639/locations/location-3639/dnsAuthorizations/dnsAuthorization-3639"; + + client.deleteDnsAuthorizationAsync(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 deleteDnsAuthorizationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-3639/locations/location-3639/dnsAuthorizations/dnsAuthorization-3639"; + client.deleteDnsAuthorizationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } +} diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 0000000..558d330 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/create/SyncCreateSetCredentialsProvider.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateManagerSettings; +import com.google.cloud.certificatemanager.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. + CertificateManagerSettings certificateManagerSettings = + CertificateManagerSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + CertificateManagerClient certificateManagerClient = + CertificateManagerClient.create(certificateManagerSettings); + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 0000000..f8e9129 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/create/SyncCreateSetCredentialsProvider1.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_create_setcredentialsprovider1_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateManagerSettings; + +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. + CertificateManagerSettings certificateManagerSettings = + CertificateManagerSettings.newBuilder() + .setTransportChannelProvider( + CertificateManagerSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + CertificateManagerClient certificateManagerClient = + CertificateManagerClient.create(certificateManagerSettings); + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 0000000..97dd40b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/create/SyncCreateSetEndpoint.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_create_setendpoint_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateManagerSettings; +import com.google.cloud.certificatemanager.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. + CertificateManagerSettings certificateManagerSettings = + CertificateManagerSettings.newBuilder().setEndpoint(myEndpoint).build(); + CertificateManagerClient certificateManagerClient = + CertificateManagerClient.create(certificateManagerSettings); + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificate/AsyncCreateCertificate.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificate/AsyncCreateCertificate.java new file mode 100644 index 0000000..fb8b2fe --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificate/AsyncCreateCertificate.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_createcertificate_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.certificatemanager.v1.Certificate; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CreateCertificateRequest; +import com.google.cloud.certificatemanager.v1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateCertificate { + + public static void main(String[] args) throws Exception { + asyncCreateCertificate(); + } + + public static void asyncCreateCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + CreateCertificateRequest request = + CreateCertificateRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setCertificateId("certificateId-644529902") + .setCertificate(Certificate.newBuilder().build()) + .build(); + ApiFuture future = + certificateManagerClient.createCertificateCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_createcertificate_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificate/AsyncCreateCertificateLRO.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificate/AsyncCreateCertificateLRO.java new file mode 100644 index 0000000..3be2be8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificate/AsyncCreateCertificateLRO.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_createcertificate_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.certificatemanager.v1.Certificate; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CreateCertificateRequest; +import com.google.cloud.certificatemanager.v1.LocationName; +import com.google.cloud.certificatemanager.v1.OperationMetadata; + +public class AsyncCreateCertificateLRO { + + public static void main(String[] args) throws Exception { + asyncCreateCertificateLRO(); + } + + public static void asyncCreateCertificateLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + CreateCertificateRequest request = + CreateCertificateRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setCertificateId("certificateId-644529902") + .setCertificate(Certificate.newBuilder().build()) + .build(); + OperationFuture future = + certificateManagerClient.createCertificateOperationCallable().futureCall(request); + // Do something. + Certificate response = future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_createcertificate_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificate/SyncCreateCertificate.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificate/SyncCreateCertificate.java new file mode 100644 index 0000000..4be2920 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificate/SyncCreateCertificate.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_createcertificate_sync] +import com.google.cloud.certificatemanager.v1.Certificate; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CreateCertificateRequest; +import com.google.cloud.certificatemanager.v1.LocationName; + +public class SyncCreateCertificate { + + public static void main(String[] args) throws Exception { + syncCreateCertificate(); + } + + public static void syncCreateCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + CreateCertificateRequest request = + CreateCertificateRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setCertificateId("certificateId-644529902") + .setCertificate(Certificate.newBuilder().build()) + .build(); + Certificate response = certificateManagerClient.createCertificateAsync(request).get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_createcertificate_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificate/SyncCreateCertificateLocationnameCertificateString.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificate/SyncCreateCertificateLocationnameCertificateString.java new file mode 100644 index 0000000..0db8dce --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificate/SyncCreateCertificateLocationnameCertificateString.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_createcertificate_locationnamecertificatestring_sync] +import com.google.cloud.certificatemanager.v1.Certificate; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.LocationName; + +public class SyncCreateCertificateLocationnameCertificateString { + + public static void main(String[] args) throws Exception { + syncCreateCertificateLocationnameCertificateString(); + } + + public static void syncCreateCertificateLocationnameCertificateString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Certificate certificate = Certificate.newBuilder().build(); + String certificateId = "certificateId-644529902"; + Certificate response = + certificateManagerClient.createCertificateAsync(parent, certificate, certificateId).get(); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_createcertificate_locationnamecertificatestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificate/SyncCreateCertificateStringCertificateString.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificate/SyncCreateCertificateStringCertificateString.java new file mode 100644 index 0000000..9f3feb7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificate/SyncCreateCertificateStringCertificateString.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_createcertificate_stringcertificatestring_sync] +import com.google.cloud.certificatemanager.v1.Certificate; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.LocationName; + +public class SyncCreateCertificateStringCertificateString { + + public static void main(String[] args) throws Exception { + syncCreateCertificateStringCertificateString(); + } + + public static void syncCreateCertificateStringCertificateString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Certificate certificate = Certificate.newBuilder().build(); + String certificateId = "certificateId-644529902"; + Certificate response = + certificateManagerClient.createCertificateAsync(parent, certificate, certificateId).get(); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_createcertificate_stringcertificatestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemap/AsyncCreateCertificateMap.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemap/AsyncCreateCertificateMap.java new file mode 100644 index 0000000..6df7d7e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemap/AsyncCreateCertificateMap.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_createcertificatemap_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMap; +import com.google.cloud.certificatemanager.v1.CreateCertificateMapRequest; +import com.google.cloud.certificatemanager.v1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateCertificateMap { + + public static void main(String[] args) throws Exception { + asyncCreateCertificateMap(); + } + + public static void asyncCreateCertificateMap() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + CreateCertificateMapRequest request = + CreateCertificateMapRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setCertificateMapId("certificateMapId1612184640") + .setCertificateMap(CertificateMap.newBuilder().build()) + .build(); + ApiFuture future = + certificateManagerClient.createCertificateMapCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_createcertificatemap_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemap/AsyncCreateCertificateMapLRO.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemap/AsyncCreateCertificateMapLRO.java new file mode 100644 index 0000000..1bb4c3d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemap/AsyncCreateCertificateMapLRO.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_createcertificatemap_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMap; +import com.google.cloud.certificatemanager.v1.CreateCertificateMapRequest; +import com.google.cloud.certificatemanager.v1.LocationName; +import com.google.cloud.certificatemanager.v1.OperationMetadata; + +public class AsyncCreateCertificateMapLRO { + + public static void main(String[] args) throws Exception { + asyncCreateCertificateMapLRO(); + } + + public static void asyncCreateCertificateMapLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + CreateCertificateMapRequest request = + CreateCertificateMapRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setCertificateMapId("certificateMapId1612184640") + .setCertificateMap(CertificateMap.newBuilder().build()) + .build(); + OperationFuture future = + certificateManagerClient.createCertificateMapOperationCallable().futureCall(request); + // Do something. + CertificateMap response = future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_createcertificatemap_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemap/SyncCreateCertificateMap.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemap/SyncCreateCertificateMap.java new file mode 100644 index 0000000..f8f449f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemap/SyncCreateCertificateMap.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_createcertificatemap_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMap; +import com.google.cloud.certificatemanager.v1.CreateCertificateMapRequest; +import com.google.cloud.certificatemanager.v1.LocationName; + +public class SyncCreateCertificateMap { + + public static void main(String[] args) throws Exception { + syncCreateCertificateMap(); + } + + public static void syncCreateCertificateMap() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + CreateCertificateMapRequest request = + CreateCertificateMapRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setCertificateMapId("certificateMapId1612184640") + .setCertificateMap(CertificateMap.newBuilder().build()) + .build(); + CertificateMap response = certificateManagerClient.createCertificateMapAsync(request).get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_createcertificatemap_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemap/SyncCreateCertificateMapLocationnameCertificatemapString.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemap/SyncCreateCertificateMapLocationnameCertificatemapString.java new file mode 100644 index 0000000..bee91e3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemap/SyncCreateCertificateMapLocationnameCertificatemapString.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_createcertificatemap_locationnamecertificatemapstring_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMap; +import com.google.cloud.certificatemanager.v1.LocationName; + +public class SyncCreateCertificateMapLocationnameCertificatemapString { + + public static void main(String[] args) throws Exception { + syncCreateCertificateMapLocationnameCertificatemapString(); + } + + public static void syncCreateCertificateMapLocationnameCertificatemapString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + CertificateMap certificateMap = CertificateMap.newBuilder().build(); + String certificateMapId = "certificateMapId1612184640"; + CertificateMap response = + certificateManagerClient + .createCertificateMapAsync(parent, certificateMap, certificateMapId) + .get(); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_createcertificatemap_locationnamecertificatemapstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemap/SyncCreateCertificateMapStringCertificatemapString.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemap/SyncCreateCertificateMapStringCertificatemapString.java new file mode 100644 index 0000000..2bdd962 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemap/SyncCreateCertificateMapStringCertificatemapString.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_createcertificatemap_stringcertificatemapstring_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMap; +import com.google.cloud.certificatemanager.v1.LocationName; + +public class SyncCreateCertificateMapStringCertificatemapString { + + public static void main(String[] args) throws Exception { + syncCreateCertificateMapStringCertificatemapString(); + } + + public static void syncCreateCertificateMapStringCertificatemapString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + CertificateMap certificateMap = CertificateMap.newBuilder().build(); + String certificateMapId = "certificateMapId1612184640"; + CertificateMap response = + certificateManagerClient + .createCertificateMapAsync(parent, certificateMap, certificateMapId) + .get(); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_createcertificatemap_stringcertificatemapstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemapentry/AsyncCreateCertificateMapEntry.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemapentry/AsyncCreateCertificateMapEntry.java new file mode 100644 index 0000000..e337155 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemapentry/AsyncCreateCertificateMapEntry.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_createcertificatemapentry_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntry; +import com.google.cloud.certificatemanager.v1.CertificateMapName; +import com.google.cloud.certificatemanager.v1.CreateCertificateMapEntryRequest; +import com.google.longrunning.Operation; + +public class AsyncCreateCertificateMapEntry { + + public static void main(String[] args) throws Exception { + asyncCreateCertificateMapEntry(); + } + + public static void asyncCreateCertificateMapEntry() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + CreateCertificateMapEntryRequest request = + CreateCertificateMapEntryRequest.newBuilder() + .setParent( + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]").toString()) + .setCertificateMapEntryId("certificateMapEntryId-859079384") + .setCertificateMapEntry(CertificateMapEntry.newBuilder().build()) + .build(); + ApiFuture future = + certificateManagerClient.createCertificateMapEntryCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_createcertificatemapentry_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemapentry/AsyncCreateCertificateMapEntryLRO.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemapentry/AsyncCreateCertificateMapEntryLRO.java new file mode 100644 index 0000000..7d89969 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemapentry/AsyncCreateCertificateMapEntryLRO.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_createcertificatemapentry_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntry; +import com.google.cloud.certificatemanager.v1.CertificateMapName; +import com.google.cloud.certificatemanager.v1.CreateCertificateMapEntryRequest; +import com.google.cloud.certificatemanager.v1.OperationMetadata; + +public class AsyncCreateCertificateMapEntryLRO { + + public static void main(String[] args) throws Exception { + asyncCreateCertificateMapEntryLRO(); + } + + public static void asyncCreateCertificateMapEntryLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + CreateCertificateMapEntryRequest request = + CreateCertificateMapEntryRequest.newBuilder() + .setParent( + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]").toString()) + .setCertificateMapEntryId("certificateMapEntryId-859079384") + .setCertificateMapEntry(CertificateMapEntry.newBuilder().build()) + .build(); + OperationFuture future = + certificateManagerClient.createCertificateMapEntryOperationCallable().futureCall(request); + // Do something. + CertificateMapEntry response = future.get(); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_createcertificatemapentry_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemapentry/SyncCreateCertificateMapEntry.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemapentry/SyncCreateCertificateMapEntry.java new file mode 100644 index 0000000..f9bb6f8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemapentry/SyncCreateCertificateMapEntry.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_createcertificatemapentry_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntry; +import com.google.cloud.certificatemanager.v1.CertificateMapName; +import com.google.cloud.certificatemanager.v1.CreateCertificateMapEntryRequest; + +public class SyncCreateCertificateMapEntry { + + public static void main(String[] args) throws Exception { + syncCreateCertificateMapEntry(); + } + + public static void syncCreateCertificateMapEntry() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + CreateCertificateMapEntryRequest request = + CreateCertificateMapEntryRequest.newBuilder() + .setParent( + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]").toString()) + .setCertificateMapEntryId("certificateMapEntryId-859079384") + .setCertificateMapEntry(CertificateMapEntry.newBuilder().build()) + .build(); + CertificateMapEntry response = + certificateManagerClient.createCertificateMapEntryAsync(request).get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_createcertificatemapentry_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemapentry/SyncCreateCertificateMapEntryCertificatemapnameCertificatemapentryString.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemapentry/SyncCreateCertificateMapEntryCertificatemapnameCertificatemapentryString.java new file mode 100644 index 0000000..549930b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemapentry/SyncCreateCertificateMapEntryCertificatemapnameCertificatemapentryString.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_createcertificatemapentry_certificatemapnamecertificatemapentrystring_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntry; +import com.google.cloud.certificatemanager.v1.CertificateMapName; + +public class SyncCreateCertificateMapEntryCertificatemapnameCertificatemapentryString { + + public static void main(String[] args) throws Exception { + syncCreateCertificateMapEntryCertificatemapnameCertificatemapentryString(); + } + + public static void syncCreateCertificateMapEntryCertificatemapnameCertificatemapentryString() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + CertificateMapName parent = + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]"); + CertificateMapEntry certificateMapEntry = CertificateMapEntry.newBuilder().build(); + String certificateMapEntryId = "certificateMapEntryId-859079384"; + CertificateMapEntry response = + certificateManagerClient + .createCertificateMapEntryAsync(parent, certificateMapEntry, certificateMapEntryId) + .get(); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_createcertificatemapentry_certificatemapnamecertificatemapentrystring_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemapentry/SyncCreateCertificateMapEntryStringCertificatemapentryString.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemapentry/SyncCreateCertificateMapEntryStringCertificatemapentryString.java new file mode 100644 index 0000000..61c82f8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/createcertificatemapentry/SyncCreateCertificateMapEntryStringCertificatemapentryString.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_createcertificatemapentry_stringcertificatemapentrystring_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntry; +import com.google.cloud.certificatemanager.v1.CertificateMapName; + +public class SyncCreateCertificateMapEntryStringCertificatemapentryString { + + public static void main(String[] args) throws Exception { + syncCreateCertificateMapEntryStringCertificatemapentryString(); + } + + public static void syncCreateCertificateMapEntryStringCertificatemapentryString() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + String parent = + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]").toString(); + CertificateMapEntry certificateMapEntry = CertificateMapEntry.newBuilder().build(); + String certificateMapEntryId = "certificateMapEntryId-859079384"; + CertificateMapEntry response = + certificateManagerClient + .createCertificateMapEntryAsync(parent, certificateMapEntry, certificateMapEntryId) + .get(); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_createcertificatemapentry_stringcertificatemapentrystring_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/creatednsauthorization/AsyncCreateDnsAuthorization.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/creatednsauthorization/AsyncCreateDnsAuthorization.java new file mode 100644 index 0000000..cf81de2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/creatednsauthorization/AsyncCreateDnsAuthorization.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_creatednsauthorization_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CreateDnsAuthorizationRequest; +import com.google.cloud.certificatemanager.v1.DnsAuthorization; +import com.google.cloud.certificatemanager.v1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateDnsAuthorization { + + public static void main(String[] args) throws Exception { + asyncCreateDnsAuthorization(); + } + + public static void asyncCreateDnsAuthorization() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + CreateDnsAuthorizationRequest request = + CreateDnsAuthorizationRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setDnsAuthorizationId("dnsAuthorizationId-2054763765") + .setDnsAuthorization(DnsAuthorization.newBuilder().build()) + .build(); + ApiFuture future = + certificateManagerClient.createDnsAuthorizationCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_creatednsauthorization_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/creatednsauthorization/AsyncCreateDnsAuthorizationLRO.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/creatednsauthorization/AsyncCreateDnsAuthorizationLRO.java new file mode 100644 index 0000000..ed48833 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/creatednsauthorization/AsyncCreateDnsAuthorizationLRO.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_creatednsauthorization_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CreateDnsAuthorizationRequest; +import com.google.cloud.certificatemanager.v1.DnsAuthorization; +import com.google.cloud.certificatemanager.v1.LocationName; +import com.google.cloud.certificatemanager.v1.OperationMetadata; + +public class AsyncCreateDnsAuthorizationLRO { + + public static void main(String[] args) throws Exception { + asyncCreateDnsAuthorizationLRO(); + } + + public static void asyncCreateDnsAuthorizationLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + CreateDnsAuthorizationRequest request = + CreateDnsAuthorizationRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setDnsAuthorizationId("dnsAuthorizationId-2054763765") + .setDnsAuthorization(DnsAuthorization.newBuilder().build()) + .build(); + OperationFuture future = + certificateManagerClient.createDnsAuthorizationOperationCallable().futureCall(request); + // Do something. + DnsAuthorization response = future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_creatednsauthorization_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/creatednsauthorization/SyncCreateDnsAuthorization.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/creatednsauthorization/SyncCreateDnsAuthorization.java new file mode 100644 index 0000000..c72463a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/creatednsauthorization/SyncCreateDnsAuthorization.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_creatednsauthorization_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CreateDnsAuthorizationRequest; +import com.google.cloud.certificatemanager.v1.DnsAuthorization; +import com.google.cloud.certificatemanager.v1.LocationName; + +public class SyncCreateDnsAuthorization { + + public static void main(String[] args) throws Exception { + syncCreateDnsAuthorization(); + } + + public static void syncCreateDnsAuthorization() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + CreateDnsAuthorizationRequest request = + CreateDnsAuthorizationRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setDnsAuthorizationId("dnsAuthorizationId-2054763765") + .setDnsAuthorization(DnsAuthorization.newBuilder().build()) + .build(); + DnsAuthorization response = + certificateManagerClient.createDnsAuthorizationAsync(request).get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_creatednsauthorization_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/creatednsauthorization/SyncCreateDnsAuthorizationLocationnameDnsauthorizationString.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/creatednsauthorization/SyncCreateDnsAuthorizationLocationnameDnsauthorizationString.java new file mode 100644 index 0000000..47ba7f0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/creatednsauthorization/SyncCreateDnsAuthorizationLocationnameDnsauthorizationString.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_creatednsauthorization_locationnamednsauthorizationstring_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.DnsAuthorization; +import com.google.cloud.certificatemanager.v1.LocationName; + +public class SyncCreateDnsAuthorizationLocationnameDnsauthorizationString { + + public static void main(String[] args) throws Exception { + syncCreateDnsAuthorizationLocationnameDnsauthorizationString(); + } + + public static void syncCreateDnsAuthorizationLocationnameDnsauthorizationString() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + DnsAuthorization dnsAuthorization = DnsAuthorization.newBuilder().build(); + String dnsAuthorizationId = "dnsAuthorizationId-2054763765"; + DnsAuthorization response = + certificateManagerClient + .createDnsAuthorizationAsync(parent, dnsAuthorization, dnsAuthorizationId) + .get(); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_creatednsauthorization_locationnamednsauthorizationstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/creatednsauthorization/SyncCreateDnsAuthorizationStringDnsauthorizationString.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/creatednsauthorization/SyncCreateDnsAuthorizationStringDnsauthorizationString.java new file mode 100644 index 0000000..954069d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/creatednsauthorization/SyncCreateDnsAuthorizationStringDnsauthorizationString.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_creatednsauthorization_stringdnsauthorizationstring_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.DnsAuthorization; +import com.google.cloud.certificatemanager.v1.LocationName; + +public class SyncCreateDnsAuthorizationStringDnsauthorizationString { + + public static void main(String[] args) throws Exception { + syncCreateDnsAuthorizationStringDnsauthorizationString(); + } + + public static void syncCreateDnsAuthorizationStringDnsauthorizationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + DnsAuthorization dnsAuthorization = DnsAuthorization.newBuilder().build(); + String dnsAuthorizationId = "dnsAuthorizationId-2054763765"; + DnsAuthorization response = + certificateManagerClient + .createDnsAuthorizationAsync(parent, dnsAuthorization, dnsAuthorizationId) + .get(); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_creatednsauthorization_stringdnsauthorizationstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificate/AsyncDeleteCertificate.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificate/AsyncDeleteCertificate.java new file mode 100644 index 0000000..c0d83ab --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificate/AsyncDeleteCertificate.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_deletecertificate_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateName; +import com.google.cloud.certificatemanager.v1.DeleteCertificateRequest; +import com.google.longrunning.Operation; + +public class AsyncDeleteCertificate { + + public static void main(String[] args) throws Exception { + asyncDeleteCertificate(); + } + + public static void asyncDeleteCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + DeleteCertificateRequest request = + DeleteCertificateRequest.newBuilder() + .setName(CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE]").toString()) + .build(); + ApiFuture future = + certificateManagerClient.deleteCertificateCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_deletecertificate_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificate/AsyncDeleteCertificateLRO.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificate/AsyncDeleteCertificateLRO.java new file mode 100644 index 0000000..55504a8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificate/AsyncDeleteCertificateLRO.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_deletecertificate_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateName; +import com.google.cloud.certificatemanager.v1.DeleteCertificateRequest; +import com.google.cloud.certificatemanager.v1.OperationMetadata; +import com.google.protobuf.Empty; + +public class AsyncDeleteCertificateLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteCertificateLRO(); + } + + public static void asyncDeleteCertificateLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + DeleteCertificateRequest request = + DeleteCertificateRequest.newBuilder() + .setName(CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE]").toString()) + .build(); + OperationFuture future = + certificateManagerClient.deleteCertificateOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_deletecertificate_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificate/SyncDeleteCertificate.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificate/SyncDeleteCertificate.java new file mode 100644 index 0000000..778be33 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificate/SyncDeleteCertificate.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_deletecertificate_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateName; +import com.google.cloud.certificatemanager.v1.DeleteCertificateRequest; + +public class SyncDeleteCertificate { + + public static void main(String[] args) throws Exception { + syncDeleteCertificate(); + } + + public static void syncDeleteCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + DeleteCertificateRequest request = + DeleteCertificateRequest.newBuilder() + .setName(CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE]").toString()) + .build(); + certificateManagerClient.deleteCertificateAsync(request).get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_deletecertificate_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificate/SyncDeleteCertificateCertificatename.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificate/SyncDeleteCertificateCertificatename.java new file mode 100644 index 0000000..251f49f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificate/SyncDeleteCertificateCertificatename.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_deletecertificate_certificatename_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateName; + +public class SyncDeleteCertificateCertificatename { + + public static void main(String[] args) throws Exception { + syncDeleteCertificateCertificatename(); + } + + public static void syncDeleteCertificateCertificatename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + CertificateName name = CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE]"); + certificateManagerClient.deleteCertificateAsync(name).get(); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_deletecertificate_certificatename_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificate/SyncDeleteCertificateString.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificate/SyncDeleteCertificateString.java new file mode 100644 index 0000000..53e57b4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificate/SyncDeleteCertificateString.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_deletecertificate_string_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateName; + +public class SyncDeleteCertificateString { + + public static void main(String[] args) throws Exception { + syncDeleteCertificateString(); + } + + public static void syncDeleteCertificateString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + String name = CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE]").toString(); + certificateManagerClient.deleteCertificateAsync(name).get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_deletecertificate_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemap/AsyncDeleteCertificateMap.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemap/AsyncDeleteCertificateMap.java new file mode 100644 index 0000000..3dc5dab --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemap/AsyncDeleteCertificateMap.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_deletecertificatemap_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapName; +import com.google.cloud.certificatemanager.v1.DeleteCertificateMapRequest; +import com.google.longrunning.Operation; + +public class AsyncDeleteCertificateMap { + + public static void main(String[] args) throws Exception { + asyncDeleteCertificateMap(); + } + + public static void asyncDeleteCertificateMap() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + DeleteCertificateMapRequest request = + DeleteCertificateMapRequest.newBuilder() + .setName( + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]").toString()) + .build(); + ApiFuture future = + certificateManagerClient.deleteCertificateMapCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_deletecertificatemap_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemap/AsyncDeleteCertificateMapLRO.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemap/AsyncDeleteCertificateMapLRO.java new file mode 100644 index 0000000..e5974df --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemap/AsyncDeleteCertificateMapLRO.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_deletecertificatemap_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapName; +import com.google.cloud.certificatemanager.v1.DeleteCertificateMapRequest; +import com.google.cloud.certificatemanager.v1.OperationMetadata; +import com.google.protobuf.Empty; + +public class AsyncDeleteCertificateMapLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteCertificateMapLRO(); + } + + public static void asyncDeleteCertificateMapLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + DeleteCertificateMapRequest request = + DeleteCertificateMapRequest.newBuilder() + .setName( + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]").toString()) + .build(); + OperationFuture future = + certificateManagerClient.deleteCertificateMapOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_deletecertificatemap_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemap/SyncDeleteCertificateMap.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemap/SyncDeleteCertificateMap.java new file mode 100644 index 0000000..c30d206 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemap/SyncDeleteCertificateMap.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_deletecertificatemap_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapName; +import com.google.cloud.certificatemanager.v1.DeleteCertificateMapRequest; + +public class SyncDeleteCertificateMap { + + public static void main(String[] args) throws Exception { + syncDeleteCertificateMap(); + } + + public static void syncDeleteCertificateMap() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + DeleteCertificateMapRequest request = + DeleteCertificateMapRequest.newBuilder() + .setName( + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]").toString()) + .build(); + certificateManagerClient.deleteCertificateMapAsync(request).get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_deletecertificatemap_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemap/SyncDeleteCertificateMapCertificatemapname.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemap/SyncDeleteCertificateMapCertificatemapname.java new file mode 100644 index 0000000..78faeeb --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemap/SyncDeleteCertificateMapCertificatemapname.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_deletecertificatemap_certificatemapname_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapName; + +public class SyncDeleteCertificateMapCertificatemapname { + + public static void main(String[] args) throws Exception { + syncDeleteCertificateMapCertificatemapname(); + } + + public static void syncDeleteCertificateMapCertificatemapname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + CertificateMapName name = + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]"); + certificateManagerClient.deleteCertificateMapAsync(name).get(); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_deletecertificatemap_certificatemapname_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemap/SyncDeleteCertificateMapString.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemap/SyncDeleteCertificateMapString.java new file mode 100644 index 0000000..61ef763 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemap/SyncDeleteCertificateMapString.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_deletecertificatemap_string_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapName; + +public class SyncDeleteCertificateMapString { + + public static void main(String[] args) throws Exception { + syncDeleteCertificateMapString(); + } + + public static void syncDeleteCertificateMapString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + String name = + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]").toString(); + certificateManagerClient.deleteCertificateMapAsync(name).get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_deletecertificatemap_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemapentry/AsyncDeleteCertificateMapEntry.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemapentry/AsyncDeleteCertificateMapEntry.java new file mode 100644 index 0000000..37d7557 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemapentry/AsyncDeleteCertificateMapEntry.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_deletecertificatemapentry_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntryName; +import com.google.cloud.certificatemanager.v1.DeleteCertificateMapEntryRequest; +import com.google.longrunning.Operation; + +public class AsyncDeleteCertificateMapEntry { + + public static void main(String[] args) throws Exception { + asyncDeleteCertificateMapEntry(); + } + + public static void asyncDeleteCertificateMapEntry() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + DeleteCertificateMapEntryRequest request = + DeleteCertificateMapEntryRequest.newBuilder() + .setName( + CertificateMapEntryName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]", "[CERTIFICATE_MAP_ENTRY]") + .toString()) + .build(); + ApiFuture future = + certificateManagerClient.deleteCertificateMapEntryCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_deletecertificatemapentry_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemapentry/AsyncDeleteCertificateMapEntryLRO.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemapentry/AsyncDeleteCertificateMapEntryLRO.java new file mode 100644 index 0000000..559f489 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemapentry/AsyncDeleteCertificateMapEntryLRO.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_deletecertificatemapentry_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntryName; +import com.google.cloud.certificatemanager.v1.DeleteCertificateMapEntryRequest; +import com.google.cloud.certificatemanager.v1.OperationMetadata; +import com.google.protobuf.Empty; + +public class AsyncDeleteCertificateMapEntryLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteCertificateMapEntryLRO(); + } + + public static void asyncDeleteCertificateMapEntryLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + DeleteCertificateMapEntryRequest request = + DeleteCertificateMapEntryRequest.newBuilder() + .setName( + CertificateMapEntryName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]", "[CERTIFICATE_MAP_ENTRY]") + .toString()) + .build(); + OperationFuture future = + certificateManagerClient.deleteCertificateMapEntryOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_deletecertificatemapentry_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemapentry/SyncDeleteCertificateMapEntry.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemapentry/SyncDeleteCertificateMapEntry.java new file mode 100644 index 0000000..5f288ed --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemapentry/SyncDeleteCertificateMapEntry.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_deletecertificatemapentry_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntryName; +import com.google.cloud.certificatemanager.v1.DeleteCertificateMapEntryRequest; + +public class SyncDeleteCertificateMapEntry { + + public static void main(String[] args) throws Exception { + syncDeleteCertificateMapEntry(); + } + + public static void syncDeleteCertificateMapEntry() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + DeleteCertificateMapEntryRequest request = + DeleteCertificateMapEntryRequest.newBuilder() + .setName( + CertificateMapEntryName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]", "[CERTIFICATE_MAP_ENTRY]") + .toString()) + .build(); + certificateManagerClient.deleteCertificateMapEntryAsync(request).get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_deletecertificatemapentry_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemapentry/SyncDeleteCertificateMapEntryCertificatemapentryname.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemapentry/SyncDeleteCertificateMapEntryCertificatemapentryname.java new file mode 100644 index 0000000..b91e9f2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemapentry/SyncDeleteCertificateMapEntryCertificatemapentryname.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_deletecertificatemapentry_certificatemapentryname_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntryName; + +public class SyncDeleteCertificateMapEntryCertificatemapentryname { + + public static void main(String[] args) throws Exception { + syncDeleteCertificateMapEntryCertificatemapentryname(); + } + + public static void syncDeleteCertificateMapEntryCertificatemapentryname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + CertificateMapEntryName name = + CertificateMapEntryName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]", "[CERTIFICATE_MAP_ENTRY]"); + certificateManagerClient.deleteCertificateMapEntryAsync(name).get(); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_deletecertificatemapentry_certificatemapentryname_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemapentry/SyncDeleteCertificateMapEntryString.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemapentry/SyncDeleteCertificateMapEntryString.java new file mode 100644 index 0000000..494048f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletecertificatemapentry/SyncDeleteCertificateMapEntryString.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_deletecertificatemapentry_string_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntryName; + +public class SyncDeleteCertificateMapEntryString { + + public static void main(String[] args) throws Exception { + syncDeleteCertificateMapEntryString(); + } + + public static void syncDeleteCertificateMapEntryString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + String name = + CertificateMapEntryName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]", "[CERTIFICATE_MAP_ENTRY]") + .toString(); + certificateManagerClient.deleteCertificateMapEntryAsync(name).get(); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_deletecertificatemapentry_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletednsauthorization/AsyncDeleteDnsAuthorization.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletednsauthorization/AsyncDeleteDnsAuthorization.java new file mode 100644 index 0000000..c3d6db4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletednsauthorization/AsyncDeleteDnsAuthorization.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_deletednsauthorization_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.DeleteDnsAuthorizationRequest; +import com.google.cloud.certificatemanager.v1.DnsAuthorizationName; +import com.google.longrunning.Operation; + +public class AsyncDeleteDnsAuthorization { + + public static void main(String[] args) throws Exception { + asyncDeleteDnsAuthorization(); + } + + public static void asyncDeleteDnsAuthorization() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + DeleteDnsAuthorizationRequest request = + DeleteDnsAuthorizationRequest.newBuilder() + .setName( + DnsAuthorizationName.of("[PROJECT]", "[LOCATION]", "[DNS_AUTHORIZATION]") + .toString()) + .build(); + ApiFuture future = + certificateManagerClient.deleteDnsAuthorizationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_deletednsauthorization_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletednsauthorization/AsyncDeleteDnsAuthorizationLRO.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletednsauthorization/AsyncDeleteDnsAuthorizationLRO.java new file mode 100644 index 0000000..e7f1e8e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletednsauthorization/AsyncDeleteDnsAuthorizationLRO.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_deletednsauthorization_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.DeleteDnsAuthorizationRequest; +import com.google.cloud.certificatemanager.v1.DnsAuthorizationName; +import com.google.cloud.certificatemanager.v1.OperationMetadata; +import com.google.protobuf.Empty; + +public class AsyncDeleteDnsAuthorizationLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteDnsAuthorizationLRO(); + } + + public static void asyncDeleteDnsAuthorizationLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + DeleteDnsAuthorizationRequest request = + DeleteDnsAuthorizationRequest.newBuilder() + .setName( + DnsAuthorizationName.of("[PROJECT]", "[LOCATION]", "[DNS_AUTHORIZATION]") + .toString()) + .build(); + OperationFuture future = + certificateManagerClient.deleteDnsAuthorizationOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_deletednsauthorization_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletednsauthorization/SyncDeleteDnsAuthorization.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletednsauthorization/SyncDeleteDnsAuthorization.java new file mode 100644 index 0000000..6732f72 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletednsauthorization/SyncDeleteDnsAuthorization.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_deletednsauthorization_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.DeleteDnsAuthorizationRequest; +import com.google.cloud.certificatemanager.v1.DnsAuthorizationName; + +public class SyncDeleteDnsAuthorization { + + public static void main(String[] args) throws Exception { + syncDeleteDnsAuthorization(); + } + + public static void syncDeleteDnsAuthorization() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + DeleteDnsAuthorizationRequest request = + DeleteDnsAuthorizationRequest.newBuilder() + .setName( + DnsAuthorizationName.of("[PROJECT]", "[LOCATION]", "[DNS_AUTHORIZATION]") + .toString()) + .build(); + certificateManagerClient.deleteDnsAuthorizationAsync(request).get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_deletednsauthorization_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletednsauthorization/SyncDeleteDnsAuthorizationDnsauthorizationname.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletednsauthorization/SyncDeleteDnsAuthorizationDnsauthorizationname.java new file mode 100644 index 0000000..2980333 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletednsauthorization/SyncDeleteDnsAuthorizationDnsauthorizationname.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_deletednsauthorization_dnsauthorizationname_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.DnsAuthorizationName; + +public class SyncDeleteDnsAuthorizationDnsauthorizationname { + + public static void main(String[] args) throws Exception { + syncDeleteDnsAuthorizationDnsauthorizationname(); + } + + public static void syncDeleteDnsAuthorizationDnsauthorizationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + DnsAuthorizationName name = + DnsAuthorizationName.of("[PROJECT]", "[LOCATION]", "[DNS_AUTHORIZATION]"); + certificateManagerClient.deleteDnsAuthorizationAsync(name).get(); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_deletednsauthorization_dnsauthorizationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletednsauthorization/SyncDeleteDnsAuthorizationString.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletednsauthorization/SyncDeleteDnsAuthorizationString.java new file mode 100644 index 0000000..7eed663 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/deletednsauthorization/SyncDeleteDnsAuthorizationString.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_deletednsauthorization_string_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.DnsAuthorizationName; + +public class SyncDeleteDnsAuthorizationString { + + public static void main(String[] args) throws Exception { + syncDeleteDnsAuthorizationString(); + } + + public static void syncDeleteDnsAuthorizationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + String name = + DnsAuthorizationName.of("[PROJECT]", "[LOCATION]", "[DNS_AUTHORIZATION]").toString(); + certificateManagerClient.deleteDnsAuthorizationAsync(name).get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_deletednsauthorization_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificate/AsyncGetCertificate.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificate/AsyncGetCertificate.java new file mode 100644 index 0000000..c2de952 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificate/AsyncGetCertificate.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_getcertificate_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.certificatemanager.v1.Certificate; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateName; +import com.google.cloud.certificatemanager.v1.GetCertificateRequest; + +public class AsyncGetCertificate { + + public static void main(String[] args) throws Exception { + asyncGetCertificate(); + } + + public static void asyncGetCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + GetCertificateRequest request = + GetCertificateRequest.newBuilder() + .setName(CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE]").toString()) + .build(); + ApiFuture future = + certificateManagerClient.getCertificateCallable().futureCall(request); + // Do something. + Certificate response = future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_getcertificate_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificate/SyncGetCertificate.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificate/SyncGetCertificate.java new file mode 100644 index 0000000..c5f9e22 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificate/SyncGetCertificate.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_getcertificate_sync] +import com.google.cloud.certificatemanager.v1.Certificate; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateName; +import com.google.cloud.certificatemanager.v1.GetCertificateRequest; + +public class SyncGetCertificate { + + public static void main(String[] args) throws Exception { + syncGetCertificate(); + } + + public static void syncGetCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + GetCertificateRequest request = + GetCertificateRequest.newBuilder() + .setName(CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE]").toString()) + .build(); + Certificate response = certificateManagerClient.getCertificate(request); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_getcertificate_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificate/SyncGetCertificateCertificatename.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificate/SyncGetCertificateCertificatename.java new file mode 100644 index 0000000..b9a8670 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificate/SyncGetCertificateCertificatename.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_getcertificate_certificatename_sync] +import com.google.cloud.certificatemanager.v1.Certificate; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateName; + +public class SyncGetCertificateCertificatename { + + public static void main(String[] args) throws Exception { + syncGetCertificateCertificatename(); + } + + public static void syncGetCertificateCertificatename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + CertificateName name = CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE]"); + Certificate response = certificateManagerClient.getCertificate(name); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_getcertificate_certificatename_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificate/SyncGetCertificateString.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificate/SyncGetCertificateString.java new file mode 100644 index 0000000..0aefd2a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificate/SyncGetCertificateString.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_getcertificate_string_sync] +import com.google.cloud.certificatemanager.v1.Certificate; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateName; + +public class SyncGetCertificateString { + + public static void main(String[] args) throws Exception { + syncGetCertificateString(); + } + + public static void syncGetCertificateString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + String name = CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE]").toString(); + Certificate response = certificateManagerClient.getCertificate(name); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_getcertificate_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemap/AsyncGetCertificateMap.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemap/AsyncGetCertificateMap.java new file mode 100644 index 0000000..eb9daa3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemap/AsyncGetCertificateMap.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_getcertificatemap_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMap; +import com.google.cloud.certificatemanager.v1.CertificateMapName; +import com.google.cloud.certificatemanager.v1.GetCertificateMapRequest; + +public class AsyncGetCertificateMap { + + public static void main(String[] args) throws Exception { + asyncGetCertificateMap(); + } + + public static void asyncGetCertificateMap() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + GetCertificateMapRequest request = + GetCertificateMapRequest.newBuilder() + .setName( + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]").toString()) + .build(); + ApiFuture future = + certificateManagerClient.getCertificateMapCallable().futureCall(request); + // Do something. + CertificateMap response = future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_getcertificatemap_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemap/SyncGetCertificateMap.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemap/SyncGetCertificateMap.java new file mode 100644 index 0000000..14f9359 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemap/SyncGetCertificateMap.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_getcertificatemap_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMap; +import com.google.cloud.certificatemanager.v1.CertificateMapName; +import com.google.cloud.certificatemanager.v1.GetCertificateMapRequest; + +public class SyncGetCertificateMap { + + public static void main(String[] args) throws Exception { + syncGetCertificateMap(); + } + + public static void syncGetCertificateMap() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + GetCertificateMapRequest request = + GetCertificateMapRequest.newBuilder() + .setName( + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]").toString()) + .build(); + CertificateMap response = certificateManagerClient.getCertificateMap(request); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_getcertificatemap_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemap/SyncGetCertificateMapCertificatemapname.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemap/SyncGetCertificateMapCertificatemapname.java new file mode 100644 index 0000000..5e832e4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemap/SyncGetCertificateMapCertificatemapname.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_getcertificatemap_certificatemapname_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMap; +import com.google.cloud.certificatemanager.v1.CertificateMapName; + +public class SyncGetCertificateMapCertificatemapname { + + public static void main(String[] args) throws Exception { + syncGetCertificateMapCertificatemapname(); + } + + public static void syncGetCertificateMapCertificatemapname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + CertificateMapName name = + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]"); + CertificateMap response = certificateManagerClient.getCertificateMap(name); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_getcertificatemap_certificatemapname_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemap/SyncGetCertificateMapString.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemap/SyncGetCertificateMapString.java new file mode 100644 index 0000000..ef6a349 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemap/SyncGetCertificateMapString.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_getcertificatemap_string_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMap; +import com.google.cloud.certificatemanager.v1.CertificateMapName; + +public class SyncGetCertificateMapString { + + public static void main(String[] args) throws Exception { + syncGetCertificateMapString(); + } + + public static void syncGetCertificateMapString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + String name = + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]").toString(); + CertificateMap response = certificateManagerClient.getCertificateMap(name); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_getcertificatemap_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemapentry/AsyncGetCertificateMapEntry.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemapentry/AsyncGetCertificateMapEntry.java new file mode 100644 index 0000000..fda882e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemapentry/AsyncGetCertificateMapEntry.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_getcertificatemapentry_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntry; +import com.google.cloud.certificatemanager.v1.CertificateMapEntryName; +import com.google.cloud.certificatemanager.v1.GetCertificateMapEntryRequest; + +public class AsyncGetCertificateMapEntry { + + public static void main(String[] args) throws Exception { + asyncGetCertificateMapEntry(); + } + + public static void asyncGetCertificateMapEntry() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + GetCertificateMapEntryRequest request = + GetCertificateMapEntryRequest.newBuilder() + .setName( + CertificateMapEntryName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]", "[CERTIFICATE_MAP_ENTRY]") + .toString()) + .build(); + ApiFuture future = + certificateManagerClient.getCertificateMapEntryCallable().futureCall(request); + // Do something. + CertificateMapEntry response = future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_getcertificatemapentry_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemapentry/SyncGetCertificateMapEntry.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemapentry/SyncGetCertificateMapEntry.java new file mode 100644 index 0000000..99ea68f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemapentry/SyncGetCertificateMapEntry.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_getcertificatemapentry_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntry; +import com.google.cloud.certificatemanager.v1.CertificateMapEntryName; +import com.google.cloud.certificatemanager.v1.GetCertificateMapEntryRequest; + +public class SyncGetCertificateMapEntry { + + public static void main(String[] args) throws Exception { + syncGetCertificateMapEntry(); + } + + public static void syncGetCertificateMapEntry() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + GetCertificateMapEntryRequest request = + GetCertificateMapEntryRequest.newBuilder() + .setName( + CertificateMapEntryName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]", "[CERTIFICATE_MAP_ENTRY]") + .toString()) + .build(); + CertificateMapEntry response = certificateManagerClient.getCertificateMapEntry(request); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_getcertificatemapentry_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemapentry/SyncGetCertificateMapEntryCertificatemapentryname.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemapentry/SyncGetCertificateMapEntryCertificatemapentryname.java new file mode 100644 index 0000000..634cc7c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemapentry/SyncGetCertificateMapEntryCertificatemapentryname.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_getcertificatemapentry_certificatemapentryname_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntry; +import com.google.cloud.certificatemanager.v1.CertificateMapEntryName; + +public class SyncGetCertificateMapEntryCertificatemapentryname { + + public static void main(String[] args) throws Exception { + syncGetCertificateMapEntryCertificatemapentryname(); + } + + public static void syncGetCertificateMapEntryCertificatemapentryname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + CertificateMapEntryName name = + CertificateMapEntryName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]", "[CERTIFICATE_MAP_ENTRY]"); + CertificateMapEntry response = certificateManagerClient.getCertificateMapEntry(name); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_getcertificatemapentry_certificatemapentryname_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemapentry/SyncGetCertificateMapEntryString.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemapentry/SyncGetCertificateMapEntryString.java new file mode 100644 index 0000000..c926ee7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getcertificatemapentry/SyncGetCertificateMapEntryString.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_getcertificatemapentry_string_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntry; +import com.google.cloud.certificatemanager.v1.CertificateMapEntryName; + +public class SyncGetCertificateMapEntryString { + + public static void main(String[] args) throws Exception { + syncGetCertificateMapEntryString(); + } + + public static void syncGetCertificateMapEntryString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + String name = + CertificateMapEntryName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]", "[CERTIFICATE_MAP_ENTRY]") + .toString(); + CertificateMapEntry response = certificateManagerClient.getCertificateMapEntry(name); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_getcertificatemapentry_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getdnsauthorization/AsyncGetDnsAuthorization.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getdnsauthorization/AsyncGetDnsAuthorization.java new file mode 100644 index 0000000..cc14f6d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getdnsauthorization/AsyncGetDnsAuthorization.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_getdnsauthorization_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.DnsAuthorization; +import com.google.cloud.certificatemanager.v1.DnsAuthorizationName; +import com.google.cloud.certificatemanager.v1.GetDnsAuthorizationRequest; + +public class AsyncGetDnsAuthorization { + + public static void main(String[] args) throws Exception { + asyncGetDnsAuthorization(); + } + + public static void asyncGetDnsAuthorization() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + GetDnsAuthorizationRequest request = + GetDnsAuthorizationRequest.newBuilder() + .setName( + DnsAuthorizationName.of("[PROJECT]", "[LOCATION]", "[DNS_AUTHORIZATION]") + .toString()) + .build(); + ApiFuture future = + certificateManagerClient.getDnsAuthorizationCallable().futureCall(request); + // Do something. + DnsAuthorization response = future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_getdnsauthorization_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getdnsauthorization/SyncGetDnsAuthorization.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getdnsauthorization/SyncGetDnsAuthorization.java new file mode 100644 index 0000000..ed4ab1d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getdnsauthorization/SyncGetDnsAuthorization.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_getdnsauthorization_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.DnsAuthorization; +import com.google.cloud.certificatemanager.v1.DnsAuthorizationName; +import com.google.cloud.certificatemanager.v1.GetDnsAuthorizationRequest; + +public class SyncGetDnsAuthorization { + + public static void main(String[] args) throws Exception { + syncGetDnsAuthorization(); + } + + public static void syncGetDnsAuthorization() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + GetDnsAuthorizationRequest request = + GetDnsAuthorizationRequest.newBuilder() + .setName( + DnsAuthorizationName.of("[PROJECT]", "[LOCATION]", "[DNS_AUTHORIZATION]") + .toString()) + .build(); + DnsAuthorization response = certificateManagerClient.getDnsAuthorization(request); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_getdnsauthorization_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getdnsauthorization/SyncGetDnsAuthorizationDnsauthorizationname.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getdnsauthorization/SyncGetDnsAuthorizationDnsauthorizationname.java new file mode 100644 index 0000000..577f142 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getdnsauthorization/SyncGetDnsAuthorizationDnsauthorizationname.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_getdnsauthorization_dnsauthorizationname_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.DnsAuthorization; +import com.google.cloud.certificatemanager.v1.DnsAuthorizationName; + +public class SyncGetDnsAuthorizationDnsauthorizationname { + + public static void main(String[] args) throws Exception { + syncGetDnsAuthorizationDnsauthorizationname(); + } + + public static void syncGetDnsAuthorizationDnsauthorizationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + DnsAuthorizationName name = + DnsAuthorizationName.of("[PROJECT]", "[LOCATION]", "[DNS_AUTHORIZATION]"); + DnsAuthorization response = certificateManagerClient.getDnsAuthorization(name); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_getdnsauthorization_dnsauthorizationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getdnsauthorization/SyncGetDnsAuthorizationString.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getdnsauthorization/SyncGetDnsAuthorizationString.java new file mode 100644 index 0000000..63ac157 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getdnsauthorization/SyncGetDnsAuthorizationString.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_getdnsauthorization_string_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.DnsAuthorization; +import com.google.cloud.certificatemanager.v1.DnsAuthorizationName; + +public class SyncGetDnsAuthorizationString { + + public static void main(String[] args) throws Exception { + syncGetDnsAuthorizationString(); + } + + public static void syncGetDnsAuthorizationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + String name = + DnsAuthorizationName.of("[PROJECT]", "[LOCATION]", "[DNS_AUTHORIZATION]").toString(); + DnsAuthorization response = certificateManagerClient.getDnsAuthorization(name); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_getdnsauthorization_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemapentries/AsyncListCertificateMapEntries.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemapentries/AsyncListCertificateMapEntries.java new file mode 100644 index 0000000..95e2138 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemapentries/AsyncListCertificateMapEntries.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_listcertificatemapentries_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntry; +import com.google.cloud.certificatemanager.v1.CertificateMapName; +import com.google.cloud.certificatemanager.v1.ListCertificateMapEntriesRequest; + +public class AsyncListCertificateMapEntries { + + public static void main(String[] args) throws Exception { + asyncListCertificateMapEntries(); + } + + public static void asyncListCertificateMapEntries() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + ListCertificateMapEntriesRequest request = + ListCertificateMapEntriesRequest.newBuilder() + .setParent( + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + certificateManagerClient.listCertificateMapEntriesPagedCallable().futureCall(request); + // Do something. + for (CertificateMapEntry element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_listcertificatemapentries_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemapentries/AsyncListCertificateMapEntriesPaged.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemapentries/AsyncListCertificateMapEntriesPaged.java new file mode 100644 index 0000000..376f660 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemapentries/AsyncListCertificateMapEntriesPaged.java @@ -0,0 +1,64 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_listcertificatemapentries_paged_async] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntry; +import com.google.cloud.certificatemanager.v1.CertificateMapName; +import com.google.cloud.certificatemanager.v1.ListCertificateMapEntriesRequest; +import com.google.cloud.certificatemanager.v1.ListCertificateMapEntriesResponse; +import com.google.common.base.Strings; + +public class AsyncListCertificateMapEntriesPaged { + + public static void main(String[] args) throws Exception { + asyncListCertificateMapEntriesPaged(); + } + + public static void asyncListCertificateMapEntriesPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + ListCertificateMapEntriesRequest request = + ListCertificateMapEntriesRequest.newBuilder() + .setParent( + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListCertificateMapEntriesResponse response = + certificateManagerClient.listCertificateMapEntriesCallable().call(request); + for (CertificateMapEntry element : response.getCertificateMapEntriesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_listcertificatemapentries_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemapentries/SyncListCertificateMapEntries.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemapentries/SyncListCertificateMapEntries.java new file mode 100644 index 0000000..4bb803b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemapentries/SyncListCertificateMapEntries.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_listcertificatemapentries_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntry; +import com.google.cloud.certificatemanager.v1.CertificateMapName; +import com.google.cloud.certificatemanager.v1.ListCertificateMapEntriesRequest; + +public class SyncListCertificateMapEntries { + + public static void main(String[] args) throws Exception { + syncListCertificateMapEntries(); + } + + public static void syncListCertificateMapEntries() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + ListCertificateMapEntriesRequest request = + ListCertificateMapEntriesRequest.newBuilder() + .setParent( + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (CertificateMapEntry element : + certificateManagerClient.listCertificateMapEntries(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_listcertificatemapentries_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemapentries/SyncListCertificateMapEntriesCertificatemapname.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemapentries/SyncListCertificateMapEntriesCertificatemapname.java new file mode 100644 index 0000000..da4caa1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemapentries/SyncListCertificateMapEntriesCertificatemapname.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_listcertificatemapentries_certificatemapname_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntry; +import com.google.cloud.certificatemanager.v1.CertificateMapName; + +public class SyncListCertificateMapEntriesCertificatemapname { + + public static void main(String[] args) throws Exception { + syncListCertificateMapEntriesCertificatemapname(); + } + + public static void syncListCertificateMapEntriesCertificatemapname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + CertificateMapName parent = + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]"); + for (CertificateMapEntry element : + certificateManagerClient.listCertificateMapEntries(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_listcertificatemapentries_certificatemapname_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemapentries/SyncListCertificateMapEntriesString.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemapentries/SyncListCertificateMapEntriesString.java new file mode 100644 index 0000000..360ea56 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemapentries/SyncListCertificateMapEntriesString.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_listcertificatemapentries_string_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntry; +import com.google.cloud.certificatemanager.v1.CertificateMapName; + +public class SyncListCertificateMapEntriesString { + + public static void main(String[] args) throws Exception { + syncListCertificateMapEntriesString(); + } + + public static void syncListCertificateMapEntriesString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + String parent = + CertificateMapName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_MAP]").toString(); + for (CertificateMapEntry element : + certificateManagerClient.listCertificateMapEntries(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_listcertificatemapentries_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemaps/AsyncListCertificateMaps.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemaps/AsyncListCertificateMaps.java new file mode 100644 index 0000000..d17db84 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemaps/AsyncListCertificateMaps.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_listcertificatemaps_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMap; +import com.google.cloud.certificatemanager.v1.ListCertificateMapsRequest; +import com.google.cloud.certificatemanager.v1.LocationName; + +public class AsyncListCertificateMaps { + + public static void main(String[] args) throws Exception { + asyncListCertificateMaps(); + } + + public static void asyncListCertificateMaps() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + ListCertificateMapsRequest request = + ListCertificateMapsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + certificateManagerClient.listCertificateMapsPagedCallable().futureCall(request); + // Do something. + for (CertificateMap element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_listcertificatemaps_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemaps/AsyncListCertificateMapsPaged.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemaps/AsyncListCertificateMapsPaged.java new file mode 100644 index 0000000..f251450 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemaps/AsyncListCertificateMapsPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_listcertificatemaps_paged_async] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMap; +import com.google.cloud.certificatemanager.v1.ListCertificateMapsRequest; +import com.google.cloud.certificatemanager.v1.ListCertificateMapsResponse; +import com.google.cloud.certificatemanager.v1.LocationName; +import com.google.common.base.Strings; + +public class AsyncListCertificateMapsPaged { + + public static void main(String[] args) throws Exception { + asyncListCertificateMapsPaged(); + } + + public static void asyncListCertificateMapsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + ListCertificateMapsRequest request = + ListCertificateMapsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListCertificateMapsResponse response = + certificateManagerClient.listCertificateMapsCallable().call(request); + for (CertificateMap element : response.getCertificateMapsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_listcertificatemaps_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemaps/SyncListCertificateMaps.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemaps/SyncListCertificateMaps.java new file mode 100644 index 0000000..a2c3e66 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemaps/SyncListCertificateMaps.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_listcertificatemaps_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMap; +import com.google.cloud.certificatemanager.v1.ListCertificateMapsRequest; +import com.google.cloud.certificatemanager.v1.LocationName; + +public class SyncListCertificateMaps { + + public static void main(String[] args) throws Exception { + syncListCertificateMaps(); + } + + public static void syncListCertificateMaps() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + ListCertificateMapsRequest request = + ListCertificateMapsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (CertificateMap element : + certificateManagerClient.listCertificateMaps(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_listcertificatemaps_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemaps/SyncListCertificateMapsLocationname.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemaps/SyncListCertificateMapsLocationname.java new file mode 100644 index 0000000..603fa84 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemaps/SyncListCertificateMapsLocationname.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_listcertificatemaps_locationname_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMap; +import com.google.cloud.certificatemanager.v1.LocationName; + +public class SyncListCertificateMapsLocationname { + + public static void main(String[] args) throws Exception { + syncListCertificateMapsLocationname(); + } + + public static void syncListCertificateMapsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (CertificateMap element : + certificateManagerClient.listCertificateMaps(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_listcertificatemaps_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemaps/SyncListCertificateMapsString.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemaps/SyncListCertificateMapsString.java new file mode 100644 index 0000000..a1b3bb4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificatemaps/SyncListCertificateMapsString.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_listcertificatemaps_string_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMap; +import com.google.cloud.certificatemanager.v1.LocationName; + +public class SyncListCertificateMapsString { + + public static void main(String[] args) throws Exception { + syncListCertificateMapsString(); + } + + public static void syncListCertificateMapsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (CertificateMap element : + certificateManagerClient.listCertificateMaps(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_listcertificatemaps_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificates/AsyncListCertificates.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificates/AsyncListCertificates.java new file mode 100644 index 0000000..e7d86b8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificates/AsyncListCertificates.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_listcertificates_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.certificatemanager.v1.Certificate; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.ListCertificatesRequest; +import com.google.cloud.certificatemanager.v1.LocationName; + +public class AsyncListCertificates { + + public static void main(String[] args) throws Exception { + asyncListCertificates(); + } + + public static void asyncListCertificates() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + ListCertificatesRequest request = + ListCertificatesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + certificateManagerClient.listCertificatesPagedCallable().futureCall(request); + // Do something. + for (Certificate element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_listcertificates_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificates/AsyncListCertificatesPaged.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificates/AsyncListCertificatesPaged.java new file mode 100644 index 0000000..6f1406d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificates/AsyncListCertificatesPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_listcertificates_paged_async] +import com.google.cloud.certificatemanager.v1.Certificate; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.ListCertificatesRequest; +import com.google.cloud.certificatemanager.v1.ListCertificatesResponse; +import com.google.cloud.certificatemanager.v1.LocationName; +import com.google.common.base.Strings; + +public class AsyncListCertificatesPaged { + + public static void main(String[] args) throws Exception { + asyncListCertificatesPaged(); + } + + public static void asyncListCertificatesPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + ListCertificatesRequest request = + ListCertificatesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListCertificatesResponse response = + certificateManagerClient.listCertificatesCallable().call(request); + for (Certificate element : response.getCertificatesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_listcertificates_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificates/SyncListCertificates.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificates/SyncListCertificates.java new file mode 100644 index 0000000..f9ecf76 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificates/SyncListCertificates.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_listcertificates_sync] +import com.google.cloud.certificatemanager.v1.Certificate; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.ListCertificatesRequest; +import com.google.cloud.certificatemanager.v1.LocationName; + +public class SyncListCertificates { + + public static void main(String[] args) throws Exception { + syncListCertificates(); + } + + public static void syncListCertificates() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + ListCertificatesRequest request = + ListCertificatesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (Certificate element : certificateManagerClient.listCertificates(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_listcertificates_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificates/SyncListCertificatesLocationname.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificates/SyncListCertificatesLocationname.java new file mode 100644 index 0000000..41f513d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificates/SyncListCertificatesLocationname.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_listcertificates_locationname_sync] +import com.google.cloud.certificatemanager.v1.Certificate; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.LocationName; + +public class SyncListCertificatesLocationname { + + public static void main(String[] args) throws Exception { + syncListCertificatesLocationname(); + } + + public static void syncListCertificatesLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Certificate element : certificateManagerClient.listCertificates(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_listcertificates_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificates/SyncListCertificatesString.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificates/SyncListCertificatesString.java new file mode 100644 index 0000000..46b08cf --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listcertificates/SyncListCertificatesString.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_listcertificates_string_sync] +import com.google.cloud.certificatemanager.v1.Certificate; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.LocationName; + +public class SyncListCertificatesString { + + public static void main(String[] args) throws Exception { + syncListCertificatesString(); + } + + public static void syncListCertificatesString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Certificate element : certificateManagerClient.listCertificates(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_listcertificates_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listdnsauthorizations/AsyncListDnsAuthorizations.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listdnsauthorizations/AsyncListDnsAuthorizations.java new file mode 100644 index 0000000..63e5fef --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listdnsauthorizations/AsyncListDnsAuthorizations.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_listdnsauthorizations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.DnsAuthorization; +import com.google.cloud.certificatemanager.v1.ListDnsAuthorizationsRequest; +import com.google.cloud.certificatemanager.v1.LocationName; + +public class AsyncListDnsAuthorizations { + + public static void main(String[] args) throws Exception { + asyncListDnsAuthorizations(); + } + + public static void asyncListDnsAuthorizations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + ListDnsAuthorizationsRequest request = + ListDnsAuthorizationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + certificateManagerClient.listDnsAuthorizationsPagedCallable().futureCall(request); + // Do something. + for (DnsAuthorization element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_listdnsauthorizations_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listdnsauthorizations/AsyncListDnsAuthorizationsPaged.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listdnsauthorizations/AsyncListDnsAuthorizationsPaged.java new file mode 100644 index 0000000..ea2429b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listdnsauthorizations/AsyncListDnsAuthorizationsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_listdnsauthorizations_paged_async] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.DnsAuthorization; +import com.google.cloud.certificatemanager.v1.ListDnsAuthorizationsRequest; +import com.google.cloud.certificatemanager.v1.ListDnsAuthorizationsResponse; +import com.google.cloud.certificatemanager.v1.LocationName; +import com.google.common.base.Strings; + +public class AsyncListDnsAuthorizationsPaged { + + public static void main(String[] args) throws Exception { + asyncListDnsAuthorizationsPaged(); + } + + public static void asyncListDnsAuthorizationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + ListDnsAuthorizationsRequest request = + ListDnsAuthorizationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListDnsAuthorizationsResponse response = + certificateManagerClient.listDnsAuthorizationsCallable().call(request); + for (DnsAuthorization element : response.getDnsAuthorizationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_listdnsauthorizations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listdnsauthorizations/SyncListDnsAuthorizations.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listdnsauthorizations/SyncListDnsAuthorizations.java new file mode 100644 index 0000000..adb395a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listdnsauthorizations/SyncListDnsAuthorizations.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_listdnsauthorizations_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.DnsAuthorization; +import com.google.cloud.certificatemanager.v1.ListDnsAuthorizationsRequest; +import com.google.cloud.certificatemanager.v1.LocationName; + +public class SyncListDnsAuthorizations { + + public static void main(String[] args) throws Exception { + syncListDnsAuthorizations(); + } + + public static void syncListDnsAuthorizations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + ListDnsAuthorizationsRequest request = + ListDnsAuthorizationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (DnsAuthorization element : + certificateManagerClient.listDnsAuthorizations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_listdnsauthorizations_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listdnsauthorizations/SyncListDnsAuthorizationsLocationname.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listdnsauthorizations/SyncListDnsAuthorizationsLocationname.java new file mode 100644 index 0000000..7ede22f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listdnsauthorizations/SyncListDnsAuthorizationsLocationname.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_listdnsauthorizations_locationname_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.DnsAuthorization; +import com.google.cloud.certificatemanager.v1.LocationName; + +public class SyncListDnsAuthorizationsLocationname { + + public static void main(String[] args) throws Exception { + syncListDnsAuthorizationsLocationname(); + } + + public static void syncListDnsAuthorizationsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (DnsAuthorization element : + certificateManagerClient.listDnsAuthorizations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_listdnsauthorizations_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listdnsauthorizations/SyncListDnsAuthorizationsString.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listdnsauthorizations/SyncListDnsAuthorizationsString.java new file mode 100644 index 0000000..12ca6ea --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listdnsauthorizations/SyncListDnsAuthorizationsString.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_listdnsauthorizations_string_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.DnsAuthorization; +import com.google.cloud.certificatemanager.v1.LocationName; + +public class SyncListDnsAuthorizationsString { + + public static void main(String[] args) throws Exception { + syncListDnsAuthorizationsString(); + } + + public static void syncListDnsAuthorizationsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (DnsAuthorization element : + certificateManagerClient.listDnsAuthorizations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_listdnsauthorizations_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificate/AsyncUpdateCertificate.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificate/AsyncUpdateCertificate.java new file mode 100644 index 0000000..a948069 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificate/AsyncUpdateCertificate.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_updatecertificate_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.certificatemanager.v1.Certificate; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.UpdateCertificateRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCertificate { + + public static void main(String[] args) throws Exception { + asyncUpdateCertificate(); + } + + public static void asyncUpdateCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + UpdateCertificateRequest request = + UpdateCertificateRequest.newBuilder() + .setCertificate(Certificate.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + certificateManagerClient.updateCertificateCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_updatecertificate_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificate/AsyncUpdateCertificateLRO.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificate/AsyncUpdateCertificateLRO.java new file mode 100644 index 0000000..2f7fdac --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificate/AsyncUpdateCertificateLRO.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_updatecertificate_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.certificatemanager.v1.Certificate; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.OperationMetadata; +import com.google.cloud.certificatemanager.v1.UpdateCertificateRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCertificateLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateCertificateLRO(); + } + + public static void asyncUpdateCertificateLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + UpdateCertificateRequest request = + UpdateCertificateRequest.newBuilder() + .setCertificate(Certificate.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + certificateManagerClient.updateCertificateOperationCallable().futureCall(request); + // Do something. + Certificate response = future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_updatecertificate_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificate/SyncUpdateCertificate.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificate/SyncUpdateCertificate.java new file mode 100644 index 0000000..b638323 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificate/SyncUpdateCertificate.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_updatecertificate_sync] +import com.google.cloud.certificatemanager.v1.Certificate; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.UpdateCertificateRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCertificate { + + public static void main(String[] args) throws Exception { + syncUpdateCertificate(); + } + + public static void syncUpdateCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + UpdateCertificateRequest request = + UpdateCertificateRequest.newBuilder() + .setCertificate(Certificate.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Certificate response = certificateManagerClient.updateCertificateAsync(request).get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_updatecertificate_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificate/SyncUpdateCertificateCertificateFieldmask.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificate/SyncUpdateCertificateCertificateFieldmask.java new file mode 100644 index 0000000..c7bdcd9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificate/SyncUpdateCertificateCertificateFieldmask.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_updatecertificate_certificatefieldmask_sync] +import com.google.cloud.certificatemanager.v1.Certificate; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCertificateCertificateFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateCertificateCertificateFieldmask(); + } + + public static void syncUpdateCertificateCertificateFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + Certificate certificate = Certificate.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Certificate response = + certificateManagerClient.updateCertificateAsync(certificate, updateMask).get(); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_updatecertificate_certificatefieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemap/AsyncUpdateCertificateMap.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemap/AsyncUpdateCertificateMap.java new file mode 100644 index 0000000..992acd2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemap/AsyncUpdateCertificateMap.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_updatecertificatemap_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMap; +import com.google.cloud.certificatemanager.v1.UpdateCertificateMapRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCertificateMap { + + public static void main(String[] args) throws Exception { + asyncUpdateCertificateMap(); + } + + public static void asyncUpdateCertificateMap() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + UpdateCertificateMapRequest request = + UpdateCertificateMapRequest.newBuilder() + .setCertificateMap(CertificateMap.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + certificateManagerClient.updateCertificateMapCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_updatecertificatemap_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemap/AsyncUpdateCertificateMapLRO.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemap/AsyncUpdateCertificateMapLRO.java new file mode 100644 index 0000000..eb4ce27 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemap/AsyncUpdateCertificateMapLRO.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_updatecertificatemap_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMap; +import com.google.cloud.certificatemanager.v1.OperationMetadata; +import com.google.cloud.certificatemanager.v1.UpdateCertificateMapRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCertificateMapLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateCertificateMapLRO(); + } + + public static void asyncUpdateCertificateMapLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + UpdateCertificateMapRequest request = + UpdateCertificateMapRequest.newBuilder() + .setCertificateMap(CertificateMap.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + certificateManagerClient.updateCertificateMapOperationCallable().futureCall(request); + // Do something. + CertificateMap response = future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_updatecertificatemap_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemap/SyncUpdateCertificateMap.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemap/SyncUpdateCertificateMap.java new file mode 100644 index 0000000..440b6c2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemap/SyncUpdateCertificateMap.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_updatecertificatemap_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMap; +import com.google.cloud.certificatemanager.v1.UpdateCertificateMapRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCertificateMap { + + public static void main(String[] args) throws Exception { + syncUpdateCertificateMap(); + } + + public static void syncUpdateCertificateMap() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + UpdateCertificateMapRequest request = + UpdateCertificateMapRequest.newBuilder() + .setCertificateMap(CertificateMap.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + CertificateMap response = certificateManagerClient.updateCertificateMapAsync(request).get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_updatecertificatemap_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemap/SyncUpdateCertificateMapCertificatemapFieldmask.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemap/SyncUpdateCertificateMapCertificatemapFieldmask.java new file mode 100644 index 0000000..18e6f61 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemap/SyncUpdateCertificateMapCertificatemapFieldmask.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_updatecertificatemap_certificatemapfieldmask_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMap; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCertificateMapCertificatemapFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateCertificateMapCertificatemapFieldmask(); + } + + public static void syncUpdateCertificateMapCertificatemapFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + CertificateMap certificateMap = CertificateMap.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + CertificateMap response = + certificateManagerClient.updateCertificateMapAsync(certificateMap, updateMask).get(); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_updatecertificatemap_certificatemapfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemapentry/AsyncUpdateCertificateMapEntry.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemapentry/AsyncUpdateCertificateMapEntry.java new file mode 100644 index 0000000..f75d48a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemapentry/AsyncUpdateCertificateMapEntry.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_updatecertificatemapentry_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntry; +import com.google.cloud.certificatemanager.v1.UpdateCertificateMapEntryRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCertificateMapEntry { + + public static void main(String[] args) throws Exception { + asyncUpdateCertificateMapEntry(); + } + + public static void asyncUpdateCertificateMapEntry() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + UpdateCertificateMapEntryRequest request = + UpdateCertificateMapEntryRequest.newBuilder() + .setCertificateMapEntry(CertificateMapEntry.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + certificateManagerClient.updateCertificateMapEntryCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_updatecertificatemapentry_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemapentry/AsyncUpdateCertificateMapEntryLRO.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemapentry/AsyncUpdateCertificateMapEntryLRO.java new file mode 100644 index 0000000..9f55524 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemapentry/AsyncUpdateCertificateMapEntryLRO.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_updatecertificatemapentry_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntry; +import com.google.cloud.certificatemanager.v1.OperationMetadata; +import com.google.cloud.certificatemanager.v1.UpdateCertificateMapEntryRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCertificateMapEntryLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateCertificateMapEntryLRO(); + } + + public static void asyncUpdateCertificateMapEntryLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + UpdateCertificateMapEntryRequest request = + UpdateCertificateMapEntryRequest.newBuilder() + .setCertificateMapEntry(CertificateMapEntry.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + certificateManagerClient.updateCertificateMapEntryOperationCallable().futureCall(request); + // Do something. + CertificateMapEntry response = future.get(); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_updatecertificatemapentry_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemapentry/SyncUpdateCertificateMapEntry.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemapentry/SyncUpdateCertificateMapEntry.java new file mode 100644 index 0000000..27c1973 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemapentry/SyncUpdateCertificateMapEntry.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_updatecertificatemapentry_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntry; +import com.google.cloud.certificatemanager.v1.UpdateCertificateMapEntryRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCertificateMapEntry { + + public static void main(String[] args) throws Exception { + syncUpdateCertificateMapEntry(); + } + + public static void syncUpdateCertificateMapEntry() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + UpdateCertificateMapEntryRequest request = + UpdateCertificateMapEntryRequest.newBuilder() + .setCertificateMapEntry(CertificateMapEntry.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + CertificateMapEntry response = + certificateManagerClient.updateCertificateMapEntryAsync(request).get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_updatecertificatemapentry_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemapentry/SyncUpdateCertificateMapEntryCertificatemapentryFieldmask.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemapentry/SyncUpdateCertificateMapEntryCertificatemapentryFieldmask.java new file mode 100644 index 0000000..597e397 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatecertificatemapentry/SyncUpdateCertificateMapEntryCertificatemapentryFieldmask.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_updatecertificatemapentry_certificatemapentryfieldmask_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.CertificateMapEntry; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCertificateMapEntryCertificatemapentryFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateCertificateMapEntryCertificatemapentryFieldmask(); + } + + public static void syncUpdateCertificateMapEntryCertificatemapentryFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + CertificateMapEntry certificateMapEntry = CertificateMapEntry.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + CertificateMapEntry response = + certificateManagerClient + .updateCertificateMapEntryAsync(certificateMapEntry, updateMask) + .get(); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_updatecertificatemapentry_certificatemapentryfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatednsauthorization/AsyncUpdateDnsAuthorization.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatednsauthorization/AsyncUpdateDnsAuthorization.java new file mode 100644 index 0000000..3b54fcc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatednsauthorization/AsyncUpdateDnsAuthorization.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_updatednsauthorization_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.DnsAuthorization; +import com.google.cloud.certificatemanager.v1.UpdateDnsAuthorizationRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateDnsAuthorization { + + public static void main(String[] args) throws Exception { + asyncUpdateDnsAuthorization(); + } + + public static void asyncUpdateDnsAuthorization() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + UpdateDnsAuthorizationRequest request = + UpdateDnsAuthorizationRequest.newBuilder() + .setDnsAuthorization(DnsAuthorization.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + certificateManagerClient.updateDnsAuthorizationCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_updatednsauthorization_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatednsauthorization/AsyncUpdateDnsAuthorizationLRO.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatednsauthorization/AsyncUpdateDnsAuthorizationLRO.java new file mode 100644 index 0000000..ab7ecd5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatednsauthorization/AsyncUpdateDnsAuthorizationLRO.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_updatednsauthorization_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.DnsAuthorization; +import com.google.cloud.certificatemanager.v1.OperationMetadata; +import com.google.cloud.certificatemanager.v1.UpdateDnsAuthorizationRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateDnsAuthorizationLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateDnsAuthorizationLRO(); + } + + public static void asyncUpdateDnsAuthorizationLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + UpdateDnsAuthorizationRequest request = + UpdateDnsAuthorizationRequest.newBuilder() + .setDnsAuthorization(DnsAuthorization.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + certificateManagerClient.updateDnsAuthorizationOperationCallable().futureCall(request); + // Do something. + DnsAuthorization response = future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_updatednsauthorization_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatednsauthorization/SyncUpdateDnsAuthorization.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatednsauthorization/SyncUpdateDnsAuthorization.java new file mode 100644 index 0000000..906d9cf --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatednsauthorization/SyncUpdateDnsAuthorization.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_updatednsauthorization_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.DnsAuthorization; +import com.google.cloud.certificatemanager.v1.UpdateDnsAuthorizationRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateDnsAuthorization { + + public static void main(String[] args) throws Exception { + syncUpdateDnsAuthorization(); + } + + public static void syncUpdateDnsAuthorization() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + UpdateDnsAuthorizationRequest request = + UpdateDnsAuthorizationRequest.newBuilder() + .setDnsAuthorization(DnsAuthorization.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + DnsAuthorization response = + certificateManagerClient.updateDnsAuthorizationAsync(request).get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_updatednsauthorization_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatednsauthorization/SyncUpdateDnsAuthorizationDnsauthorizationFieldmask.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatednsauthorization/SyncUpdateDnsAuthorizationDnsauthorizationFieldmask.java new file mode 100644 index 0000000..bfc172a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/updatednsauthorization/SyncUpdateDnsAuthorizationDnsauthorizationFieldmask.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.certificatemanager.v1.samples; + +// [START +// certificatemanager_v1_generated_certificatemanagerclient_updatednsauthorization_dnsauthorizationfieldmask_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.certificatemanager.v1.DnsAuthorization; +import com.google.protobuf.FieldMask; + +public class SyncUpdateDnsAuthorizationDnsauthorizationFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateDnsAuthorizationDnsauthorizationFieldmask(); + } + + public static void syncUpdateDnsAuthorizationDnsauthorizationFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + DnsAuthorization dnsAuthorization = DnsAuthorization.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + DnsAuthorization response = + certificateManagerClient.updateDnsAuthorizationAsync(dnsAuthorization, updateMask).get(); + } + } +} +// [END +// certificatemanager_v1_generated_certificatemanagerclient_updatednsauthorization_dnsauthorizationfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagersettings/getcertificate/SyncGetCertificate.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagersettings/getcertificate/SyncGetCertificate.java new file mode 100644 index 0000000..d90f92a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagersettings/getcertificate/SyncGetCertificate.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.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagersettings_getcertificate_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerSettings; +import java.time.Duration; + +public class SyncGetCertificate { + + public static void main(String[] args) throws Exception { + syncGetCertificate(); + } + + public static void syncGetCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CertificateManagerSettings.Builder certificateManagerSettingsBuilder = + CertificateManagerSettings.newBuilder(); + certificateManagerSettingsBuilder + .getCertificateSettings() + .setRetrySettings( + certificateManagerSettingsBuilder + .getCertificateSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CertificateManagerSettings certificateManagerSettings = + certificateManagerSettingsBuilder.build(); + } +} +// [END certificatemanager_v1_generated_certificatemanagersettings_getcertificate_sync] diff --git a/samples/snippets/generated/com/google/cloud/certificatemanager/v1/stub/certificatemanagerstubsettings/getcertificate/SyncGetCertificate.java b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/stub/certificatemanagerstubsettings/getcertificate/SyncGetCertificate.java new file mode 100644 index 0000000..74e2355 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/certificatemanager/v1/stub/certificatemanagerstubsettings/getcertificate/SyncGetCertificate.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.certificatemanager.v1.stub.samples; + +// [START certificatemanager_v1_generated_certificatemanagerstubsettings_getcertificate_sync] +import com.google.cloud.certificatemanager.v1.stub.CertificateManagerStubSettings; +import java.time.Duration; + +public class SyncGetCertificate { + + public static void main(String[] args) throws Exception { + syncGetCertificate(); + } + + public static void syncGetCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CertificateManagerStubSettings.Builder certificateManagerSettingsBuilder = + CertificateManagerStubSettings.newBuilder(); + certificateManagerSettingsBuilder + .getCertificateSettings() + .setRetrySettings( + certificateManagerSettingsBuilder + .getCertificateSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CertificateManagerStubSettings certificateManagerSettings = + certificateManagerSettingsBuilder.build(); + } +} +// [END certificatemanager_v1_generated_certificatemanagerstubsettings_getcertificate_sync]