diff --git a/README.md b/README.md index 804d0d84..b5123226 100644 --- a/README.md +++ b/README.md @@ -27,13 +27,13 @@ If you are using Maven, add this to your pom.xml file: If you are using Gradle without BOM, add this to your dependencies ```Groovy -implementation 'com.google.cloud:google-cloud-domains:0.6.0' +implementation 'com.google.cloud:google-cloud-domains:0.6.1' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-domains" % "0.6.0" +libraryDependencies += "com.google.cloud" % "google-cloud-domains" % "0.6.1" ``` ## Authentication diff --git a/google-cloud-domains/pom.xml b/google-cloud-domains/pom.xml index d85613ec..7d295c01 100644 --- a/google-cloud-domains/pom.xml +++ b/google-cloud-domains/pom.xml @@ -66,6 +66,10 @@ com.google.api gax-grpc + + com.google.api + gax-httpjson + org.threeten threetenbp @@ -95,12 +99,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-domains/src/main/java/com/google/cloud/domains/v1/DomainsClient.java b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/DomainsClient.java index f984f6bf..a697fd4d 100644 --- a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/DomainsClient.java +++ b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/DomainsClient.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.domains.v1.stub.DomainsStubSettings; 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 com.google.type.Money; @@ -103,13 +103,28 @@ * DomainsClient domainsClient = DomainsClient.create(domainsSettings); * } * + *

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.
+ * DomainsSettings domainsSettings =
+ *     DomainsSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             DomainsSettings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * DomainsClient domainsClient = DomainsClient.create(domainsSettings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") public class DomainsClient implements BackgroundResource { private final DomainsSettings settings; private final DomainsStub stub; - private final OperationsClient operationsClient; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of DomainsClient with default settings. */ public static final DomainsClient create() throws IOException { @@ -139,13 +154,17 @@ public static final DomainsClient create(DomainsStub stub) { protected DomainsClient(DomainsSettings settings) throws IOException { this.settings = settings; this.stub = ((DomainsStubSettings) 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 DomainsClient(DomainsStub 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 DomainsSettings getSettings() { @@ -160,10 +179,18 @@ public DomainsStub 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. /** * Searches for available domain names similar to the provided query. diff --git a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/DomainsSettings.java b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/DomainsSettings.java index 7a6ade9c..e1b7cc49 100644 --- a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/DomainsSettings.java +++ b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/DomainsSettings.java @@ -23,6 +23,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; @@ -228,11 +229,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return DomainsStubSettings.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 DomainsStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return DomainsStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return DomainsStubSettings.defaultTransportChannelProvider(); } @@ -242,11 +250,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return DomainsStubSettings.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); @@ -284,6 +298,11 @@ private static Builder createDefault() { return new Builder(DomainsStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(DomainsStubSettings.newHttpJsonBuilder()); + } + public DomainsStubSettings.Builder getStubSettingsBuilder() { return ((DomainsStubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/DomainsStub.java b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/DomainsStub.java index 87c1dc61..bda9889c 100644 --- a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/DomainsStub.java +++ b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/DomainsStub.java @@ -58,7 +58,11 @@ public abstract class DomainsStub 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 searchDomainsCallable() { diff --git a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/DomainsStubSettings.java b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/DomainsStubSettings.java index bd290063..77bd965e 100644 --- a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/DomainsStubSettings.java +++ b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/DomainsStubSettings.java @@ -28,6 +28,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; @@ -360,6 +363,11 @@ public DomainsStub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcDomainsStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonDomainsStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -392,29 +400,54 @@ 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(DomainsStubSettings.class)) .setTransportToken( 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(DomainsStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return DomainsStubSettings.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); @@ -658,6 +691,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 .searchDomainsSettings() diff --git a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/HttpJsonDomainsCallableFactory.java b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/HttpJsonDomainsCallableFactory.java new file mode 100644 index 00000000..270f0dc6 --- /dev/null +++ b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/HttpJsonDomainsCallableFactory.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.domains.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 Domains service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonDomainsCallableFactory + 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-domains/src/main/java/com/google/cloud/domains/v1/stub/HttpJsonDomainsStub.java b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/HttpJsonDomainsStub.java new file mode 100644 index 00000000..ff46eff7 --- /dev/null +++ b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/HttpJsonDomainsStub.java @@ -0,0 +1,1137 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.stub; + +import static com.google.cloud.domains.v1.DomainsClient.ListRegistrationsPagedResponse; + +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.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1.DeleteRegistrationRequest; +import com.google.cloud.domains.v1.ExportRegistrationRequest; +import com.google.cloud.domains.v1.GetRegistrationRequest; +import com.google.cloud.domains.v1.ListRegistrationsRequest; +import com.google.cloud.domains.v1.ListRegistrationsResponse; +import com.google.cloud.domains.v1.OperationMetadata; +import com.google.cloud.domains.v1.RegisterDomainRequest; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.ResetAuthorizationCodeRequest; +import com.google.cloud.domains.v1.RetrieveAuthorizationCodeRequest; +import com.google.cloud.domains.v1.RetrieveRegisterParametersRequest; +import com.google.cloud.domains.v1.RetrieveRegisterParametersResponse; +import com.google.cloud.domains.v1.RetrieveTransferParametersRequest; +import com.google.cloud.domains.v1.RetrieveTransferParametersResponse; +import com.google.cloud.domains.v1.SearchDomainsRequest; +import com.google.cloud.domains.v1.SearchDomainsResponse; +import com.google.cloud.domains.v1.TransferDomainRequest; +import com.google.cloud.domains.v1.UpdateRegistrationRequest; +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 Domains service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonDomainsStub extends DomainsStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(OperationMetadata.getDescriptor()) + .add(Empty.getDescriptor()) + .add(Registration.getDescriptor()) + .build(); + + private static final ApiMethodDescriptor + searchDomainsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/SearchDomains") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{location=projects/*/locations/*}/registrations:searchDomains", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "location", request.getLocation()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "query", request.getQuery()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(SearchDomainsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + RetrieveRegisterParametersRequest, RetrieveRegisterParametersResponse> + retrieveRegisterParametersMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/RetrieveRegisterParameters") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{location=projects/*/locations/*}/registrations:retrieveRegisterParameters", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "location", request.getLocation()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "domainName", request.getDomainName()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(RetrieveRegisterParametersResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + registerDomainMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/RegisterDomain") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/registrations:register", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (RegisterDomainRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor< + RetrieveTransferParametersRequest, RetrieveTransferParametersResponse> + retrieveTransferParametersMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/RetrieveTransferParameters") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{location=projects/*/locations/*}/registrations:retrieveTransferParameters", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "location", request.getLocation()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "domainName", request.getDomainName()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(RetrieveTransferParametersResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + transferDomainMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/TransferDomain") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/registrations:transfer", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (TransferDomainRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + listRegistrationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/ListRegistrations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/registrations", + 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, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListRegistrationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/GetRegistration") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/registrations/*}", + 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(Registration.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/UpdateRegistration") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{registration.name=projects/*/locations/*/registrations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration.name", request.getRegistration().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("registration", request.getRegistration())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateRegistrationRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + configureManagementSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/ConfigureManagementSettings") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{registration=projects/*/locations/*/registrations/*}:configureManagementSettings", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ConfigureManagementSettingsRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + configureDnsSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/ConfigureDnsSettings") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{registration=projects/*/locations/*/registrations/*}:configureDnsSettings", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ConfigureDnsSettingsRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + configureContactSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/ConfigureContactSettings") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{registration=projects/*/locations/*/registrations/*}:configureContactSettings", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ConfigureContactSettingsRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + exportRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/ExportRegistration") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/registrations/*}:export", + 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 -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ExportRegistrationRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + deleteRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/DeleteRegistration") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/registrations/*}", + 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( + (DeleteRegistrationRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + retrieveAuthorizationCodeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/RetrieveAuthorizationCode") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{registration=projects/*/locations/*/registrations/*}:retrieveAuthorizationCode", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AuthorizationCode.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + resetAuthorizationCodeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/ResetAuthorizationCode") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{registration=projects/*/locations/*/registrations/*}:resetAuthorizationCode", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AuthorizationCode.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable searchDomainsCallable; + private final UnaryCallable + retrieveRegisterParametersCallable; + private final UnaryCallable registerDomainCallable; + private final OperationCallable + registerDomainOperationCallable; + private final UnaryCallable + retrieveTransferParametersCallable; + private final UnaryCallable transferDomainCallable; + private final OperationCallable + transferDomainOperationCallable; + private final UnaryCallable + listRegistrationsCallable; + private final UnaryCallable + listRegistrationsPagedCallable; + private final UnaryCallable getRegistrationCallable; + private final UnaryCallable updateRegistrationCallable; + private final OperationCallable + updateRegistrationOperationCallable; + private final UnaryCallable + configureManagementSettingsCallable; + private final OperationCallable< + ConfigureManagementSettingsRequest, Registration, OperationMetadata> + configureManagementSettingsOperationCallable; + private final UnaryCallable configureDnsSettingsCallable; + private final OperationCallable + configureDnsSettingsOperationCallable; + private final UnaryCallable + configureContactSettingsCallable; + private final OperationCallable + configureContactSettingsOperationCallable; + private final UnaryCallable exportRegistrationCallable; + private final OperationCallable + exportRegistrationOperationCallable; + private final UnaryCallable deleteRegistrationCallable; + private final OperationCallable + deleteRegistrationOperationCallable; + private final UnaryCallable + retrieveAuthorizationCodeCallable; + private final UnaryCallable + resetAuthorizationCodeCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonDomainsStub create(DomainsStubSettings settings) throws IOException { + return new HttpJsonDomainsStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonDomainsStub create(ClientContext clientContext) throws IOException { + return new HttpJsonDomainsStub(DomainsStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonDomainsStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonDomainsStub( + DomainsStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonDomainsStub, 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 HttpJsonDomainsStub(DomainsStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonDomainsCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonDomainsStub, 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 HttpJsonDomainsStub( + DomainsStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings + searchDomainsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(searchDomainsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + retrieveRegisterParametersTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(retrieveRegisterParametersMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings registerDomainTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(registerDomainMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + retrieveTransferParametersTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(retrieveTransferParametersMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings transferDomainTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(transferDomainMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listRegistrationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listRegistrationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + configureManagementSettingsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(configureManagementSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + configureDnsSettingsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(configureDnsSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + configureContactSettingsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(configureContactSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings exportRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(exportRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + retrieveAuthorizationCodeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(retrieveAuthorizationCodeMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + resetAuthorizationCodeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(resetAuthorizationCodeMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.searchDomainsCallable = + callableFactory.createUnaryCallable( + searchDomainsTransportSettings, settings.searchDomainsSettings(), clientContext); + this.retrieveRegisterParametersCallable = + callableFactory.createUnaryCallable( + retrieveRegisterParametersTransportSettings, + settings.retrieveRegisterParametersSettings(), + clientContext); + this.registerDomainCallable = + callableFactory.createUnaryCallable( + registerDomainTransportSettings, settings.registerDomainSettings(), clientContext); + this.registerDomainOperationCallable = + callableFactory.createOperationCallable( + registerDomainTransportSettings, + settings.registerDomainOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.retrieveTransferParametersCallable = + callableFactory.createUnaryCallable( + retrieveTransferParametersTransportSettings, + settings.retrieveTransferParametersSettings(), + clientContext); + this.transferDomainCallable = + callableFactory.createUnaryCallable( + transferDomainTransportSettings, settings.transferDomainSettings(), clientContext); + this.transferDomainOperationCallable = + callableFactory.createOperationCallable( + transferDomainTransportSettings, + settings.transferDomainOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.listRegistrationsCallable = + callableFactory.createUnaryCallable( + listRegistrationsTransportSettings, + settings.listRegistrationsSettings(), + clientContext); + this.listRegistrationsPagedCallable = + callableFactory.createPagedCallable( + listRegistrationsTransportSettings, + settings.listRegistrationsSettings(), + clientContext); + this.getRegistrationCallable = + callableFactory.createUnaryCallable( + getRegistrationTransportSettings, settings.getRegistrationSettings(), clientContext); + this.updateRegistrationCallable = + callableFactory.createUnaryCallable( + updateRegistrationTransportSettings, + settings.updateRegistrationSettings(), + clientContext); + this.updateRegistrationOperationCallable = + callableFactory.createOperationCallable( + updateRegistrationTransportSettings, + settings.updateRegistrationOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.configureManagementSettingsCallable = + callableFactory.createUnaryCallable( + configureManagementSettingsTransportSettings, + settings.configureManagementSettingsSettings(), + clientContext); + this.configureManagementSettingsOperationCallable = + callableFactory.createOperationCallable( + configureManagementSettingsTransportSettings, + settings.configureManagementSettingsOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.configureDnsSettingsCallable = + callableFactory.createUnaryCallable( + configureDnsSettingsTransportSettings, + settings.configureDnsSettingsSettings(), + clientContext); + this.configureDnsSettingsOperationCallable = + callableFactory.createOperationCallable( + configureDnsSettingsTransportSettings, + settings.configureDnsSettingsOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.configureContactSettingsCallable = + callableFactory.createUnaryCallable( + configureContactSettingsTransportSettings, + settings.configureContactSettingsSettings(), + clientContext); + this.configureContactSettingsOperationCallable = + callableFactory.createOperationCallable( + configureContactSettingsTransportSettings, + settings.configureContactSettingsOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.exportRegistrationCallable = + callableFactory.createUnaryCallable( + exportRegistrationTransportSettings, + settings.exportRegistrationSettings(), + clientContext); + this.exportRegistrationOperationCallable = + callableFactory.createOperationCallable( + exportRegistrationTransportSettings, + settings.exportRegistrationOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deleteRegistrationCallable = + callableFactory.createUnaryCallable( + deleteRegistrationTransportSettings, + settings.deleteRegistrationSettings(), + clientContext); + this.deleteRegistrationOperationCallable = + callableFactory.createOperationCallable( + deleteRegistrationTransportSettings, + settings.deleteRegistrationOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.retrieveAuthorizationCodeCallable = + callableFactory.createUnaryCallable( + retrieveAuthorizationCodeTransportSettings, + settings.retrieveAuthorizationCodeSettings(), + clientContext); + this.resetAuthorizationCodeCallable = + callableFactory.createUnaryCallable( + resetAuthorizationCodeTransportSettings, + settings.resetAuthorizationCodeSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(searchDomainsMethodDescriptor); + methodDescriptors.add(retrieveRegisterParametersMethodDescriptor); + methodDescriptors.add(registerDomainMethodDescriptor); + methodDescriptors.add(retrieveTransferParametersMethodDescriptor); + methodDescriptors.add(transferDomainMethodDescriptor); + methodDescriptors.add(listRegistrationsMethodDescriptor); + methodDescriptors.add(getRegistrationMethodDescriptor); + methodDescriptors.add(updateRegistrationMethodDescriptor); + methodDescriptors.add(configureManagementSettingsMethodDescriptor); + methodDescriptors.add(configureDnsSettingsMethodDescriptor); + methodDescriptors.add(configureContactSettingsMethodDescriptor); + methodDescriptors.add(exportRegistrationMethodDescriptor); + methodDescriptors.add(deleteRegistrationMethodDescriptor); + methodDescriptors.add(retrieveAuthorizationCodeMethodDescriptor); + methodDescriptors.add(resetAuthorizationCodeMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable searchDomainsCallable() { + return searchDomainsCallable; + } + + @Override + public UnaryCallable + retrieveRegisterParametersCallable() { + return retrieveRegisterParametersCallable; + } + + @Override + public UnaryCallable registerDomainCallable() { + return registerDomainCallable; + } + + @Override + public OperationCallable + registerDomainOperationCallable() { + return registerDomainOperationCallable; + } + + @Override + public UnaryCallable + retrieveTransferParametersCallable() { + return retrieveTransferParametersCallable; + } + + @Override + public UnaryCallable transferDomainCallable() { + return transferDomainCallable; + } + + @Override + public OperationCallable + transferDomainOperationCallable() { + return transferDomainOperationCallable; + } + + @Override + public UnaryCallable + listRegistrationsCallable() { + return listRegistrationsCallable; + } + + @Override + public UnaryCallable + listRegistrationsPagedCallable() { + return listRegistrationsPagedCallable; + } + + @Override + public UnaryCallable getRegistrationCallable() { + return getRegistrationCallable; + } + + @Override + public UnaryCallable updateRegistrationCallable() { + return updateRegistrationCallable; + } + + @Override + public OperationCallable + updateRegistrationOperationCallable() { + return updateRegistrationOperationCallable; + } + + @Override + public UnaryCallable + configureManagementSettingsCallable() { + return configureManagementSettingsCallable; + } + + @Override + public OperationCallable + configureManagementSettingsOperationCallable() { + return configureManagementSettingsOperationCallable; + } + + @Override + public UnaryCallable configureDnsSettingsCallable() { + return configureDnsSettingsCallable; + } + + @Override + public OperationCallable + configureDnsSettingsOperationCallable() { + return configureDnsSettingsOperationCallable; + } + + @Override + public UnaryCallable + configureContactSettingsCallable() { + return configureContactSettingsCallable; + } + + @Override + public OperationCallable + configureContactSettingsOperationCallable() { + return configureContactSettingsOperationCallable; + } + + @Override + public UnaryCallable exportRegistrationCallable() { + return exportRegistrationCallable; + } + + @Override + public OperationCallable + exportRegistrationOperationCallable() { + return exportRegistrationOperationCallable; + } + + @Override + public UnaryCallable deleteRegistrationCallable() { + return deleteRegistrationCallable; + } + + @Override + public OperationCallable + deleteRegistrationOperationCallable() { + return deleteRegistrationOperationCallable; + } + + @Override + public UnaryCallable + retrieveAuthorizationCodeCallable() { + return retrieveAuthorizationCodeCallable; + } + + @Override + public UnaryCallable + resetAuthorizationCodeCallable() { + return resetAuthorizationCodeCallable; + } + + @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-domains/src/main/java/com/google/cloud/domains/v1alpha2/DomainsClient.java b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/DomainsClient.java index ed9a6d18..5af5aff9 100644 --- a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/DomainsClient.java +++ b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/DomainsClient.java @@ -20,6 +20,7 @@ import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.longrunning.OperationsClient; import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; @@ -31,7 +32,6 @@ import com.google.cloud.domains.v1alpha2.stub.DomainsStubSettings; 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 com.google.type.Money; @@ -104,6 +104,20 @@ * DomainsClient domainsClient = DomainsClient.create(domainsSettings); * } * + *

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.
+ * DomainsSettings domainsSettings =
+ *     DomainsSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             DomainsSettings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * DomainsClient domainsClient = DomainsClient.create(domainsSettings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @BetaApi @@ -111,7 +125,8 @@ public class DomainsClient implements BackgroundResource { private final DomainsSettings settings; private final DomainsStub stub; - private final OperationsClient operationsClient; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of DomainsClient with default settings. */ public static final DomainsClient create() throws IOException { @@ -141,13 +156,17 @@ public static final DomainsClient create(DomainsStub stub) { protected DomainsClient(DomainsSettings settings) throws IOException { this.settings = settings; this.stub = ((DomainsStubSettings) 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 DomainsClient(DomainsStub 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 DomainsSettings getSettings() { @@ -162,10 +181,18 @@ public DomainsStub 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. /** * Searches for available domain names similar to the provided query. diff --git a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/DomainsSettings.java b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/DomainsSettings.java index 1229fd77..f7ff28d3 100644 --- a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/DomainsSettings.java +++ b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/DomainsSettings.java @@ -23,6 +23,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; @@ -229,11 +230,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return DomainsStubSettings.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 DomainsStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return DomainsStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return DomainsStubSettings.defaultTransportChannelProvider(); } @@ -243,11 +251,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return DomainsStubSettings.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); @@ -285,6 +299,11 @@ private static Builder createDefault() { return new Builder(DomainsStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(DomainsStubSettings.newHttpJsonBuilder()); + } + public DomainsStubSettings.Builder getStubSettingsBuilder() { return ((DomainsStubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/DomainsStub.java b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/DomainsStub.java index 676a64cb..5465e5ab 100644 --- a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/DomainsStub.java +++ b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/DomainsStub.java @@ -60,7 +60,11 @@ public abstract class DomainsStub 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 searchDomainsCallable() { diff --git a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/DomainsStubSettings.java b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/DomainsStubSettings.java index 3e6227b6..3ffa9c48 100644 --- a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/DomainsStubSettings.java +++ b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/DomainsStubSettings.java @@ -28,6 +28,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; @@ -361,6 +364,11 @@ public DomainsStub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcDomainsStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonDomainsStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -393,29 +401,54 @@ 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(DomainsStubSettings.class)) .setTransportToken( 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(DomainsStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return DomainsStubSettings.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); @@ -659,6 +692,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 .searchDomainsSettings() diff --git a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/HttpJsonDomainsCallableFactory.java b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/HttpJsonDomainsCallableFactory.java new file mode 100644 index 00000000..4b9cb199 --- /dev/null +++ b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/HttpJsonDomainsCallableFactory.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.domains.v1alpha2.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 Domains service API. + * + *

This class is for advanced usage. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonDomainsCallableFactory + 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-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/HttpJsonDomainsStub.java b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/HttpJsonDomainsStub.java new file mode 100644 index 00000000..7c7efb05 --- /dev/null +++ b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/HttpJsonDomainsStub.java @@ -0,0 +1,1138 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.stub; + +import static com.google.cloud.domains.v1alpha2.DomainsClient.ListRegistrationsPagedResponse; + +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.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1alpha2.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1alpha2.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1alpha2.DeleteRegistrationRequest; +import com.google.cloud.domains.v1alpha2.ExportRegistrationRequest; +import com.google.cloud.domains.v1alpha2.GetRegistrationRequest; +import com.google.cloud.domains.v1alpha2.ListRegistrationsRequest; +import com.google.cloud.domains.v1alpha2.ListRegistrationsResponse; +import com.google.cloud.domains.v1alpha2.OperationMetadata; +import com.google.cloud.domains.v1alpha2.RegisterDomainRequest; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.ResetAuthorizationCodeRequest; +import com.google.cloud.domains.v1alpha2.RetrieveAuthorizationCodeRequest; +import com.google.cloud.domains.v1alpha2.RetrieveRegisterParametersRequest; +import com.google.cloud.domains.v1alpha2.RetrieveRegisterParametersResponse; +import com.google.cloud.domains.v1alpha2.RetrieveTransferParametersRequest; +import com.google.cloud.domains.v1alpha2.RetrieveTransferParametersResponse; +import com.google.cloud.domains.v1alpha2.SearchDomainsRequest; +import com.google.cloud.domains.v1alpha2.SearchDomainsResponse; +import com.google.cloud.domains.v1alpha2.TransferDomainRequest; +import com.google.cloud.domains.v1alpha2.UpdateRegistrationRequest; +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 Domains service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonDomainsStub extends DomainsStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(Empty.getDescriptor()) + .add(Registration.getDescriptor()) + .add(OperationMetadata.getDescriptor()) + .build(); + + private static final ApiMethodDescriptor + searchDomainsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/SearchDomains") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{location=projects/*/locations/*}/registrations:searchDomains", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "location", request.getLocation()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "query", request.getQuery()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(SearchDomainsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + RetrieveRegisterParametersRequest, RetrieveRegisterParametersResponse> + retrieveRegisterParametersMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/RetrieveRegisterParameters") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{location=projects/*/locations/*}/registrations:retrieveRegisterParameters", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "location", request.getLocation()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "domainName", request.getDomainName()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(RetrieveRegisterParametersResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + registerDomainMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/RegisterDomain") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{parent=projects/*/locations/*}/registrations:register", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (RegisterDomainRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor< + RetrieveTransferParametersRequest, RetrieveTransferParametersResponse> + retrieveTransferParametersMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/RetrieveTransferParameters") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{location=projects/*/locations/*}/registrations:retrieveTransferParameters", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "location", request.getLocation()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "domainName", request.getDomainName()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(RetrieveTransferParametersResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + transferDomainMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/TransferDomain") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{parent=projects/*/locations/*}/registrations:transfer", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (TransferDomainRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + listRegistrationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/ListRegistrations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{parent=projects/*/locations/*}/registrations", + 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, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListRegistrationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/GetRegistration") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{name=projects/*/locations/*/registrations/*}", + 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(Registration.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/UpdateRegistration") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{registration.name=projects/*/locations/*/registrations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration.name", request.getRegistration().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("registration", request.getRegistration())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateRegistrationRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + configureManagementSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.domains.v1alpha2.Domains/ConfigureManagementSettings") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{registration=projects/*/locations/*/registrations/*}:configureManagementSettings", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ConfigureManagementSettingsRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + configureDnsSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/ConfigureDnsSettings") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{registration=projects/*/locations/*/registrations/*}:configureDnsSettings", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ConfigureDnsSettingsRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + configureContactSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/ConfigureContactSettings") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{registration=projects/*/locations/*/registrations/*}:configureContactSettings", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ConfigureContactSettingsRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + exportRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/ExportRegistration") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{name=projects/*/locations/*/registrations/*}:export", + 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 -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ExportRegistrationRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + deleteRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/DeleteRegistration") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{name=projects/*/locations/*/registrations/*}", + 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( + (DeleteRegistrationRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + retrieveAuthorizationCodeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/RetrieveAuthorizationCode") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{registration=projects/*/locations/*/registrations/*}:retrieveAuthorizationCode", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AuthorizationCode.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + resetAuthorizationCodeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/ResetAuthorizationCode") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{registration=projects/*/locations/*/registrations/*}:resetAuthorizationCode", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AuthorizationCode.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable searchDomainsCallable; + private final UnaryCallable + retrieveRegisterParametersCallable; + private final UnaryCallable registerDomainCallable; + private final OperationCallable + registerDomainOperationCallable; + private final UnaryCallable + retrieveTransferParametersCallable; + private final UnaryCallable transferDomainCallable; + private final OperationCallable + transferDomainOperationCallable; + private final UnaryCallable + listRegistrationsCallable; + private final UnaryCallable + listRegistrationsPagedCallable; + private final UnaryCallable getRegistrationCallable; + private final UnaryCallable updateRegistrationCallable; + private final OperationCallable + updateRegistrationOperationCallable; + private final UnaryCallable + configureManagementSettingsCallable; + private final OperationCallable< + ConfigureManagementSettingsRequest, Registration, OperationMetadata> + configureManagementSettingsOperationCallable; + private final UnaryCallable configureDnsSettingsCallable; + private final OperationCallable + configureDnsSettingsOperationCallable; + private final UnaryCallable + configureContactSettingsCallable; + private final OperationCallable + configureContactSettingsOperationCallable; + private final UnaryCallable exportRegistrationCallable; + private final OperationCallable + exportRegistrationOperationCallable; + private final UnaryCallable deleteRegistrationCallable; + private final OperationCallable + deleteRegistrationOperationCallable; + private final UnaryCallable + retrieveAuthorizationCodeCallable; + private final UnaryCallable + resetAuthorizationCodeCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonDomainsStub create(DomainsStubSettings settings) throws IOException { + return new HttpJsonDomainsStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonDomainsStub create(ClientContext clientContext) throws IOException { + return new HttpJsonDomainsStub(DomainsStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonDomainsStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonDomainsStub( + DomainsStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonDomainsStub, 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 HttpJsonDomainsStub(DomainsStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonDomainsCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonDomainsStub, 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 HttpJsonDomainsStub( + DomainsStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings + searchDomainsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(searchDomainsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + retrieveRegisterParametersTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(retrieveRegisterParametersMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings registerDomainTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(registerDomainMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + retrieveTransferParametersTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(retrieveTransferParametersMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings transferDomainTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(transferDomainMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listRegistrationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listRegistrationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + configureManagementSettingsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(configureManagementSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + configureDnsSettingsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(configureDnsSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + configureContactSettingsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(configureContactSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings exportRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(exportRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + retrieveAuthorizationCodeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(retrieveAuthorizationCodeMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + resetAuthorizationCodeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(resetAuthorizationCodeMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.searchDomainsCallable = + callableFactory.createUnaryCallable( + searchDomainsTransportSettings, settings.searchDomainsSettings(), clientContext); + this.retrieveRegisterParametersCallable = + callableFactory.createUnaryCallable( + retrieveRegisterParametersTransportSettings, + settings.retrieveRegisterParametersSettings(), + clientContext); + this.registerDomainCallable = + callableFactory.createUnaryCallable( + registerDomainTransportSettings, settings.registerDomainSettings(), clientContext); + this.registerDomainOperationCallable = + callableFactory.createOperationCallable( + registerDomainTransportSettings, + settings.registerDomainOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.retrieveTransferParametersCallable = + callableFactory.createUnaryCallable( + retrieveTransferParametersTransportSettings, + settings.retrieveTransferParametersSettings(), + clientContext); + this.transferDomainCallable = + callableFactory.createUnaryCallable( + transferDomainTransportSettings, settings.transferDomainSettings(), clientContext); + this.transferDomainOperationCallable = + callableFactory.createOperationCallable( + transferDomainTransportSettings, + settings.transferDomainOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.listRegistrationsCallable = + callableFactory.createUnaryCallable( + listRegistrationsTransportSettings, + settings.listRegistrationsSettings(), + clientContext); + this.listRegistrationsPagedCallable = + callableFactory.createPagedCallable( + listRegistrationsTransportSettings, + settings.listRegistrationsSettings(), + clientContext); + this.getRegistrationCallable = + callableFactory.createUnaryCallable( + getRegistrationTransportSettings, settings.getRegistrationSettings(), clientContext); + this.updateRegistrationCallable = + callableFactory.createUnaryCallable( + updateRegistrationTransportSettings, + settings.updateRegistrationSettings(), + clientContext); + this.updateRegistrationOperationCallable = + callableFactory.createOperationCallable( + updateRegistrationTransportSettings, + settings.updateRegistrationOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.configureManagementSettingsCallable = + callableFactory.createUnaryCallable( + configureManagementSettingsTransportSettings, + settings.configureManagementSettingsSettings(), + clientContext); + this.configureManagementSettingsOperationCallable = + callableFactory.createOperationCallable( + configureManagementSettingsTransportSettings, + settings.configureManagementSettingsOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.configureDnsSettingsCallable = + callableFactory.createUnaryCallable( + configureDnsSettingsTransportSettings, + settings.configureDnsSettingsSettings(), + clientContext); + this.configureDnsSettingsOperationCallable = + callableFactory.createOperationCallable( + configureDnsSettingsTransportSettings, + settings.configureDnsSettingsOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.configureContactSettingsCallable = + callableFactory.createUnaryCallable( + configureContactSettingsTransportSettings, + settings.configureContactSettingsSettings(), + clientContext); + this.configureContactSettingsOperationCallable = + callableFactory.createOperationCallable( + configureContactSettingsTransportSettings, + settings.configureContactSettingsOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.exportRegistrationCallable = + callableFactory.createUnaryCallable( + exportRegistrationTransportSettings, + settings.exportRegistrationSettings(), + clientContext); + this.exportRegistrationOperationCallable = + callableFactory.createOperationCallable( + exportRegistrationTransportSettings, + settings.exportRegistrationOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deleteRegistrationCallable = + callableFactory.createUnaryCallable( + deleteRegistrationTransportSettings, + settings.deleteRegistrationSettings(), + clientContext); + this.deleteRegistrationOperationCallable = + callableFactory.createOperationCallable( + deleteRegistrationTransportSettings, + settings.deleteRegistrationOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.retrieveAuthorizationCodeCallable = + callableFactory.createUnaryCallable( + retrieveAuthorizationCodeTransportSettings, + settings.retrieveAuthorizationCodeSettings(), + clientContext); + this.resetAuthorizationCodeCallable = + callableFactory.createUnaryCallable( + resetAuthorizationCodeTransportSettings, + settings.resetAuthorizationCodeSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(searchDomainsMethodDescriptor); + methodDescriptors.add(retrieveRegisterParametersMethodDescriptor); + methodDescriptors.add(registerDomainMethodDescriptor); + methodDescriptors.add(retrieveTransferParametersMethodDescriptor); + methodDescriptors.add(transferDomainMethodDescriptor); + methodDescriptors.add(listRegistrationsMethodDescriptor); + methodDescriptors.add(getRegistrationMethodDescriptor); + methodDescriptors.add(updateRegistrationMethodDescriptor); + methodDescriptors.add(configureManagementSettingsMethodDescriptor); + methodDescriptors.add(configureDnsSettingsMethodDescriptor); + methodDescriptors.add(configureContactSettingsMethodDescriptor); + methodDescriptors.add(exportRegistrationMethodDescriptor); + methodDescriptors.add(deleteRegistrationMethodDescriptor); + methodDescriptors.add(retrieveAuthorizationCodeMethodDescriptor); + methodDescriptors.add(resetAuthorizationCodeMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable searchDomainsCallable() { + return searchDomainsCallable; + } + + @Override + public UnaryCallable + retrieveRegisterParametersCallable() { + return retrieveRegisterParametersCallable; + } + + @Override + public UnaryCallable registerDomainCallable() { + return registerDomainCallable; + } + + @Override + public OperationCallable + registerDomainOperationCallable() { + return registerDomainOperationCallable; + } + + @Override + public UnaryCallable + retrieveTransferParametersCallable() { + return retrieveTransferParametersCallable; + } + + @Override + public UnaryCallable transferDomainCallable() { + return transferDomainCallable; + } + + @Override + public OperationCallable + transferDomainOperationCallable() { + return transferDomainOperationCallable; + } + + @Override + public UnaryCallable + listRegistrationsCallable() { + return listRegistrationsCallable; + } + + @Override + public UnaryCallable + listRegistrationsPagedCallable() { + return listRegistrationsPagedCallable; + } + + @Override + public UnaryCallable getRegistrationCallable() { + return getRegistrationCallable; + } + + @Override + public UnaryCallable updateRegistrationCallable() { + return updateRegistrationCallable; + } + + @Override + public OperationCallable + updateRegistrationOperationCallable() { + return updateRegistrationOperationCallable; + } + + @Override + public UnaryCallable + configureManagementSettingsCallable() { + return configureManagementSettingsCallable; + } + + @Override + public OperationCallable + configureManagementSettingsOperationCallable() { + return configureManagementSettingsOperationCallable; + } + + @Override + public UnaryCallable configureDnsSettingsCallable() { + return configureDnsSettingsCallable; + } + + @Override + public OperationCallable + configureDnsSettingsOperationCallable() { + return configureDnsSettingsOperationCallable; + } + + @Override + public UnaryCallable + configureContactSettingsCallable() { + return configureContactSettingsCallable; + } + + @Override + public OperationCallable + configureContactSettingsOperationCallable() { + return configureContactSettingsOperationCallable; + } + + @Override + public UnaryCallable exportRegistrationCallable() { + return exportRegistrationCallable; + } + + @Override + public OperationCallable + exportRegistrationOperationCallable() { + return exportRegistrationOperationCallable; + } + + @Override + public UnaryCallable deleteRegistrationCallable() { + return deleteRegistrationCallable; + } + + @Override + public OperationCallable + deleteRegistrationOperationCallable() { + return deleteRegistrationOperationCallable; + } + + @Override + public UnaryCallable + retrieveAuthorizationCodeCallable() { + return retrieveAuthorizationCodeCallable; + } + + @Override + public UnaryCallable + resetAuthorizationCodeCallable() { + return resetAuthorizationCodeCallable; + } + + @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-domains/src/main/java/com/google/cloud/domains/v1beta1/DomainsClient.java b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/DomainsClient.java index dab30159..a0c5bc2c 100644 --- a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/DomainsClient.java +++ b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/DomainsClient.java @@ -20,6 +20,7 @@ import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.longrunning.OperationsClient; import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; @@ -31,7 +32,6 @@ import com.google.cloud.domains.v1beta1.stub.DomainsStubSettings; 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 com.google.type.Money; @@ -104,6 +104,20 @@ * DomainsClient domainsClient = DomainsClient.create(domainsSettings); * } * + *

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.
+ * DomainsSettings domainsSettings =
+ *     DomainsSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             DomainsSettings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * DomainsClient domainsClient = DomainsClient.create(domainsSettings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @BetaApi @@ -111,7 +125,8 @@ public class DomainsClient implements BackgroundResource { private final DomainsSettings settings; private final DomainsStub stub; - private final OperationsClient operationsClient; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of DomainsClient with default settings. */ public static final DomainsClient create() throws IOException { @@ -141,13 +156,17 @@ public static final DomainsClient create(DomainsStub stub) { protected DomainsClient(DomainsSettings settings) throws IOException { this.settings = settings; this.stub = ((DomainsStubSettings) 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 DomainsClient(DomainsStub 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 DomainsSettings getSettings() { @@ -162,10 +181,18 @@ public DomainsStub 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. /** * Searches for available domain names similar to the provided query. diff --git a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/DomainsSettings.java b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/DomainsSettings.java index 4629a586..a3e4dad6 100644 --- a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/DomainsSettings.java +++ b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/DomainsSettings.java @@ -23,6 +23,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; @@ -229,11 +230,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return DomainsStubSettings.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 DomainsStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return DomainsStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return DomainsStubSettings.defaultTransportChannelProvider(); } @@ -243,11 +251,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return DomainsStubSettings.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); @@ -285,6 +299,11 @@ private static Builder createDefault() { return new Builder(DomainsStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(DomainsStubSettings.newHttpJsonBuilder()); + } + public DomainsStubSettings.Builder getStubSettingsBuilder() { return ((DomainsStubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/DomainsStub.java b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/DomainsStub.java index 1493625f..fccd3612 100644 --- a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/DomainsStub.java +++ b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/DomainsStub.java @@ -60,7 +60,11 @@ public abstract class DomainsStub 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 searchDomainsCallable() { diff --git a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/DomainsStubSettings.java b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/DomainsStubSettings.java index b0257628..46d9bb33 100644 --- a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/DomainsStubSettings.java +++ b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/DomainsStubSettings.java @@ -28,6 +28,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; @@ -361,6 +364,11 @@ public DomainsStub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcDomainsStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonDomainsStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -393,29 +401,54 @@ 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(DomainsStubSettings.class)) .setTransportToken( 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(DomainsStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return DomainsStubSettings.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); @@ -659,6 +692,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 .searchDomainsSettings() diff --git a/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/HttpJsonDomainsCallableFactory.java b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/HttpJsonDomainsCallableFactory.java new file mode 100644 index 00000000..e6ae4046 --- /dev/null +++ b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/HttpJsonDomainsCallableFactory.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.domains.v1beta1.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 Domains service API. + * + *

This class is for advanced usage. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonDomainsCallableFactory + 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-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/HttpJsonDomainsStub.java b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/HttpJsonDomainsStub.java new file mode 100644 index 00000000..4f68aa95 --- /dev/null +++ b/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/HttpJsonDomainsStub.java @@ -0,0 +1,1137 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.stub; + +import static com.google.cloud.domains.v1beta1.DomainsClient.ListRegistrationsPagedResponse; + +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.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1beta1.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1beta1.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1beta1.DeleteRegistrationRequest; +import com.google.cloud.domains.v1beta1.ExportRegistrationRequest; +import com.google.cloud.domains.v1beta1.GetRegistrationRequest; +import com.google.cloud.domains.v1beta1.ListRegistrationsRequest; +import com.google.cloud.domains.v1beta1.ListRegistrationsResponse; +import com.google.cloud.domains.v1beta1.OperationMetadata; +import com.google.cloud.domains.v1beta1.RegisterDomainRequest; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.ResetAuthorizationCodeRequest; +import com.google.cloud.domains.v1beta1.RetrieveAuthorizationCodeRequest; +import com.google.cloud.domains.v1beta1.RetrieveRegisterParametersRequest; +import com.google.cloud.domains.v1beta1.RetrieveRegisterParametersResponse; +import com.google.cloud.domains.v1beta1.RetrieveTransferParametersRequest; +import com.google.cloud.domains.v1beta1.RetrieveTransferParametersResponse; +import com.google.cloud.domains.v1beta1.SearchDomainsRequest; +import com.google.cloud.domains.v1beta1.SearchDomainsResponse; +import com.google.cloud.domains.v1beta1.TransferDomainRequest; +import com.google.cloud.domains.v1beta1.UpdateRegistrationRequest; +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 Domains service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonDomainsStub extends DomainsStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(Empty.getDescriptor()) + .add(Registration.getDescriptor()) + .add(OperationMetadata.getDescriptor()) + .build(); + + private static final ApiMethodDescriptor + searchDomainsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/SearchDomains") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{location=projects/*/locations/*}/registrations:searchDomains", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "location", request.getLocation()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "query", request.getQuery()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(SearchDomainsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + RetrieveRegisterParametersRequest, RetrieveRegisterParametersResponse> + retrieveRegisterParametersMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/RetrieveRegisterParameters") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{location=projects/*/locations/*}/registrations:retrieveRegisterParameters", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "location", request.getLocation()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "domainName", request.getDomainName()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(RetrieveRegisterParametersResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + registerDomainMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/RegisterDomain") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{parent=projects/*/locations/*}/registrations:register", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (RegisterDomainRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor< + RetrieveTransferParametersRequest, RetrieveTransferParametersResponse> + retrieveTransferParametersMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/RetrieveTransferParameters") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{location=projects/*/locations/*}/registrations:retrieveTransferParameters", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "location", request.getLocation()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "domainName", request.getDomainName()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(RetrieveTransferParametersResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + transferDomainMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/TransferDomain") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{parent=projects/*/locations/*}/registrations:transfer", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (TransferDomainRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + listRegistrationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/ListRegistrations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{parent=projects/*/locations/*}/registrations", + 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, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListRegistrationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/GetRegistration") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*/locations/*/registrations/*}", + 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(Registration.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/UpdateRegistration") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{registration.name=projects/*/locations/*/registrations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration.name", request.getRegistration().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("registration", request.getRegistration())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateRegistrationRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + configureManagementSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/ConfigureManagementSettings") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{registration=projects/*/locations/*/registrations/*}:configureManagementSettings", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ConfigureManagementSettingsRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + configureDnsSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/ConfigureDnsSettings") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{registration=projects/*/locations/*/registrations/*}:configureDnsSettings", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ConfigureDnsSettingsRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + configureContactSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/ConfigureContactSettings") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{registration=projects/*/locations/*/registrations/*}:configureContactSettings", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ConfigureContactSettingsRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + exportRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/ExportRegistration") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*/locations/*/registrations/*}:export", + 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 -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ExportRegistrationRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + deleteRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/DeleteRegistration") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*/locations/*/registrations/*}", + 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( + (DeleteRegistrationRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + retrieveAuthorizationCodeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/RetrieveAuthorizationCode") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{registration=projects/*/locations/*/registrations/*}:retrieveAuthorizationCode", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AuthorizationCode.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + resetAuthorizationCodeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/ResetAuthorizationCode") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{registration=projects/*/locations/*/registrations/*}:resetAuthorizationCode", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AuthorizationCode.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable searchDomainsCallable; + private final UnaryCallable + retrieveRegisterParametersCallable; + private final UnaryCallable registerDomainCallable; + private final OperationCallable + registerDomainOperationCallable; + private final UnaryCallable + retrieveTransferParametersCallable; + private final UnaryCallable transferDomainCallable; + private final OperationCallable + transferDomainOperationCallable; + private final UnaryCallable + listRegistrationsCallable; + private final UnaryCallable + listRegistrationsPagedCallable; + private final UnaryCallable getRegistrationCallable; + private final UnaryCallable updateRegistrationCallable; + private final OperationCallable + updateRegistrationOperationCallable; + private final UnaryCallable + configureManagementSettingsCallable; + private final OperationCallable< + ConfigureManagementSettingsRequest, Registration, OperationMetadata> + configureManagementSettingsOperationCallable; + private final UnaryCallable configureDnsSettingsCallable; + private final OperationCallable + configureDnsSettingsOperationCallable; + private final UnaryCallable + configureContactSettingsCallable; + private final OperationCallable + configureContactSettingsOperationCallable; + private final UnaryCallable exportRegistrationCallable; + private final OperationCallable + exportRegistrationOperationCallable; + private final UnaryCallable deleteRegistrationCallable; + private final OperationCallable + deleteRegistrationOperationCallable; + private final UnaryCallable + retrieveAuthorizationCodeCallable; + private final UnaryCallable + resetAuthorizationCodeCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonDomainsStub create(DomainsStubSettings settings) throws IOException { + return new HttpJsonDomainsStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonDomainsStub create(ClientContext clientContext) throws IOException { + return new HttpJsonDomainsStub(DomainsStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonDomainsStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonDomainsStub( + DomainsStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonDomainsStub, 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 HttpJsonDomainsStub(DomainsStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonDomainsCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonDomainsStub, 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 HttpJsonDomainsStub( + DomainsStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings + searchDomainsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(searchDomainsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + retrieveRegisterParametersTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(retrieveRegisterParametersMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings registerDomainTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(registerDomainMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + retrieveTransferParametersTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(retrieveTransferParametersMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings transferDomainTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(transferDomainMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listRegistrationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listRegistrationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + configureManagementSettingsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(configureManagementSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + configureDnsSettingsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(configureDnsSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + configureContactSettingsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(configureContactSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings exportRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(exportRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + retrieveAuthorizationCodeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(retrieveAuthorizationCodeMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + resetAuthorizationCodeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(resetAuthorizationCodeMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.searchDomainsCallable = + callableFactory.createUnaryCallable( + searchDomainsTransportSettings, settings.searchDomainsSettings(), clientContext); + this.retrieveRegisterParametersCallable = + callableFactory.createUnaryCallable( + retrieveRegisterParametersTransportSettings, + settings.retrieveRegisterParametersSettings(), + clientContext); + this.registerDomainCallable = + callableFactory.createUnaryCallable( + registerDomainTransportSettings, settings.registerDomainSettings(), clientContext); + this.registerDomainOperationCallable = + callableFactory.createOperationCallable( + registerDomainTransportSettings, + settings.registerDomainOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.retrieveTransferParametersCallable = + callableFactory.createUnaryCallable( + retrieveTransferParametersTransportSettings, + settings.retrieveTransferParametersSettings(), + clientContext); + this.transferDomainCallable = + callableFactory.createUnaryCallable( + transferDomainTransportSettings, settings.transferDomainSettings(), clientContext); + this.transferDomainOperationCallable = + callableFactory.createOperationCallable( + transferDomainTransportSettings, + settings.transferDomainOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.listRegistrationsCallable = + callableFactory.createUnaryCallable( + listRegistrationsTransportSettings, + settings.listRegistrationsSettings(), + clientContext); + this.listRegistrationsPagedCallable = + callableFactory.createPagedCallable( + listRegistrationsTransportSettings, + settings.listRegistrationsSettings(), + clientContext); + this.getRegistrationCallable = + callableFactory.createUnaryCallable( + getRegistrationTransportSettings, settings.getRegistrationSettings(), clientContext); + this.updateRegistrationCallable = + callableFactory.createUnaryCallable( + updateRegistrationTransportSettings, + settings.updateRegistrationSettings(), + clientContext); + this.updateRegistrationOperationCallable = + callableFactory.createOperationCallable( + updateRegistrationTransportSettings, + settings.updateRegistrationOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.configureManagementSettingsCallable = + callableFactory.createUnaryCallable( + configureManagementSettingsTransportSettings, + settings.configureManagementSettingsSettings(), + clientContext); + this.configureManagementSettingsOperationCallable = + callableFactory.createOperationCallable( + configureManagementSettingsTransportSettings, + settings.configureManagementSettingsOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.configureDnsSettingsCallable = + callableFactory.createUnaryCallable( + configureDnsSettingsTransportSettings, + settings.configureDnsSettingsSettings(), + clientContext); + this.configureDnsSettingsOperationCallable = + callableFactory.createOperationCallable( + configureDnsSettingsTransportSettings, + settings.configureDnsSettingsOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.configureContactSettingsCallable = + callableFactory.createUnaryCallable( + configureContactSettingsTransportSettings, + settings.configureContactSettingsSettings(), + clientContext); + this.configureContactSettingsOperationCallable = + callableFactory.createOperationCallable( + configureContactSettingsTransportSettings, + settings.configureContactSettingsOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.exportRegistrationCallable = + callableFactory.createUnaryCallable( + exportRegistrationTransportSettings, + settings.exportRegistrationSettings(), + clientContext); + this.exportRegistrationOperationCallable = + callableFactory.createOperationCallable( + exportRegistrationTransportSettings, + settings.exportRegistrationOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deleteRegistrationCallable = + callableFactory.createUnaryCallable( + deleteRegistrationTransportSettings, + settings.deleteRegistrationSettings(), + clientContext); + this.deleteRegistrationOperationCallable = + callableFactory.createOperationCallable( + deleteRegistrationTransportSettings, + settings.deleteRegistrationOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.retrieveAuthorizationCodeCallable = + callableFactory.createUnaryCallable( + retrieveAuthorizationCodeTransportSettings, + settings.retrieveAuthorizationCodeSettings(), + clientContext); + this.resetAuthorizationCodeCallable = + callableFactory.createUnaryCallable( + resetAuthorizationCodeTransportSettings, + settings.resetAuthorizationCodeSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(searchDomainsMethodDescriptor); + methodDescriptors.add(retrieveRegisterParametersMethodDescriptor); + methodDescriptors.add(registerDomainMethodDescriptor); + methodDescriptors.add(retrieveTransferParametersMethodDescriptor); + methodDescriptors.add(transferDomainMethodDescriptor); + methodDescriptors.add(listRegistrationsMethodDescriptor); + methodDescriptors.add(getRegistrationMethodDescriptor); + methodDescriptors.add(updateRegistrationMethodDescriptor); + methodDescriptors.add(configureManagementSettingsMethodDescriptor); + methodDescriptors.add(configureDnsSettingsMethodDescriptor); + methodDescriptors.add(configureContactSettingsMethodDescriptor); + methodDescriptors.add(exportRegistrationMethodDescriptor); + methodDescriptors.add(deleteRegistrationMethodDescriptor); + methodDescriptors.add(retrieveAuthorizationCodeMethodDescriptor); + methodDescriptors.add(resetAuthorizationCodeMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable searchDomainsCallable() { + return searchDomainsCallable; + } + + @Override + public UnaryCallable + retrieveRegisterParametersCallable() { + return retrieveRegisterParametersCallable; + } + + @Override + public UnaryCallable registerDomainCallable() { + return registerDomainCallable; + } + + @Override + public OperationCallable + registerDomainOperationCallable() { + return registerDomainOperationCallable; + } + + @Override + public UnaryCallable + retrieveTransferParametersCallable() { + return retrieveTransferParametersCallable; + } + + @Override + public UnaryCallable transferDomainCallable() { + return transferDomainCallable; + } + + @Override + public OperationCallable + transferDomainOperationCallable() { + return transferDomainOperationCallable; + } + + @Override + public UnaryCallable + listRegistrationsCallable() { + return listRegistrationsCallable; + } + + @Override + public UnaryCallable + listRegistrationsPagedCallable() { + return listRegistrationsPagedCallable; + } + + @Override + public UnaryCallable getRegistrationCallable() { + return getRegistrationCallable; + } + + @Override + public UnaryCallable updateRegistrationCallable() { + return updateRegistrationCallable; + } + + @Override + public OperationCallable + updateRegistrationOperationCallable() { + return updateRegistrationOperationCallable; + } + + @Override + public UnaryCallable + configureManagementSettingsCallable() { + return configureManagementSettingsCallable; + } + + @Override + public OperationCallable + configureManagementSettingsOperationCallable() { + return configureManagementSettingsOperationCallable; + } + + @Override + public UnaryCallable configureDnsSettingsCallable() { + return configureDnsSettingsCallable; + } + + @Override + public OperationCallable + configureDnsSettingsOperationCallable() { + return configureDnsSettingsOperationCallable; + } + + @Override + public UnaryCallable + configureContactSettingsCallable() { + return configureContactSettingsCallable; + } + + @Override + public OperationCallable + configureContactSettingsOperationCallable() { + return configureContactSettingsOperationCallable; + } + + @Override + public UnaryCallable exportRegistrationCallable() { + return exportRegistrationCallable; + } + + @Override + public OperationCallable + exportRegistrationOperationCallable() { + return exportRegistrationOperationCallable; + } + + @Override + public UnaryCallable deleteRegistrationCallable() { + return deleteRegistrationCallable; + } + + @Override + public OperationCallable + deleteRegistrationOperationCallable() { + return deleteRegistrationOperationCallable; + } + + @Override + public UnaryCallable + retrieveAuthorizationCodeCallable() { + return retrieveAuthorizationCodeCallable; + } + + @Override + public UnaryCallable + resetAuthorizationCodeCallable() { + return resetAuthorizationCodeCallable; + } + + @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-domains/src/test/java/com/google/cloud/domains/v1/DomainsClientHttpJsonTest.java b/google-cloud-domains/src/test/java/com/google/cloud/domains/v1/DomainsClientHttpJsonTest.java new file mode 100644 index 00000000..9ffed06d --- /dev/null +++ b/google-cloud-domains/src/test/java/com/google/cloud/domains/v1/DomainsClientHttpJsonTest.java @@ -0,0 +1,1700 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1; + +import static com.google.cloud.domains.v1.DomainsClient.ListRegistrationsPagedResponse; + +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.domains.v1.stub.HttpJsonDomainsStub; +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 com.google.type.Money; +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 DomainsClientHttpJsonTest { + private static MockHttpService mockService; + private static DomainsClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonDomainsStub.getMethodDescriptors(), DomainsSettings.getDefaultEndpoint()); + DomainsSettings settings = + DomainsSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + DomainsSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = DomainsClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void searchDomainsTest() throws Exception { + SearchDomainsResponse expectedResponse = + SearchDomainsResponse.newBuilder() + .addAllRegisterParameters(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String query = "query107944136"; + + SearchDomainsResponse actualResponse = client.searchDomains(location, query); + 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 searchDomainsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String query = "query107944136"; + client.searchDomains(location, query); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void searchDomainsTest2() throws Exception { + SearchDomainsResponse expectedResponse = + SearchDomainsResponse.newBuilder() + .addAllRegisterParameters(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String location = "projects/project-7132/locations/location-7132"; + String query = "query107944136"; + + SearchDomainsResponse actualResponse = client.searchDomains(location, query); + 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 searchDomainsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String location = "projects/project-7132/locations/location-7132"; + String query = "query107944136"; + client.searchDomains(location, query); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveRegisterParametersTest() throws Exception { + RetrieveRegisterParametersResponse expectedResponse = + RetrieveRegisterParametersResponse.newBuilder() + .setRegisterParameters(RegisterParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + + RetrieveRegisterParametersResponse actualResponse = + client.retrieveRegisterParameters(location, domainName); + 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 retrieveRegisterParametersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + client.retrieveRegisterParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveRegisterParametersTest2() throws Exception { + RetrieveRegisterParametersResponse expectedResponse = + RetrieveRegisterParametersResponse.newBuilder() + .setRegisterParameters(RegisterParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + + RetrieveRegisterParametersResponse actualResponse = + client.retrieveRegisterParameters(location, domainName); + 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 retrieveRegisterParametersExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + client.retrieveRegisterParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void registerDomainTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("registerDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + + Registration actualResponse = + client.registerDomainAsync(parent, registration, yearlyPrice).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 registerDomainExceptionTest() 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]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + client.registerDomainAsync(parent, registration, yearlyPrice).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void registerDomainTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("registerDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + + Registration actualResponse = + client.registerDomainAsync(parent, registration, yearlyPrice).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 registerDomainExceptionTest2() 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"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + client.registerDomainAsync(parent, registration, yearlyPrice).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void retrieveTransferParametersTest() throws Exception { + RetrieveTransferParametersResponse expectedResponse = + RetrieveTransferParametersResponse.newBuilder() + .setTransferParameters(TransferParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + + RetrieveTransferParametersResponse actualResponse = + client.retrieveTransferParameters(location, domainName); + 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 retrieveTransferParametersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + client.retrieveTransferParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveTransferParametersTest2() throws Exception { + RetrieveTransferParametersResponse expectedResponse = + RetrieveTransferParametersResponse.newBuilder() + .setTransferParameters(TransferParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + + RetrieveTransferParametersResponse actualResponse = + client.retrieveTransferParameters(location, domainName); + 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 retrieveTransferParametersExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + client.retrieveTransferParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void transferDomainTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("transferDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + + Registration actualResponse = + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).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 transferDomainExceptionTest() 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]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void transferDomainTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("transferDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + + Registration actualResponse = + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).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 transferDomainExceptionTest2() 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"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void listRegistrationsTest() throws Exception { + Registration responsesElement = Registration.newBuilder().build(); + ListRegistrationsResponse expectedResponse = + ListRegistrationsResponse.newBuilder() + .setNextPageToken("") + .addAllRegistrations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListRegistrationsPagedResponse pagedListResponse = client.listRegistrations(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getRegistrationsList().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 listRegistrationsExceptionTest() 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.listRegistrations(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listRegistrationsTest2() throws Exception { + Registration responsesElement = Registration.newBuilder().build(); + ListRegistrationsResponse expectedResponse = + ListRegistrationsResponse.newBuilder() + .setNextPageToken("") + .addAllRegistrations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListRegistrationsPagedResponse pagedListResponse = client.listRegistrations(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getRegistrationsList().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 listRegistrationsExceptionTest2() 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.listRegistrations(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getRegistrationTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + Registration actualResponse = client.getRegistration(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 getRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.getRegistration(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getRegistrationTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + + Registration actualResponse = client.getRegistration(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 getRegistrationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + client.getRegistration(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateRegistrationTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + Registration registration = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = client.updateRegistrationAsync(registration, 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 updateRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Registration registration = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateRegistrationAsync(registration, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureManagementSettingsTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureManagementSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureManagementSettingsAsync(registration, managementSettings, 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 configureManagementSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureManagementSettingsAsync(registration, managementSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureManagementSettingsTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureManagementSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureManagementSettingsAsync(registration, managementSettings, 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 configureManagementSettingsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureManagementSettingsAsync(registration, managementSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureDnsSettingsTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureDnsSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureDnsSettingsAsync(registration, dnsSettings, 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 configureDnsSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureDnsSettingsTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureDnsSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureDnsSettingsAsync(registration, dnsSettings, 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 configureDnsSettingsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureContactSettingsTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureContactSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureContactSettingsAsync(registration, contactSettings, 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 configureContactSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureContactSettingsAsync(registration, contactSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureContactSettingsTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureContactSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureContactSettingsAsync(registration, contactSettings, 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 configureContactSettingsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureContactSettingsAsync(registration, contactSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void exportRegistrationTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("exportRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + Registration actualResponse = client.exportRegistrationAsync(name).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 exportRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.exportRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void exportRegistrationTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("exportRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + + Registration actualResponse = client.exportRegistrationAsync(name).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 exportRegistrationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + client.exportRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteRegistrationTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + client.deleteRegistrationAsync(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 deleteRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.deleteRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteRegistrationTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + + client.deleteRegistrationAsync(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 deleteRegistrationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + client.deleteRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void retrieveAuthorizationCodeTest() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + AuthorizationCode actualResponse = client.retrieveAuthorizationCode(registration); + 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 retrieveAuthorizationCodeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.retrieveAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveAuthorizationCodeTest2() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + + AuthorizationCode actualResponse = client.retrieveAuthorizationCode(registration); + 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 retrieveAuthorizationCodeExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + client.retrieveAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void resetAuthorizationCodeTest() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + AuthorizationCode actualResponse = client.resetAuthorizationCode(registration); + 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 resetAuthorizationCodeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.resetAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void resetAuthorizationCodeTest2() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + + AuthorizationCode actualResponse = client.resetAuthorizationCode(registration); + 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 resetAuthorizationCodeExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + client.resetAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/google-cloud-domains/src/test/java/com/google/cloud/domains/v1alpha2/DomainsClientHttpJsonTest.java b/google-cloud-domains/src/test/java/com/google/cloud/domains/v1alpha2/DomainsClientHttpJsonTest.java new file mode 100644 index 00000000..82aa9442 --- /dev/null +++ b/google-cloud-domains/src/test/java/com/google/cloud/domains/v1alpha2/DomainsClientHttpJsonTest.java @@ -0,0 +1,1700 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2; + +import static com.google.cloud.domains.v1alpha2.DomainsClient.ListRegistrationsPagedResponse; + +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.domains.v1alpha2.stub.HttpJsonDomainsStub; +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 com.google.type.Money; +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 DomainsClientHttpJsonTest { + private static MockHttpService mockService; + private static DomainsClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonDomainsStub.getMethodDescriptors(), DomainsSettings.getDefaultEndpoint()); + DomainsSettings settings = + DomainsSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + DomainsSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = DomainsClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void searchDomainsTest() throws Exception { + SearchDomainsResponse expectedResponse = + SearchDomainsResponse.newBuilder() + .addAllRegisterParameters(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String query = "query107944136"; + + SearchDomainsResponse actualResponse = client.searchDomains(location, query); + 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 searchDomainsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String query = "query107944136"; + client.searchDomains(location, query); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void searchDomainsTest2() throws Exception { + SearchDomainsResponse expectedResponse = + SearchDomainsResponse.newBuilder() + .addAllRegisterParameters(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String location = "projects/project-7132/locations/location-7132"; + String query = "query107944136"; + + SearchDomainsResponse actualResponse = client.searchDomains(location, query); + 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 searchDomainsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String location = "projects/project-7132/locations/location-7132"; + String query = "query107944136"; + client.searchDomains(location, query); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveRegisterParametersTest() throws Exception { + RetrieveRegisterParametersResponse expectedResponse = + RetrieveRegisterParametersResponse.newBuilder() + .setRegisterParameters(RegisterParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + + RetrieveRegisterParametersResponse actualResponse = + client.retrieveRegisterParameters(location, domainName); + 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 retrieveRegisterParametersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + client.retrieveRegisterParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveRegisterParametersTest2() throws Exception { + RetrieveRegisterParametersResponse expectedResponse = + RetrieveRegisterParametersResponse.newBuilder() + .setRegisterParameters(RegisterParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + + RetrieveRegisterParametersResponse actualResponse = + client.retrieveRegisterParameters(location, domainName); + 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 retrieveRegisterParametersExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + client.retrieveRegisterParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void registerDomainTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("registerDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + + Registration actualResponse = + client.registerDomainAsync(parent, registration, yearlyPrice).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 registerDomainExceptionTest() 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]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + client.registerDomainAsync(parent, registration, yearlyPrice).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void registerDomainTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("registerDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + + Registration actualResponse = + client.registerDomainAsync(parent, registration, yearlyPrice).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 registerDomainExceptionTest2() 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"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + client.registerDomainAsync(parent, registration, yearlyPrice).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void retrieveTransferParametersTest() throws Exception { + RetrieveTransferParametersResponse expectedResponse = + RetrieveTransferParametersResponse.newBuilder() + .setTransferParameters(TransferParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + + RetrieveTransferParametersResponse actualResponse = + client.retrieveTransferParameters(location, domainName); + 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 retrieveTransferParametersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + client.retrieveTransferParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveTransferParametersTest2() throws Exception { + RetrieveTransferParametersResponse expectedResponse = + RetrieveTransferParametersResponse.newBuilder() + .setTransferParameters(TransferParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + + RetrieveTransferParametersResponse actualResponse = + client.retrieveTransferParameters(location, domainName); + 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 retrieveTransferParametersExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + client.retrieveTransferParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void transferDomainTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("transferDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + + Registration actualResponse = + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).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 transferDomainExceptionTest() 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]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void transferDomainTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("transferDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + + Registration actualResponse = + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).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 transferDomainExceptionTest2() 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"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void listRegistrationsTest() throws Exception { + Registration responsesElement = Registration.newBuilder().build(); + ListRegistrationsResponse expectedResponse = + ListRegistrationsResponse.newBuilder() + .setNextPageToken("") + .addAllRegistrations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListRegistrationsPagedResponse pagedListResponse = client.listRegistrations(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getRegistrationsList().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 listRegistrationsExceptionTest() 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.listRegistrations(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listRegistrationsTest2() throws Exception { + Registration responsesElement = Registration.newBuilder().build(); + ListRegistrationsResponse expectedResponse = + ListRegistrationsResponse.newBuilder() + .setNextPageToken("") + .addAllRegistrations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListRegistrationsPagedResponse pagedListResponse = client.listRegistrations(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getRegistrationsList().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 listRegistrationsExceptionTest2() 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.listRegistrations(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getRegistrationTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + Registration actualResponse = client.getRegistration(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 getRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.getRegistration(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getRegistrationTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + + Registration actualResponse = client.getRegistration(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 getRegistrationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + client.getRegistration(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateRegistrationTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + Registration registration = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = client.updateRegistrationAsync(registration, 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 updateRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Registration registration = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateRegistrationAsync(registration, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureManagementSettingsTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureManagementSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureManagementSettingsAsync(registration, managementSettings, 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 configureManagementSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureManagementSettingsAsync(registration, managementSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureManagementSettingsTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureManagementSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureManagementSettingsAsync(registration, managementSettings, 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 configureManagementSettingsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureManagementSettingsAsync(registration, managementSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureDnsSettingsTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureDnsSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureDnsSettingsAsync(registration, dnsSettings, 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 configureDnsSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureDnsSettingsTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureDnsSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureDnsSettingsAsync(registration, dnsSettings, 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 configureDnsSettingsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureContactSettingsTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureContactSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureContactSettingsAsync(registration, contactSettings, 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 configureContactSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureContactSettingsAsync(registration, contactSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureContactSettingsTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureContactSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureContactSettingsAsync(registration, contactSettings, 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 configureContactSettingsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureContactSettingsAsync(registration, contactSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void exportRegistrationTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("exportRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + Registration actualResponse = client.exportRegistrationAsync(name).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 exportRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.exportRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void exportRegistrationTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("exportRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + + Registration actualResponse = client.exportRegistrationAsync(name).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 exportRegistrationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + client.exportRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteRegistrationTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + client.deleteRegistrationAsync(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 deleteRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.deleteRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteRegistrationTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + + client.deleteRegistrationAsync(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 deleteRegistrationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + client.deleteRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void retrieveAuthorizationCodeTest() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + AuthorizationCode actualResponse = client.retrieveAuthorizationCode(registration); + 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 retrieveAuthorizationCodeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.retrieveAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveAuthorizationCodeTest2() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + + AuthorizationCode actualResponse = client.retrieveAuthorizationCode(registration); + 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 retrieveAuthorizationCodeExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + client.retrieveAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void resetAuthorizationCodeTest() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + AuthorizationCode actualResponse = client.resetAuthorizationCode(registration); + 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 resetAuthorizationCodeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.resetAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void resetAuthorizationCodeTest2() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + + AuthorizationCode actualResponse = client.resetAuthorizationCode(registration); + 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 resetAuthorizationCodeExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + client.resetAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/google-cloud-domains/src/test/java/com/google/cloud/domains/v1beta1/DomainsClientHttpJsonTest.java b/google-cloud-domains/src/test/java/com/google/cloud/domains/v1beta1/DomainsClientHttpJsonTest.java new file mode 100644 index 00000000..d8fc771f --- /dev/null +++ b/google-cloud-domains/src/test/java/com/google/cloud/domains/v1beta1/DomainsClientHttpJsonTest.java @@ -0,0 +1,1700 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1; + +import static com.google.cloud.domains.v1beta1.DomainsClient.ListRegistrationsPagedResponse; + +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.domains.v1beta1.stub.HttpJsonDomainsStub; +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 com.google.type.Money; +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 DomainsClientHttpJsonTest { + private static MockHttpService mockService; + private static DomainsClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonDomainsStub.getMethodDescriptors(), DomainsSettings.getDefaultEndpoint()); + DomainsSettings settings = + DomainsSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + DomainsSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = DomainsClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void searchDomainsTest() throws Exception { + SearchDomainsResponse expectedResponse = + SearchDomainsResponse.newBuilder() + .addAllRegisterParameters(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String query = "query107944136"; + + SearchDomainsResponse actualResponse = client.searchDomains(location, query); + 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 searchDomainsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String query = "query107944136"; + client.searchDomains(location, query); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void searchDomainsTest2() throws Exception { + SearchDomainsResponse expectedResponse = + SearchDomainsResponse.newBuilder() + .addAllRegisterParameters(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String location = "projects/project-7132/locations/location-7132"; + String query = "query107944136"; + + SearchDomainsResponse actualResponse = client.searchDomains(location, query); + 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 searchDomainsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String location = "projects/project-7132/locations/location-7132"; + String query = "query107944136"; + client.searchDomains(location, query); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveRegisterParametersTest() throws Exception { + RetrieveRegisterParametersResponse expectedResponse = + RetrieveRegisterParametersResponse.newBuilder() + .setRegisterParameters(RegisterParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + + RetrieveRegisterParametersResponse actualResponse = + client.retrieveRegisterParameters(location, domainName); + 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 retrieveRegisterParametersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + client.retrieveRegisterParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveRegisterParametersTest2() throws Exception { + RetrieveRegisterParametersResponse expectedResponse = + RetrieveRegisterParametersResponse.newBuilder() + .setRegisterParameters(RegisterParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + + RetrieveRegisterParametersResponse actualResponse = + client.retrieveRegisterParameters(location, domainName); + 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 retrieveRegisterParametersExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + client.retrieveRegisterParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void registerDomainTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("registerDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + + Registration actualResponse = + client.registerDomainAsync(parent, registration, yearlyPrice).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 registerDomainExceptionTest() 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]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + client.registerDomainAsync(parent, registration, yearlyPrice).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void registerDomainTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("registerDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + + Registration actualResponse = + client.registerDomainAsync(parent, registration, yearlyPrice).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 registerDomainExceptionTest2() 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"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + client.registerDomainAsync(parent, registration, yearlyPrice).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void retrieveTransferParametersTest() throws Exception { + RetrieveTransferParametersResponse expectedResponse = + RetrieveTransferParametersResponse.newBuilder() + .setTransferParameters(TransferParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + + RetrieveTransferParametersResponse actualResponse = + client.retrieveTransferParameters(location, domainName); + 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 retrieveTransferParametersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + client.retrieveTransferParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveTransferParametersTest2() throws Exception { + RetrieveTransferParametersResponse expectedResponse = + RetrieveTransferParametersResponse.newBuilder() + .setTransferParameters(TransferParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + + RetrieveTransferParametersResponse actualResponse = + client.retrieveTransferParameters(location, domainName); + 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 retrieveTransferParametersExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + client.retrieveTransferParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void transferDomainTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("transferDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + + Registration actualResponse = + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).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 transferDomainExceptionTest() 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]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void transferDomainTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("transferDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + + Registration actualResponse = + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).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 transferDomainExceptionTest2() 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"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void listRegistrationsTest() throws Exception { + Registration responsesElement = Registration.newBuilder().build(); + ListRegistrationsResponse expectedResponse = + ListRegistrationsResponse.newBuilder() + .setNextPageToken("") + .addAllRegistrations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListRegistrationsPagedResponse pagedListResponse = client.listRegistrations(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getRegistrationsList().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 listRegistrationsExceptionTest() 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.listRegistrations(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listRegistrationsTest2() throws Exception { + Registration responsesElement = Registration.newBuilder().build(); + ListRegistrationsResponse expectedResponse = + ListRegistrationsResponse.newBuilder() + .setNextPageToken("") + .addAllRegistrations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListRegistrationsPagedResponse pagedListResponse = client.listRegistrations(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getRegistrationsList().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 listRegistrationsExceptionTest2() 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.listRegistrations(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getRegistrationTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + Registration actualResponse = client.getRegistration(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 getRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.getRegistration(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getRegistrationTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + + Registration actualResponse = client.getRegistration(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 getRegistrationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + client.getRegistration(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateRegistrationTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + Registration registration = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = client.updateRegistrationAsync(registration, 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 updateRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Registration registration = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateRegistrationAsync(registration, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureManagementSettingsTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureManagementSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureManagementSettingsAsync(registration, managementSettings, 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 configureManagementSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureManagementSettingsAsync(registration, managementSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureManagementSettingsTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureManagementSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureManagementSettingsAsync(registration, managementSettings, 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 configureManagementSettingsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureManagementSettingsAsync(registration, managementSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureDnsSettingsTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureDnsSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureDnsSettingsAsync(registration, dnsSettings, 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 configureDnsSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureDnsSettingsTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureDnsSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureDnsSettingsAsync(registration, dnsSettings, 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 configureDnsSettingsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureContactSettingsTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureContactSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureContactSettingsAsync(registration, contactSettings, 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 configureContactSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureContactSettingsAsync(registration, contactSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureContactSettingsTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureContactSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureContactSettingsAsync(registration, contactSettings, 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 configureContactSettingsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureContactSettingsAsync(registration, contactSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void exportRegistrationTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("exportRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + Registration actualResponse = client.exportRegistrationAsync(name).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 exportRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.exportRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void exportRegistrationTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("exportRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + + Registration actualResponse = client.exportRegistrationAsync(name).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 exportRegistrationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + client.exportRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteRegistrationTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + client.deleteRegistrationAsync(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 deleteRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.deleteRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteRegistrationTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + + client.deleteRegistrationAsync(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 deleteRegistrationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + client.deleteRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void retrieveAuthorizationCodeTest() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + AuthorizationCode actualResponse = client.retrieveAuthorizationCode(registration); + 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 retrieveAuthorizationCodeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.retrieveAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveAuthorizationCodeTest2() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + + AuthorizationCode actualResponse = client.retrieveAuthorizationCode(registration); + 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 retrieveAuthorizationCodeExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + client.retrieveAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void resetAuthorizationCodeTest() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + AuthorizationCode actualResponse = client.resetAuthorizationCode(registration); + 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 resetAuthorizationCodeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.resetAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void resetAuthorizationCodeTest2() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + + AuthorizationCode actualResponse = client.resetAuthorizationCode(registration); + 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 resetAuthorizationCodeExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + client.resetAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/AsyncConfigureContactSettings.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/AsyncConfigureContactSettings.java new file mode 100644 index 00000000..fbb71658 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/AsyncConfigureContactSettings.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_configurecontactsettings_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1.ContactNotice; +import com.google.cloud.domains.v1.ContactSettings; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class AsyncConfigureContactSettings { + + public static void main(String[] args) throws Exception { + asyncConfigureContactSettings(); + } + + public static void asyncConfigureContactSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureContactSettingsRequest request = + ConfigureContactSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setValidateOnly(true) + .build(); + ApiFuture future = + domainsClient.configureContactSettingsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_configurecontactsettings_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/AsyncConfigureContactSettingsLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/AsyncConfigureContactSettingsLRO.java new file mode 100644 index 00000000..df0b46d7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/AsyncConfigureContactSettingsLRO.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_configurecontactsettings_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1.ContactNotice; +import com.google.cloud.domains.v1.ContactSettings; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.OperationMetadata; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class AsyncConfigureContactSettingsLRO { + + public static void main(String[] args) throws Exception { + asyncConfigureContactSettingsLRO(); + } + + public static void asyncConfigureContactSettingsLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureContactSettingsRequest request = + ConfigureContactSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.configureContactSettingsOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_configurecontactsettings_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/SyncConfigureContactSettings.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/SyncConfigureContactSettings.java new file mode 100644 index 00000000..62ef79d7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/SyncConfigureContactSettings.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_configurecontactsettings_sync] +import com.google.cloud.domains.v1.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1.ContactNotice; +import com.google.cloud.domains.v1.ContactSettings; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class SyncConfigureContactSettings { + + public static void main(String[] args) throws Exception { + syncConfigureContactSettings(); + } + + public static void syncConfigureContactSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureContactSettingsRequest request = + ConfigureContactSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.configureContactSettingsAsync(request).get(); + } + } +} +// [END domains_v1_generated_domainsclient_configurecontactsettings_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask.java new file mode 100644 index 00000000..c7faf3fc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask.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.domains.v1.samples; + +// [START +// domains_v1_generated_domainsclient_configurecontactsettings_registrationnamecontactsettingsfieldmask_sync] +import com.google.cloud.domains.v1.ContactSettings; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureContactSettingsRegistrationnameContactsettingsFieldmask(); + } + + public static void syncConfigureContactSettingsRegistrationnameContactsettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureContactSettingsAsync(registration, contactSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1_generated_domainsclient_configurecontactsettings_registrationnamecontactsettingsfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsStringContactsettingsFieldmask.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsStringContactsettingsFieldmask.java new file mode 100644 index 00000000..7a70741d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsStringContactsettingsFieldmask.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.domains.v1.samples; + +// [START +// domains_v1_generated_domainsclient_configurecontactsettings_stringcontactsettingsfieldmask_sync] +import com.google.cloud.domains.v1.ContactSettings; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureContactSettingsStringContactsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureContactSettingsStringContactsettingsFieldmask(); + } + + public static void syncConfigureContactSettingsStringContactsettingsFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureContactSettingsAsync(registration, contactSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1_generated_domainsclient_configurecontactsettings_stringcontactsettingsfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/AsyncConfigureDnsSettings.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/AsyncConfigureDnsSettings.java new file mode 100644 index 00000000..6a3d4a32 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/AsyncConfigureDnsSettings.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_configurednssettings_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1.DnsSettings; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureDnsSettings { + + public static void main(String[] args) throws Exception { + asyncConfigureDnsSettings(); + } + + public static void asyncConfigureDnsSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureDnsSettingsRequest request = + ConfigureDnsSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + ApiFuture future = + domainsClient.configureDnsSettingsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_configurednssettings_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/AsyncConfigureDnsSettingsLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/AsyncConfigureDnsSettingsLRO.java new file mode 100644 index 00000000..9c50e609 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/AsyncConfigureDnsSettingsLRO.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_configurednssettings_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1.DnsSettings; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.OperationMetadata; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureDnsSettingsLRO { + + public static void main(String[] args) throws Exception { + asyncConfigureDnsSettingsLRO(); + } + + public static void asyncConfigureDnsSettingsLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureDnsSettingsRequest request = + ConfigureDnsSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.configureDnsSettingsOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_configurednssettings_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/SyncConfigureDnsSettings.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/SyncConfigureDnsSettings.java new file mode 100644 index 00000000..088c9779 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/SyncConfigureDnsSettings.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_configurednssettings_sync] +import com.google.cloud.domains.v1.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1.DnsSettings; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureDnsSettings { + + public static void main(String[] args) throws Exception { + syncConfigureDnsSettings(); + } + + public static void syncConfigureDnsSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureDnsSettingsRequest request = + ConfigureDnsSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.configureDnsSettingsAsync(request).get(); + } + } +} +// [END domains_v1_generated_domainsclient_configurednssettings_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask.java new file mode 100644 index 00000000..164cb4b0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask.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.domains.v1.samples; + +// [START +// domains_v1_generated_domainsclient_configurednssettings_registrationnamednssettingsfieldmask_sync] +import com.google.cloud.domains.v1.DnsSettings; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask(); + } + + public static void syncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + } + } +} +// [END +// domains_v1_generated_domainsclient_configurednssettings_registrationnamednssettingsfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/SyncConfigureDnsSettingsStringDnssettingsFieldmask.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/SyncConfigureDnsSettingsStringDnssettingsFieldmask.java new file mode 100644 index 00000000..ca8de3d9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/SyncConfigureDnsSettingsStringDnssettingsFieldmask.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_configurednssettings_stringdnssettingsfieldmask_sync] +import com.google.cloud.domains.v1.DnsSettings; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureDnsSettingsStringDnssettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureDnsSettingsStringDnssettingsFieldmask(); + } + + public static void syncConfigureDnsSettingsStringDnssettingsFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + } + } +} +// [END domains_v1_generated_domainsclient_configurednssettings_stringdnssettingsfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettings.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettings.java new file mode 100644 index 00000000..df7cd707 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettings.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_configuremanagementsettings_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.ManagementSettings; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureManagementSettings { + + public static void main(String[] args) throws Exception { + asyncConfigureManagementSettings(); + } + + public static void asyncConfigureManagementSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureManagementSettingsRequest request = + ConfigureManagementSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + domainsClient.configureManagementSettingsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_configuremanagementsettings_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettingsLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettingsLRO.java new file mode 100644 index 00000000..37531435 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettingsLRO.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_configuremanagementsettings_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.ManagementSettings; +import com.google.cloud.domains.v1.OperationMetadata; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureManagementSettingsLRO { + + public static void main(String[] args) throws Exception { + asyncConfigureManagementSettingsLRO(); + } + + public static void asyncConfigureManagementSettingsLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureManagementSettingsRequest request = + ConfigureManagementSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + domainsClient.configureManagementSettingsOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_configuremanagementsettings_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettings.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettings.java new file mode 100644 index 00000000..d0196dd0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettings.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_configuremanagementsettings_sync] +import com.google.cloud.domains.v1.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.ManagementSettings; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureManagementSettings { + + public static void main(String[] args) throws Exception { + syncConfigureManagementSettings(); + } + + public static void syncConfigureManagementSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureManagementSettingsRequest request = + ConfigureManagementSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Registration response = domainsClient.configureManagementSettingsAsync(request).get(); + } + } +} +// [END domains_v1_generated_domainsclient_configuremanagementsettings_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask.java new file mode 100644 index 00000000..cdea50c1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask.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.domains.v1.samples; + +// [START +// domains_v1_generated_domainsclient_configuremanagementsettings_registrationnamemanagementsettingsfieldmask_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.ManagementSettings; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask(); + } + + public static void syncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureManagementSettingsAsync(registration, managementSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1_generated_domainsclient_configuremanagementsettings_registrationnamemanagementsettingsfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsStringManagementsettingsFieldmask.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsStringManagementsettingsFieldmask.java new file mode 100644 index 00000000..fa2d5df0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsStringManagementsettingsFieldmask.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.domains.v1.samples; + +// [START +// domains_v1_generated_domainsclient_configuremanagementsettings_stringmanagementsettingsfieldmask_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.ManagementSettings; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureManagementSettingsStringManagementsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureManagementSettingsStringManagementsettingsFieldmask(); + } + + public static void syncConfigureManagementSettingsStringManagementsettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureManagementSettingsAsync(registration, managementSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1_generated_domainsclient_configuremanagementsettings_stringmanagementsettingsfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..25839dd4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.DomainsSettings; +import com.google.cloud.domains.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. + DomainsSettings domainsSettings = + DomainsSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + DomainsClient domainsClient = DomainsClient.create(domainsSettings); + } +} +// [END domains_v1_generated_domainsclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000..ab5e5974 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_create_setcredentialsprovider1_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.DomainsSettings; + +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. + DomainsSettings domainsSettings = + DomainsSettings.newBuilder() + .setTransportChannelProvider( + DomainsSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + DomainsClient domainsClient = DomainsClient.create(domainsSettings); + } +} +// [END domains_v1_generated_domainsclient_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..8f0ed944 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,37 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_create_setendpoint_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.DomainsSettings; +import com.google.cloud.domains.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. + DomainsSettings domainsSettings = DomainsSettings.newBuilder().setEndpoint(myEndpoint).build(); + DomainsClient domainsClient = DomainsClient.create(domainsSettings); + } +} +// [END domains_v1_generated_domainsclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/AsyncDeleteRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/AsyncDeleteRegistration.java new file mode 100644 index 00000000..38fd8e2e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/AsyncDeleteRegistration.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_deleteregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.DeleteRegistrationRequest; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.longrunning.Operation; + +public class AsyncDeleteRegistration { + + public static void main(String[] args) throws Exception { + asyncDeleteRegistration(); + } + + public static void asyncDeleteRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + DeleteRegistrationRequest request = + DeleteRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = domainsClient.deleteRegistrationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_deleteregistration_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/AsyncDeleteRegistrationLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/AsyncDeleteRegistrationLRO.java new file mode 100644 index 00000000..e23af4cf --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/AsyncDeleteRegistrationLRO.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_deleteregistration_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1.DeleteRegistrationRequest; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.OperationMetadata; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.Empty; + +public class AsyncDeleteRegistrationLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteRegistrationLRO(); + } + + public static void asyncDeleteRegistrationLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + DeleteRegistrationRequest request = + DeleteRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + OperationFuture future = + domainsClient.deleteRegistrationOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_deleteregistration_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/SyncDeleteRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/SyncDeleteRegistration.java new file mode 100644 index 00000000..4b4f31d6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/SyncDeleteRegistration.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_deleteregistration_sync] +import com.google.cloud.domains.v1.DeleteRegistrationRequest; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncDeleteRegistration { + + public static void main(String[] args) throws Exception { + syncDeleteRegistration(); + } + + public static void syncDeleteRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + DeleteRegistrationRequest request = + DeleteRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + domainsClient.deleteRegistrationAsync(request).get(); + } + } +} +// [END domains_v1_generated_domainsclient_deleteregistration_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/SyncDeleteRegistrationRegistrationname.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/SyncDeleteRegistrationRegistrationname.java new file mode 100644 index 00000000..030082ee --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/SyncDeleteRegistrationRegistrationname.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_deleteregistration_registrationname_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncDeleteRegistrationRegistrationname { + + public static void main(String[] args) throws Exception { + syncDeleteRegistrationRegistrationname(); + } + + public static void syncDeleteRegistrationRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + domainsClient.deleteRegistrationAsync(name).get(); + } + } +} +// [END domains_v1_generated_domainsclient_deleteregistration_registrationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/SyncDeleteRegistrationString.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/SyncDeleteRegistrationString.java new file mode 100644 index 00000000..a7024f1b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/SyncDeleteRegistrationString.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_deleteregistration_string_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncDeleteRegistrationString { + + public static void main(String[] args) throws Exception { + syncDeleteRegistrationString(); + } + + public static void syncDeleteRegistrationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + domainsClient.deleteRegistrationAsync(name).get(); + } + } +} +// [END domains_v1_generated_domainsclient_deleteregistration_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/AsyncExportRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/AsyncExportRegistration.java new file mode 100644 index 00000000..3f46f2e2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/AsyncExportRegistration.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_exportregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.ExportRegistrationRequest; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.longrunning.Operation; + +public class AsyncExportRegistration { + + public static void main(String[] args) throws Exception { + asyncExportRegistration(); + } + + public static void asyncExportRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ExportRegistrationRequest request = + ExportRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = domainsClient.exportRegistrationCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_exportregistration_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/AsyncExportRegistrationLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/AsyncExportRegistrationLRO.java new file mode 100644 index 00000000..8d026fb5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/AsyncExportRegistrationLRO.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_exportregistration_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.ExportRegistrationRequest; +import com.google.cloud.domains.v1.OperationMetadata; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; + +public class AsyncExportRegistrationLRO { + + public static void main(String[] args) throws Exception { + asyncExportRegistrationLRO(); + } + + public static void asyncExportRegistrationLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ExportRegistrationRequest request = + ExportRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + OperationFuture future = + domainsClient.exportRegistrationOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_exportregistration_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/SyncExportRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/SyncExportRegistration.java new file mode 100644 index 00000000..56feaeec --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/SyncExportRegistration.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_exportregistration_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.ExportRegistrationRequest; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncExportRegistration { + + public static void main(String[] args) throws Exception { + syncExportRegistration(); + } + + public static void syncExportRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ExportRegistrationRequest request = + ExportRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + Registration response = domainsClient.exportRegistrationAsync(request).get(); + } + } +} +// [END domains_v1_generated_domainsclient_exportregistration_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/SyncExportRegistrationRegistrationname.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/SyncExportRegistrationRegistrationname.java new file mode 100644 index 00000000..8d2f1fa2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/SyncExportRegistrationRegistrationname.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_exportregistration_registrationname_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncExportRegistrationRegistrationname { + + public static void main(String[] args) throws Exception { + syncExportRegistrationRegistrationname(); + } + + public static void syncExportRegistrationRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + Registration response = domainsClient.exportRegistrationAsync(name).get(); + } + } +} +// [END domains_v1_generated_domainsclient_exportregistration_registrationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/SyncExportRegistrationString.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/SyncExportRegistrationString.java new file mode 100644 index 00000000..26c1b6d1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/SyncExportRegistrationString.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_exportregistration_string_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncExportRegistrationString { + + public static void main(String[] args) throws Exception { + syncExportRegistrationString(); + } + + public static void syncExportRegistrationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + Registration response = domainsClient.exportRegistrationAsync(name).get(); + } + } +} +// [END domains_v1_generated_domainsclient_exportregistration_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/AsyncGetRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/AsyncGetRegistration.java new file mode 100644 index 00000000..03f07c15 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/AsyncGetRegistration.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_getregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.GetRegistrationRequest; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; + +public class AsyncGetRegistration { + + public static void main(String[] args) throws Exception { + asyncGetRegistration(); + } + + public static void asyncGetRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + GetRegistrationRequest request = + GetRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = domainsClient.getRegistrationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_getregistration_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/SyncGetRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/SyncGetRegistration.java new file mode 100644 index 00000000..338ac9db --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/SyncGetRegistration.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_getregistration_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.GetRegistrationRequest; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncGetRegistration { + + public static void main(String[] args) throws Exception { + syncGetRegistration(); + } + + public static void syncGetRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + GetRegistrationRequest request = + GetRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + Registration response = domainsClient.getRegistration(request); + } + } +} +// [END domains_v1_generated_domainsclient_getregistration_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/SyncGetRegistrationRegistrationname.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/SyncGetRegistrationRegistrationname.java new file mode 100644 index 00000000..6def43de --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/SyncGetRegistrationRegistrationname.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_getregistration_registrationname_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncGetRegistrationRegistrationname { + + public static void main(String[] args) throws Exception { + syncGetRegistrationRegistrationname(); + } + + public static void syncGetRegistrationRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + Registration response = domainsClient.getRegistration(name); + } + } +} +// [END domains_v1_generated_domainsclient_getregistration_registrationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/SyncGetRegistrationString.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/SyncGetRegistrationString.java new file mode 100644 index 00000000..827e9d97 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/SyncGetRegistrationString.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_getregistration_string_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncGetRegistrationString { + + public static void main(String[] args) throws Exception { + syncGetRegistrationString(); + } + + public static void syncGetRegistrationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + Registration response = domainsClient.getRegistration(name); + } + } +} +// [END domains_v1_generated_domainsclient_getregistration_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/AsyncListRegistrations.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/AsyncListRegistrations.java new file mode 100644 index 00000000..77986691 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/AsyncListRegistrations.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_listregistrations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.ListRegistrationsRequest; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.Registration; + +public class AsyncListRegistrations { + + public static void main(String[] args) throws Exception { + asyncListRegistrations(); + } + + public static void asyncListRegistrations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ListRegistrationsRequest request = + ListRegistrationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + domainsClient.listRegistrationsPagedCallable().futureCall(request); + // Do something. + for (Registration element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1_generated_domainsclient_listregistrations_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/AsyncListRegistrationsPaged.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/AsyncListRegistrationsPaged.java new file mode 100644 index 00000000..31ac7fa1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/AsyncListRegistrationsPaged.java @@ -0,0 +1,60 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_listregistrations_paged_async] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.ListRegistrationsRequest; +import com.google.cloud.domains.v1.ListRegistrationsResponse; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.Registration; +import com.google.common.base.Strings; + +public class AsyncListRegistrationsPaged { + + public static void main(String[] args) throws Exception { + asyncListRegistrationsPaged(); + } + + public static void asyncListRegistrationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ListRegistrationsRequest request = + ListRegistrationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + ListRegistrationsResponse response = + domainsClient.listRegistrationsCallable().call(request); + for (Registration element : response.getRegistrationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END domains_v1_generated_domainsclient_listregistrations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/SyncListRegistrations.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/SyncListRegistrations.java new file mode 100644 index 00000000..59c217c9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/SyncListRegistrations.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_listregistrations_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.ListRegistrationsRequest; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.Registration; + +public class SyncListRegistrations { + + public static void main(String[] args) throws Exception { + syncListRegistrations(); + } + + public static void syncListRegistrations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ListRegistrationsRequest request = + ListRegistrationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (Registration element : domainsClient.listRegistrations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1_generated_domainsclient_listregistrations_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/SyncListRegistrationsLocationname.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/SyncListRegistrationsLocationname.java new file mode 100644 index 00000000..218f1788 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/SyncListRegistrationsLocationname.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_listregistrations_locationname_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.Registration; + +public class SyncListRegistrationsLocationname { + + public static void main(String[] args) throws Exception { + syncListRegistrationsLocationname(); + } + + public static void syncListRegistrationsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Registration element : domainsClient.listRegistrations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1_generated_domainsclient_listregistrations_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/SyncListRegistrationsString.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/SyncListRegistrationsString.java new file mode 100644 index 00000000..26f1165d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/SyncListRegistrationsString.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_listregistrations_string_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.Registration; + +public class SyncListRegistrationsString { + + public static void main(String[] args) throws Exception { + syncListRegistrationsString(); + } + + public static void syncListRegistrationsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Registration element : domainsClient.listRegistrations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1_generated_domainsclient_listregistrations_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/AsyncRegisterDomain.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/AsyncRegisterDomain.java new file mode 100644 index 00000000..8babc11c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/AsyncRegisterDomain.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_registerdomain_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.ContactNotice; +import com.google.cloud.domains.v1.DomainNotice; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.RegisterDomainRequest; +import com.google.cloud.domains.v1.Registration; +import com.google.longrunning.Operation; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncRegisterDomain { + + public static void main(String[] args) throws Exception { + asyncRegisterDomain(); + } + + public static void asyncRegisterDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegisterDomainRequest request = + RegisterDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllDomainNotices(new ArrayList()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setValidateOnly(true) + .build(); + ApiFuture future = domainsClient.registerDomainCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_registerdomain_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/AsyncRegisterDomainLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/AsyncRegisterDomainLRO.java new file mode 100644 index 00000000..975a6035 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/AsyncRegisterDomainLRO.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_registerdomain_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1.ContactNotice; +import com.google.cloud.domains.v1.DomainNotice; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.OperationMetadata; +import com.google.cloud.domains.v1.RegisterDomainRequest; +import com.google.cloud.domains.v1.Registration; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncRegisterDomainLRO { + + public static void main(String[] args) throws Exception { + asyncRegisterDomainLRO(); + } + + public static void asyncRegisterDomainLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegisterDomainRequest request = + RegisterDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllDomainNotices(new ArrayList()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.registerDomainOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_registerdomain_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/SyncRegisterDomain.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/SyncRegisterDomain.java new file mode 100644 index 00000000..b5235ccd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/SyncRegisterDomain.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_registerdomain_sync] +import com.google.cloud.domains.v1.ContactNotice; +import com.google.cloud.domains.v1.DomainNotice; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.RegisterDomainRequest; +import com.google.cloud.domains.v1.Registration; +import com.google.type.Money; +import java.util.ArrayList; + +public class SyncRegisterDomain { + + public static void main(String[] args) throws Exception { + syncRegisterDomain(); + } + + public static void syncRegisterDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegisterDomainRequest request = + RegisterDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllDomainNotices(new ArrayList()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.registerDomainAsync(request).get(); + } + } +} +// [END domains_v1_generated_domainsclient_registerdomain_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/SyncRegisterDomainLocationnameRegistrationMoney.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/SyncRegisterDomainLocationnameRegistrationMoney.java new file mode 100644 index 00000000..7fd9c770 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/SyncRegisterDomainLocationnameRegistrationMoney.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_registerdomain_locationnameregistrationmoney_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.Registration; +import com.google.type.Money; + +public class SyncRegisterDomainLocationnameRegistrationMoney { + + public static void main(String[] args) throws Exception { + syncRegisterDomainLocationnameRegistrationMoney(); + } + + public static void syncRegisterDomainLocationnameRegistrationMoney() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + Registration response = + domainsClient.registerDomainAsync(parent, registration, yearlyPrice).get(); + } + } +} +// [END domains_v1_generated_domainsclient_registerdomain_locationnameregistrationmoney_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/SyncRegisterDomainStringRegistrationMoney.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/SyncRegisterDomainStringRegistrationMoney.java new file mode 100644 index 00000000..2e6020c5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/SyncRegisterDomainStringRegistrationMoney.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_registerdomain_stringregistrationmoney_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.Registration; +import com.google.type.Money; + +public class SyncRegisterDomainStringRegistrationMoney { + + public static void main(String[] args) throws Exception { + syncRegisterDomainStringRegistrationMoney(); + } + + public static void syncRegisterDomainStringRegistrationMoney() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + Registration response = + domainsClient.registerDomainAsync(parent, registration, yearlyPrice).get(); + } + } +} +// [END domains_v1_generated_domainsclient_registerdomain_stringregistrationmoney_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/AsyncResetAuthorizationCode.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/AsyncResetAuthorizationCode.java new file mode 100644 index 00000000..14bb3c7a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/AsyncResetAuthorizationCode.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_resetauthorizationcode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.cloud.domains.v1.ResetAuthorizationCodeRequest; + +public class AsyncResetAuthorizationCode { + + public static void main(String[] args) throws Exception { + asyncResetAuthorizationCode(); + } + + public static void asyncResetAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ResetAuthorizationCodeRequest request = + ResetAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = + domainsClient.resetAuthorizationCodeCallable().futureCall(request); + // Do something. + AuthorizationCode response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_resetauthorizationcode_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCode.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCode.java new file mode 100644 index 00000000..7036976a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCode.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_resetauthorizationcode_sync] +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.cloud.domains.v1.ResetAuthorizationCodeRequest; + +public class SyncResetAuthorizationCode { + + public static void main(String[] args) throws Exception { + syncResetAuthorizationCode(); + } + + public static void syncResetAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ResetAuthorizationCodeRequest request = + ResetAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + AuthorizationCode response = domainsClient.resetAuthorizationCode(request); + } + } +} +// [END domains_v1_generated_domainsclient_resetauthorizationcode_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeRegistrationname.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeRegistrationname.java new file mode 100644 index 00000000..160146cd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeRegistrationname.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_resetauthorizationcode_registrationname_sync] +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncResetAuthorizationCodeRegistrationname { + + public static void main(String[] args) throws Exception { + syncResetAuthorizationCodeRegistrationname(); + } + + public static void syncResetAuthorizationCodeRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + AuthorizationCode response = domainsClient.resetAuthorizationCode(registration); + } + } +} +// [END domains_v1_generated_domainsclient_resetauthorizationcode_registrationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeString.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeString.java new file mode 100644 index 00000000..d00cd1af --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeString.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_resetauthorizationcode_string_sync] +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncResetAuthorizationCodeString { + + public static void main(String[] args) throws Exception { + syncResetAuthorizationCodeString(); + } + + public static void syncResetAuthorizationCodeString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + AuthorizationCode response = domainsClient.resetAuthorizationCode(registration); + } + } +} +// [END domains_v1_generated_domainsclient_resetauthorizationcode_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/AsyncRetrieveAuthorizationCode.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/AsyncRetrieveAuthorizationCode.java new file mode 100644 index 00000000..8ce56ced --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/AsyncRetrieveAuthorizationCode.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrieveauthorizationcode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.cloud.domains.v1.RetrieveAuthorizationCodeRequest; + +public class AsyncRetrieveAuthorizationCode { + + public static void main(String[] args) throws Exception { + asyncRetrieveAuthorizationCode(); + } + + public static void asyncRetrieveAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveAuthorizationCodeRequest request = + RetrieveAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = + domainsClient.retrieveAuthorizationCodeCallable().futureCall(request); + // Do something. + AuthorizationCode response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_retrieveauthorizationcode_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCode.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCode.java new file mode 100644 index 00000000..5a36970d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCode.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrieveauthorizationcode_sync] +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.cloud.domains.v1.RetrieveAuthorizationCodeRequest; + +public class SyncRetrieveAuthorizationCode { + + public static void main(String[] args) throws Exception { + syncRetrieveAuthorizationCode(); + } + + public static void syncRetrieveAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveAuthorizationCodeRequest request = + RetrieveAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + AuthorizationCode response = domainsClient.retrieveAuthorizationCode(request); + } + } +} +// [END domains_v1_generated_domainsclient_retrieveauthorizationcode_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeRegistrationname.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeRegistrationname.java new file mode 100644 index 00000000..baa896ad --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeRegistrationname.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrieveauthorizationcode_registrationname_sync] +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncRetrieveAuthorizationCodeRegistrationname { + + public static void main(String[] args) throws Exception { + syncRetrieveAuthorizationCodeRegistrationname(); + } + + public static void syncRetrieveAuthorizationCodeRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + AuthorizationCode response = domainsClient.retrieveAuthorizationCode(registration); + } + } +} +// [END domains_v1_generated_domainsclient_retrieveauthorizationcode_registrationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeString.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeString.java new file mode 100644 index 00000000..b6529c76 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeString.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrieveauthorizationcode_string_sync] +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncRetrieveAuthorizationCodeString { + + public static void main(String[] args) throws Exception { + syncRetrieveAuthorizationCodeString(); + } + + public static void syncRetrieveAuthorizationCodeString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + AuthorizationCode response = domainsClient.retrieveAuthorizationCode(registration); + } + } +} +// [END domains_v1_generated_domainsclient_retrieveauthorizationcode_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/AsyncRetrieveRegisterParameters.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/AsyncRetrieveRegisterParameters.java new file mode 100644 index 00000000..ec70b256 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/AsyncRetrieveRegisterParameters.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrieveregisterparameters_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.RetrieveRegisterParametersRequest; +import com.google.cloud.domains.v1.RetrieveRegisterParametersResponse; + +public class AsyncRetrieveRegisterParameters { + + public static void main(String[] args) throws Exception { + asyncRetrieveRegisterParameters(); + } + + public static void asyncRetrieveRegisterParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveRegisterParametersRequest request = + RetrieveRegisterParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + domainsClient.retrieveRegisterParametersCallable().futureCall(request); + // Do something. + RetrieveRegisterParametersResponse response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_retrieveregisterparameters_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParameters.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParameters.java new file mode 100644 index 00000000..97814895 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParameters.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrieveregisterparameters_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.RetrieveRegisterParametersRequest; +import com.google.cloud.domains.v1.RetrieveRegisterParametersResponse; + +public class SyncRetrieveRegisterParameters { + + public static void main(String[] args) throws Exception { + syncRetrieveRegisterParameters(); + } + + public static void syncRetrieveRegisterParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveRegisterParametersRequest request = + RetrieveRegisterParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + RetrieveRegisterParametersResponse response = + domainsClient.retrieveRegisterParameters(request); + } + } +} +// [END domains_v1_generated_domainsclient_retrieveregisterparameters_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersLocationnameString.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersLocationnameString.java new file mode 100644 index 00000000..6bf60ed1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersLocationnameString.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrieveregisterparameters_locationnamestring_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.RetrieveRegisterParametersResponse; + +public class SyncRetrieveRegisterParametersLocationnameString { + + public static void main(String[] args) throws Exception { + syncRetrieveRegisterParametersLocationnameString(); + } + + public static void syncRetrieveRegisterParametersLocationnameString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + RetrieveRegisterParametersResponse response = + domainsClient.retrieveRegisterParameters(location, domainName); + } + } +} +// [END domains_v1_generated_domainsclient_retrieveregisterparameters_locationnamestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersStringString.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersStringString.java new file mode 100644 index 00000000..a152f438 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersStringString.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrieveregisterparameters_stringstring_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.RetrieveRegisterParametersResponse; + +public class SyncRetrieveRegisterParametersStringString { + + public static void main(String[] args) throws Exception { + syncRetrieveRegisterParametersStringString(); + } + + public static void syncRetrieveRegisterParametersStringString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + String domainName = "domainName-1244085905"; + RetrieveRegisterParametersResponse response = + domainsClient.retrieveRegisterParameters(location, domainName); + } + } +} +// [END domains_v1_generated_domainsclient_retrieveregisterparameters_stringstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/AsyncRetrieveTransferParameters.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/AsyncRetrieveTransferParameters.java new file mode 100644 index 00000000..01b3087a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/AsyncRetrieveTransferParameters.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrievetransferparameters_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.RetrieveTransferParametersRequest; +import com.google.cloud.domains.v1.RetrieveTransferParametersResponse; + +public class AsyncRetrieveTransferParameters { + + public static void main(String[] args) throws Exception { + asyncRetrieveTransferParameters(); + } + + public static void asyncRetrieveTransferParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveTransferParametersRequest request = + RetrieveTransferParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + domainsClient.retrieveTransferParametersCallable().futureCall(request); + // Do something. + RetrieveTransferParametersResponse response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_retrievetransferparameters_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParameters.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParameters.java new file mode 100644 index 00000000..ae357a28 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParameters.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrievetransferparameters_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.RetrieveTransferParametersRequest; +import com.google.cloud.domains.v1.RetrieveTransferParametersResponse; + +public class SyncRetrieveTransferParameters { + + public static void main(String[] args) throws Exception { + syncRetrieveTransferParameters(); + } + + public static void syncRetrieveTransferParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveTransferParametersRequest request = + RetrieveTransferParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + RetrieveTransferParametersResponse response = + domainsClient.retrieveTransferParameters(request); + } + } +} +// [END domains_v1_generated_domainsclient_retrievetransferparameters_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersLocationnameString.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersLocationnameString.java new file mode 100644 index 00000000..f190f175 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersLocationnameString.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrievetransferparameters_locationnamestring_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.RetrieveTransferParametersResponse; + +public class SyncRetrieveTransferParametersLocationnameString { + + public static void main(String[] args) throws Exception { + syncRetrieveTransferParametersLocationnameString(); + } + + public static void syncRetrieveTransferParametersLocationnameString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + RetrieveTransferParametersResponse response = + domainsClient.retrieveTransferParameters(location, domainName); + } + } +} +// [END domains_v1_generated_domainsclient_retrievetransferparameters_locationnamestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersStringString.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersStringString.java new file mode 100644 index 00000000..8d647c32 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersStringString.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrievetransferparameters_stringstring_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.RetrieveTransferParametersResponse; + +public class SyncRetrieveTransferParametersStringString { + + public static void main(String[] args) throws Exception { + syncRetrieveTransferParametersStringString(); + } + + public static void syncRetrieveTransferParametersStringString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + String domainName = "domainName-1244085905"; + RetrieveTransferParametersResponse response = + domainsClient.retrieveTransferParameters(location, domainName); + } + } +} +// [END domains_v1_generated_domainsclient_retrievetransferparameters_stringstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/AsyncSearchDomains.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/AsyncSearchDomains.java new file mode 100644 index 00000000..be6ae036 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/AsyncSearchDomains.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_searchdomains_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.SearchDomainsRequest; +import com.google.cloud.domains.v1.SearchDomainsResponse; + +public class AsyncSearchDomains { + + public static void main(String[] args) throws Exception { + asyncSearchDomains(); + } + + public static void asyncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + SearchDomainsRequest request = + SearchDomainsRequest.newBuilder() + .setQuery("query107944136") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + domainsClient.searchDomainsCallable().futureCall(request); + // Do something. + SearchDomainsResponse response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_searchdomains_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/SyncSearchDomains.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/SyncSearchDomains.java new file mode 100644 index 00000000..83cf4965 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/SyncSearchDomains.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_searchdomains_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.SearchDomainsRequest; +import com.google.cloud.domains.v1.SearchDomainsResponse; + +public class SyncSearchDomains { + + public static void main(String[] args) throws Exception { + syncSearchDomains(); + } + + public static void syncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + SearchDomainsRequest request = + SearchDomainsRequest.newBuilder() + .setQuery("query107944136") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + SearchDomainsResponse response = domainsClient.searchDomains(request); + } + } +} +// [END domains_v1_generated_domainsclient_searchdomains_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/SyncSearchDomainsLocationnameString.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/SyncSearchDomainsLocationnameString.java new file mode 100644 index 00000000..3a2cbe10 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/SyncSearchDomainsLocationnameString.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_searchdomains_locationnamestring_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.SearchDomainsResponse; + +public class SyncSearchDomainsLocationnameString { + + public static void main(String[] args) throws Exception { + syncSearchDomainsLocationnameString(); + } + + public static void syncSearchDomainsLocationnameString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String query = "query107944136"; + SearchDomainsResponse response = domainsClient.searchDomains(location, query); + } + } +} +// [END domains_v1_generated_domainsclient_searchdomains_locationnamestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/SyncSearchDomainsStringString.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/SyncSearchDomainsStringString.java new file mode 100644 index 00000000..d8daab9c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/SyncSearchDomainsStringString.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_searchdomains_stringstring_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.SearchDomainsResponse; + +public class SyncSearchDomainsStringString { + + public static void main(String[] args) throws Exception { + syncSearchDomainsStringString(); + } + + public static void syncSearchDomainsStringString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + String query = "query107944136"; + SearchDomainsResponse response = domainsClient.searchDomains(location, query); + } + } +} +// [END domains_v1_generated_domainsclient_searchdomains_stringstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/AsyncTransferDomain.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/AsyncTransferDomain.java new file mode 100644 index 00000000..89a54979 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/AsyncTransferDomain.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_transferdomain_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.ContactNotice; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.TransferDomainRequest; +import com.google.longrunning.Operation; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncTransferDomain { + + public static void main(String[] args) throws Exception { + asyncTransferDomain(); + } + + public static void asyncTransferDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + TransferDomainRequest request = + TransferDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setAuthorizationCode(AuthorizationCode.newBuilder().build()) + .setValidateOnly(true) + .build(); + ApiFuture future = domainsClient.transferDomainCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_transferdomain_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/AsyncTransferDomainLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/AsyncTransferDomainLRO.java new file mode 100644 index 00000000..205ba321 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/AsyncTransferDomainLRO.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_transferdomain_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.ContactNotice; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.OperationMetadata; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.TransferDomainRequest; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncTransferDomainLRO { + + public static void main(String[] args) throws Exception { + asyncTransferDomainLRO(); + } + + public static void asyncTransferDomainLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + TransferDomainRequest request = + TransferDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setAuthorizationCode(AuthorizationCode.newBuilder().build()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.transferDomainOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_transferdomain_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/SyncTransferDomain.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/SyncTransferDomain.java new file mode 100644 index 00000000..4895e760 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/SyncTransferDomain.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_transferdomain_sync] +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.ContactNotice; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.TransferDomainRequest; +import com.google.type.Money; +import java.util.ArrayList; + +public class SyncTransferDomain { + + public static void main(String[] args) throws Exception { + syncTransferDomain(); + } + + public static void syncTransferDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + TransferDomainRequest request = + TransferDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setAuthorizationCode(AuthorizationCode.newBuilder().build()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.transferDomainAsync(request).get(); + } + } +} +// [END domains_v1_generated_domainsclient_transferdomain_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode.java new file mode 100644 index 00000000..d96b4b96 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode.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.domains.v1.samples; + +// [START +// domains_v1_generated_domainsclient_transferdomain_locationnameregistrationmoneyauthorizationcode_sync] +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.Registration; +import com.google.type.Money; + +public class SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode { + + public static void main(String[] args) throws Exception { + syncTransferDomainLocationnameRegistrationMoneyAuthorizationcode(); + } + + public static void syncTransferDomainLocationnameRegistrationMoneyAuthorizationcode() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + Registration response = + domainsClient + .transferDomainAsync(parent, registration, yearlyPrice, authorizationCode) + .get(); + } + } +} +// [END +// domains_v1_generated_domainsclient_transferdomain_locationnameregistrationmoneyauthorizationcode_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/SyncTransferDomainStringRegistrationMoneyAuthorizationcode.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/SyncTransferDomainStringRegistrationMoneyAuthorizationcode.java new file mode 100644 index 00000000..37a6bc88 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/SyncTransferDomainStringRegistrationMoneyAuthorizationcode.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.domains.v1.samples; + +// [START +// domains_v1_generated_domainsclient_transferdomain_stringregistrationmoneyauthorizationcode_sync] +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.Registration; +import com.google.type.Money; + +public class SyncTransferDomainStringRegistrationMoneyAuthorizationcode { + + public static void main(String[] args) throws Exception { + syncTransferDomainStringRegistrationMoneyAuthorizationcode(); + } + + public static void syncTransferDomainStringRegistrationMoneyAuthorizationcode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + Registration response = + domainsClient + .transferDomainAsync(parent, registration, yearlyPrice, authorizationCode) + .get(); + } + } +} +// [END +// domains_v1_generated_domainsclient_transferdomain_stringregistrationmoneyauthorizationcode_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/AsyncUpdateRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/AsyncUpdateRegistration.java new file mode 100644 index 00000000..d6c189df --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/AsyncUpdateRegistration.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_updateregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.UpdateRegistrationRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateRegistration { + + public static void main(String[] args) throws Exception { + asyncUpdateRegistration(); + } + + public static void asyncUpdateRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + UpdateRegistrationRequest request = + UpdateRegistrationRequest.newBuilder() + .setRegistration(Registration.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = domainsClient.updateRegistrationCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_updateregistration_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/AsyncUpdateRegistrationLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/AsyncUpdateRegistrationLRO.java new file mode 100644 index 00000000..3beaaaaf --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/AsyncUpdateRegistrationLRO.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_updateregistration_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.OperationMetadata; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.UpdateRegistrationRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateRegistrationLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateRegistrationLRO(); + } + + public static void asyncUpdateRegistrationLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + UpdateRegistrationRequest request = + UpdateRegistrationRequest.newBuilder() + .setRegistration(Registration.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + domainsClient.updateRegistrationOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_updateregistration_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/SyncUpdateRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/SyncUpdateRegistration.java new file mode 100644 index 00000000..27ef1a02 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/SyncUpdateRegistration.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_updateregistration_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.UpdateRegistrationRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateRegistration { + + public static void main(String[] args) throws Exception { + syncUpdateRegistration(); + } + + public static void syncUpdateRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + UpdateRegistrationRequest request = + UpdateRegistrationRequest.newBuilder() + .setRegistration(Registration.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Registration response = domainsClient.updateRegistrationAsync(request).get(); + } + } +} +// [END domains_v1_generated_domainsclient_updateregistration_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/SyncUpdateRegistrationRegistrationFieldmask.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/SyncUpdateRegistrationRegistrationFieldmask.java new file mode 100644 index 00000000..f786aa7c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/SyncUpdateRegistrationRegistrationFieldmask.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.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_updateregistration_registrationfieldmask_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.protobuf.FieldMask; + +public class SyncUpdateRegistrationRegistrationFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateRegistrationRegistrationFieldmask(); + } + + public static void syncUpdateRegistrationRegistrationFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + Registration registration = Registration.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = domainsClient.updateRegistrationAsync(registration, updateMask).get(); + } + } +} +// [END domains_v1_generated_domainsclient_updateregistration_registrationfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/domainssettings/searchdomains/SyncSearchDomains.java b/samples/snippets/generated/com/google/cloud/domains/v1/domainssettings/searchdomains/SyncSearchDomains.java new file mode 100644 index 00000000..0f7809a5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/domainssettings/searchdomains/SyncSearchDomains.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.domains.v1.samples; + +// [START domains_v1_generated_domainssettings_searchdomains_sync] +import com.google.cloud.domains.v1.DomainsSettings; +import java.time.Duration; + +public class SyncSearchDomains { + + public static void main(String[] args) throws Exception { + syncSearchDomains(); + } + + public static void syncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DomainsSettings.Builder domainsSettingsBuilder = DomainsSettings.newBuilder(); + domainsSettingsBuilder + .searchDomainsSettings() + .setRetrySettings( + domainsSettingsBuilder + .searchDomainsSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + DomainsSettings domainsSettings = domainsSettingsBuilder.build(); + } +} +// [END domains_v1_generated_domainssettings_searchdomains_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1/stub/domainsstubsettings/searchdomains/SyncSearchDomains.java b/samples/snippets/generated/com/google/cloud/domains/v1/stub/domainsstubsettings/searchdomains/SyncSearchDomains.java new file mode 100644 index 00000000..dcff2c42 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1/stub/domainsstubsettings/searchdomains/SyncSearchDomains.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.domains.v1.stub.samples; + +// [START domains_v1_generated_domainsstubsettings_searchdomains_sync] +import com.google.cloud.domains.v1.stub.DomainsStubSettings; +import java.time.Duration; + +public class SyncSearchDomains { + + public static void main(String[] args) throws Exception { + syncSearchDomains(); + } + + public static void syncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DomainsStubSettings.Builder domainsSettingsBuilder = DomainsStubSettings.newBuilder(); + domainsSettingsBuilder + .searchDomainsSettings() + .setRetrySettings( + domainsSettingsBuilder + .searchDomainsSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + DomainsStubSettings domainsSettings = domainsSettingsBuilder.build(); + } +} +// [END domains_v1_generated_domainsstubsettings_searchdomains_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/AsyncConfigureContactSettings.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/AsyncConfigureContactSettings.java new file mode 100644 index 00000000..8b1eedcc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/AsyncConfigureContactSettings.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_configurecontactsettings_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1alpha2.ContactNotice; +import com.google.cloud.domains.v1alpha2.ContactSettings; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class AsyncConfigureContactSettings { + + public static void main(String[] args) throws Exception { + asyncConfigureContactSettings(); + } + + public static void asyncConfigureContactSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureContactSettingsRequest request = + ConfigureContactSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setValidateOnly(true) + .build(); + ApiFuture future = + domainsClient.configureContactSettingsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_configurecontactsettings_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/AsyncConfigureContactSettingsLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/AsyncConfigureContactSettingsLRO.java new file mode 100644 index 00000000..c340f90c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/AsyncConfigureContactSettingsLRO.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_configurecontactsettings_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1alpha2.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1alpha2.ContactNotice; +import com.google.cloud.domains.v1alpha2.ContactSettings; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.OperationMetadata; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class AsyncConfigureContactSettingsLRO { + + public static void main(String[] args) throws Exception { + asyncConfigureContactSettingsLRO(); + } + + public static void asyncConfigureContactSettingsLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureContactSettingsRequest request = + ConfigureContactSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.configureContactSettingsOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_configurecontactsettings_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/SyncConfigureContactSettings.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/SyncConfigureContactSettings.java new file mode 100644 index 00000000..2b670547 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/SyncConfigureContactSettings.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_configurecontactsettings_sync] +import com.google.cloud.domains.v1alpha2.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1alpha2.ContactNotice; +import com.google.cloud.domains.v1alpha2.ContactSettings; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class SyncConfigureContactSettings { + + public static void main(String[] args) throws Exception { + syncConfigureContactSettings(); + } + + public static void syncConfigureContactSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureContactSettingsRequest request = + ConfigureContactSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.configureContactSettingsAsync(request).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_configurecontactsettings_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask.java new file mode 100644 index 00000000..47cff401 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask.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.domains.v1alpha2.samples; + +// [START +// domains_v1alpha2_generated_domainsclient_configurecontactsettings_registrationnamecontactsettingsfieldmask_sync] +import com.google.cloud.domains.v1alpha2.ContactSettings; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureContactSettingsRegistrationnameContactsettingsFieldmask(); + } + + public static void syncConfigureContactSettingsRegistrationnameContactsettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureContactSettingsAsync(registration, contactSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1alpha2_generated_domainsclient_configurecontactsettings_registrationnamecontactsettingsfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/SyncConfigureContactSettingsStringContactsettingsFieldmask.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/SyncConfigureContactSettingsStringContactsettingsFieldmask.java new file mode 100644 index 00000000..528aa19d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/SyncConfigureContactSettingsStringContactsettingsFieldmask.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.domains.v1alpha2.samples; + +// [START +// domains_v1alpha2_generated_domainsclient_configurecontactsettings_stringcontactsettingsfieldmask_sync] +import com.google.cloud.domains.v1alpha2.ContactSettings; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureContactSettingsStringContactsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureContactSettingsStringContactsettingsFieldmask(); + } + + public static void syncConfigureContactSettingsStringContactsettingsFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureContactSettingsAsync(registration, contactSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1alpha2_generated_domainsclient_configurecontactsettings_stringcontactsettingsfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/AsyncConfigureDnsSettings.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/AsyncConfigureDnsSettings.java new file mode 100644 index 00000000..16b5839c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/AsyncConfigureDnsSettings.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_configurednssettings_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1alpha2.DnsSettings; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureDnsSettings { + + public static void main(String[] args) throws Exception { + asyncConfigureDnsSettings(); + } + + public static void asyncConfigureDnsSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureDnsSettingsRequest request = + ConfigureDnsSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + ApiFuture future = + domainsClient.configureDnsSettingsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_configurednssettings_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/AsyncConfigureDnsSettingsLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/AsyncConfigureDnsSettingsLRO.java new file mode 100644 index 00000000..7970165b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/AsyncConfigureDnsSettingsLRO.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_configurednssettings_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1alpha2.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1alpha2.DnsSettings; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.OperationMetadata; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureDnsSettingsLRO { + + public static void main(String[] args) throws Exception { + asyncConfigureDnsSettingsLRO(); + } + + public static void asyncConfigureDnsSettingsLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureDnsSettingsRequest request = + ConfigureDnsSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.configureDnsSettingsOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_configurednssettings_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/SyncConfigureDnsSettings.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/SyncConfigureDnsSettings.java new file mode 100644 index 00000000..dd6e3f36 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/SyncConfigureDnsSettings.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_configurednssettings_sync] +import com.google.cloud.domains.v1alpha2.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1alpha2.DnsSettings; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureDnsSettings { + + public static void main(String[] args) throws Exception { + syncConfigureDnsSettings(); + } + + public static void syncConfigureDnsSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureDnsSettingsRequest request = + ConfigureDnsSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.configureDnsSettingsAsync(request).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_configurednssettings_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask.java new file mode 100644 index 00000000..f6d76049 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask.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.domains.v1alpha2.samples; + +// [START +// domains_v1alpha2_generated_domainsclient_configurednssettings_registrationnamednssettingsfieldmask_sync] +import com.google.cloud.domains.v1alpha2.DnsSettings; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask(); + } + + public static void syncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + } + } +} +// [END +// domains_v1alpha2_generated_domainsclient_configurednssettings_registrationnamednssettingsfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/SyncConfigureDnsSettingsStringDnssettingsFieldmask.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/SyncConfigureDnsSettingsStringDnssettingsFieldmask.java new file mode 100644 index 00000000..76175c99 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/SyncConfigureDnsSettingsStringDnssettingsFieldmask.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.domains.v1alpha2.samples; + +// [START +// domains_v1alpha2_generated_domainsclient_configurednssettings_stringdnssettingsfieldmask_sync] +import com.google.cloud.domains.v1alpha2.DnsSettings; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureDnsSettingsStringDnssettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureDnsSettingsStringDnssettingsFieldmask(); + } + + public static void syncConfigureDnsSettingsStringDnssettingsFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + } + } +} +// [END +// domains_v1alpha2_generated_domainsclient_configurednssettings_stringdnssettingsfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettings.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettings.java new file mode 100644 index 00000000..fd61697a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettings.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_configuremanagementsettings_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.ManagementSettings; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureManagementSettings { + + public static void main(String[] args) throws Exception { + asyncConfigureManagementSettings(); + } + + public static void asyncConfigureManagementSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureManagementSettingsRequest request = + ConfigureManagementSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + domainsClient.configureManagementSettingsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_configuremanagementsettings_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettingsLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettingsLRO.java new file mode 100644 index 00000000..245584cf --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettingsLRO.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_configuremanagementsettings_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1alpha2.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.ManagementSettings; +import com.google.cloud.domains.v1alpha2.OperationMetadata; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureManagementSettingsLRO { + + public static void main(String[] args) throws Exception { + asyncConfigureManagementSettingsLRO(); + } + + public static void asyncConfigureManagementSettingsLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureManagementSettingsRequest request = + ConfigureManagementSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + domainsClient.configureManagementSettingsOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_configuremanagementsettings_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/SyncConfigureManagementSettings.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/SyncConfigureManagementSettings.java new file mode 100644 index 00000000..acf60bc3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/SyncConfigureManagementSettings.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_configuremanagementsettings_sync] +import com.google.cloud.domains.v1alpha2.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.ManagementSettings; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureManagementSettings { + + public static void main(String[] args) throws Exception { + syncConfigureManagementSettings(); + } + + public static void syncConfigureManagementSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureManagementSettingsRequest request = + ConfigureManagementSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Registration response = domainsClient.configureManagementSettingsAsync(request).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_configuremanagementsettings_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask.java new file mode 100644 index 00000000..a8e5c3e8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask.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.domains.v1alpha2.samples; + +// [START +// domains_v1alpha2_generated_domainsclient_configuremanagementsettings_registrationnamemanagementsettingsfieldmask_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.ManagementSettings; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask(); + } + + public static void syncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureManagementSettingsAsync(registration, managementSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1alpha2_generated_domainsclient_configuremanagementsettings_registrationnamemanagementsettingsfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsStringManagementsettingsFieldmask.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsStringManagementsettingsFieldmask.java new file mode 100644 index 00000000..ad5a6047 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsStringManagementsettingsFieldmask.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.domains.v1alpha2.samples; + +// [START +// domains_v1alpha2_generated_domainsclient_configuremanagementsettings_stringmanagementsettingsfieldmask_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.ManagementSettings; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureManagementSettingsStringManagementsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureManagementSettingsStringManagementsettingsFieldmask(); + } + + public static void syncConfigureManagementSettingsStringManagementsettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureManagementSettingsAsync(registration, managementSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1alpha2_generated_domainsclient_configuremanagementsettings_stringmanagementsettingsfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..5d88a7b8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.DomainsSettings; +import com.google.cloud.domains.v1alpha2.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. + DomainsSettings domainsSettings = + DomainsSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + DomainsClient domainsClient = DomainsClient.create(domainsSettings); + } +} +// [END domains_v1alpha2_generated_domainsclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000..56badec9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_create_setcredentialsprovider1_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.DomainsSettings; + +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. + DomainsSettings domainsSettings = + DomainsSettings.newBuilder() + .setTransportChannelProvider( + DomainsSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + DomainsClient domainsClient = DomainsClient.create(domainsSettings); + } +} +// [END domains_v1alpha2_generated_domainsclient_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..18480370 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,37 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_create_setendpoint_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.DomainsSettings; +import com.google.cloud.domains.v1alpha2.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. + DomainsSettings domainsSettings = DomainsSettings.newBuilder().setEndpoint(myEndpoint).build(); + DomainsClient domainsClient = DomainsClient.create(domainsSettings); + } +} +// [END domains_v1alpha2_generated_domainsclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/AsyncDeleteRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/AsyncDeleteRegistration.java new file mode 100644 index 00000000..739ff257 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/AsyncDeleteRegistration.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_deleteregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.DeleteRegistrationRequest; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.longrunning.Operation; + +public class AsyncDeleteRegistration { + + public static void main(String[] args) throws Exception { + asyncDeleteRegistration(); + } + + public static void asyncDeleteRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + DeleteRegistrationRequest request = + DeleteRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = domainsClient.deleteRegistrationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_deleteregistration_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/AsyncDeleteRegistrationLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/AsyncDeleteRegistrationLRO.java new file mode 100644 index 00000000..2c22798c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/AsyncDeleteRegistrationLRO.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_deleteregistration_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1alpha2.DeleteRegistrationRequest; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.OperationMetadata; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.Empty; + +public class AsyncDeleteRegistrationLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteRegistrationLRO(); + } + + public static void asyncDeleteRegistrationLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + DeleteRegistrationRequest request = + DeleteRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + OperationFuture future = + domainsClient.deleteRegistrationOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_deleteregistration_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/SyncDeleteRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/SyncDeleteRegistration.java new file mode 100644 index 00000000..606410b1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/SyncDeleteRegistration.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_deleteregistration_sync] +import com.google.cloud.domains.v1alpha2.DeleteRegistrationRequest; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncDeleteRegistration { + + public static void main(String[] args) throws Exception { + syncDeleteRegistration(); + } + + public static void syncDeleteRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + DeleteRegistrationRequest request = + DeleteRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + domainsClient.deleteRegistrationAsync(request).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_deleteregistration_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/SyncDeleteRegistrationRegistrationname.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/SyncDeleteRegistrationRegistrationname.java new file mode 100644 index 00000000..e203addf --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/SyncDeleteRegistrationRegistrationname.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_deleteregistration_registrationname_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncDeleteRegistrationRegistrationname { + + public static void main(String[] args) throws Exception { + syncDeleteRegistrationRegistrationname(); + } + + public static void syncDeleteRegistrationRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + domainsClient.deleteRegistrationAsync(name).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_deleteregistration_registrationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/SyncDeleteRegistrationString.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/SyncDeleteRegistrationString.java new file mode 100644 index 00000000..c98b6e15 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/SyncDeleteRegistrationString.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_deleteregistration_string_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncDeleteRegistrationString { + + public static void main(String[] args) throws Exception { + syncDeleteRegistrationString(); + } + + public static void syncDeleteRegistrationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + domainsClient.deleteRegistrationAsync(name).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_deleteregistration_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/AsyncExportRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/AsyncExportRegistration.java new file mode 100644 index 00000000..e8ded436 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/AsyncExportRegistration.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_exportregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.ExportRegistrationRequest; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.longrunning.Operation; + +public class AsyncExportRegistration { + + public static void main(String[] args) throws Exception { + asyncExportRegistration(); + } + + public static void asyncExportRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ExportRegistrationRequest request = + ExportRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = domainsClient.exportRegistrationCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_exportregistration_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/AsyncExportRegistrationLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/AsyncExportRegistrationLRO.java new file mode 100644 index 00000000..282f111b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/AsyncExportRegistrationLRO.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_exportregistration_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.ExportRegistrationRequest; +import com.google.cloud.domains.v1alpha2.OperationMetadata; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class AsyncExportRegistrationLRO { + + public static void main(String[] args) throws Exception { + asyncExportRegistrationLRO(); + } + + public static void asyncExportRegistrationLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ExportRegistrationRequest request = + ExportRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + OperationFuture future = + domainsClient.exportRegistrationOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_exportregistration_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/SyncExportRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/SyncExportRegistration.java new file mode 100644 index 00000000..d9d87dbc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/SyncExportRegistration.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_exportregistration_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.ExportRegistrationRequest; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncExportRegistration { + + public static void main(String[] args) throws Exception { + syncExportRegistration(); + } + + public static void syncExportRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ExportRegistrationRequest request = + ExportRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + Registration response = domainsClient.exportRegistrationAsync(request).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_exportregistration_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/SyncExportRegistrationRegistrationname.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/SyncExportRegistrationRegistrationname.java new file mode 100644 index 00000000..aac34fca --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/SyncExportRegistrationRegistrationname.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_exportregistration_registrationname_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncExportRegistrationRegistrationname { + + public static void main(String[] args) throws Exception { + syncExportRegistrationRegistrationname(); + } + + public static void syncExportRegistrationRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + Registration response = domainsClient.exportRegistrationAsync(name).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_exportregistration_registrationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/SyncExportRegistrationString.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/SyncExportRegistrationString.java new file mode 100644 index 00000000..03f31d58 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/SyncExportRegistrationString.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_exportregistration_string_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncExportRegistrationString { + + public static void main(String[] args) throws Exception { + syncExportRegistrationString(); + } + + public static void syncExportRegistrationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + Registration response = domainsClient.exportRegistrationAsync(name).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_exportregistration_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/AsyncGetRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/AsyncGetRegistration.java new file mode 100644 index 00000000..379e5a6a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/AsyncGetRegistration.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_getregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.GetRegistrationRequest; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class AsyncGetRegistration { + + public static void main(String[] args) throws Exception { + asyncGetRegistration(); + } + + public static void asyncGetRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + GetRegistrationRequest request = + GetRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = domainsClient.getRegistrationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_getregistration_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/SyncGetRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/SyncGetRegistration.java new file mode 100644 index 00000000..6c0c23fe --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/SyncGetRegistration.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_getregistration_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.GetRegistrationRequest; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncGetRegistration { + + public static void main(String[] args) throws Exception { + syncGetRegistration(); + } + + public static void syncGetRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + GetRegistrationRequest request = + GetRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + Registration response = domainsClient.getRegistration(request); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_getregistration_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/SyncGetRegistrationRegistrationname.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/SyncGetRegistrationRegistrationname.java new file mode 100644 index 00000000..83edf1d8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/SyncGetRegistrationRegistrationname.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_getregistration_registrationname_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncGetRegistrationRegistrationname { + + public static void main(String[] args) throws Exception { + syncGetRegistrationRegistrationname(); + } + + public static void syncGetRegistrationRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + Registration response = domainsClient.getRegistration(name); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_getregistration_registrationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/SyncGetRegistrationString.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/SyncGetRegistrationString.java new file mode 100644 index 00000000..3aa2fccc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/SyncGetRegistrationString.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_getregistration_string_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncGetRegistrationString { + + public static void main(String[] args) throws Exception { + syncGetRegistrationString(); + } + + public static void syncGetRegistrationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + Registration response = domainsClient.getRegistration(name); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_getregistration_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/AsyncListRegistrations.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/AsyncListRegistrations.java new file mode 100644 index 00000000..807fec1f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/AsyncListRegistrations.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_listregistrations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.ListRegistrationsRequest; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.Registration; + +public class AsyncListRegistrations { + + public static void main(String[] args) throws Exception { + asyncListRegistrations(); + } + + public static void asyncListRegistrations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ListRegistrationsRequest request = + ListRegistrationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + domainsClient.listRegistrationsPagedCallable().futureCall(request); + // Do something. + for (Registration element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1alpha2_generated_domainsclient_listregistrations_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/AsyncListRegistrationsPaged.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/AsyncListRegistrationsPaged.java new file mode 100644 index 00000000..34146e31 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/AsyncListRegistrationsPaged.java @@ -0,0 +1,60 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_listregistrations_paged_async] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.ListRegistrationsRequest; +import com.google.cloud.domains.v1alpha2.ListRegistrationsResponse; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.common.base.Strings; + +public class AsyncListRegistrationsPaged { + + public static void main(String[] args) throws Exception { + asyncListRegistrationsPaged(); + } + + public static void asyncListRegistrationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ListRegistrationsRequest request = + ListRegistrationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + ListRegistrationsResponse response = + domainsClient.listRegistrationsCallable().call(request); + for (Registration element : response.getRegistrationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END domains_v1alpha2_generated_domainsclient_listregistrations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/SyncListRegistrations.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/SyncListRegistrations.java new file mode 100644 index 00000000..526a98be --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/SyncListRegistrations.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_listregistrations_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.ListRegistrationsRequest; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.Registration; + +public class SyncListRegistrations { + + public static void main(String[] args) throws Exception { + syncListRegistrations(); + } + + public static void syncListRegistrations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ListRegistrationsRequest request = + ListRegistrationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (Registration element : domainsClient.listRegistrations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1alpha2_generated_domainsclient_listregistrations_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/SyncListRegistrationsLocationname.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/SyncListRegistrationsLocationname.java new file mode 100644 index 00000000..40bf83e5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/SyncListRegistrationsLocationname.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_listregistrations_locationname_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.Registration; + +public class SyncListRegistrationsLocationname { + + public static void main(String[] args) throws Exception { + syncListRegistrationsLocationname(); + } + + public static void syncListRegistrationsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Registration element : domainsClient.listRegistrations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1alpha2_generated_domainsclient_listregistrations_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/SyncListRegistrationsString.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/SyncListRegistrationsString.java new file mode 100644 index 00000000..d2a659a7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/SyncListRegistrationsString.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_listregistrations_string_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.Registration; + +public class SyncListRegistrationsString { + + public static void main(String[] args) throws Exception { + syncListRegistrationsString(); + } + + public static void syncListRegistrationsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Registration element : domainsClient.listRegistrations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1alpha2_generated_domainsclient_listregistrations_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/AsyncRegisterDomain.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/AsyncRegisterDomain.java new file mode 100644 index 00000000..b7506a7f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/AsyncRegisterDomain.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_registerdomain_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.ContactNotice; +import com.google.cloud.domains.v1alpha2.DomainNotice; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.RegisterDomainRequest; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.longrunning.Operation; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncRegisterDomain { + + public static void main(String[] args) throws Exception { + asyncRegisterDomain(); + } + + public static void asyncRegisterDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegisterDomainRequest request = + RegisterDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllDomainNotices(new ArrayList()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setValidateOnly(true) + .build(); + ApiFuture future = domainsClient.registerDomainCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_registerdomain_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/AsyncRegisterDomainLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/AsyncRegisterDomainLRO.java new file mode 100644 index 00000000..cb87c99e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/AsyncRegisterDomainLRO.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_registerdomain_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1alpha2.ContactNotice; +import com.google.cloud.domains.v1alpha2.DomainNotice; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.OperationMetadata; +import com.google.cloud.domains.v1alpha2.RegisterDomainRequest; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncRegisterDomainLRO { + + public static void main(String[] args) throws Exception { + asyncRegisterDomainLRO(); + } + + public static void asyncRegisterDomainLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegisterDomainRequest request = + RegisterDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllDomainNotices(new ArrayList()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.registerDomainOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_registerdomain_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/SyncRegisterDomain.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/SyncRegisterDomain.java new file mode 100644 index 00000000..e51ac179 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/SyncRegisterDomain.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_registerdomain_sync] +import com.google.cloud.domains.v1alpha2.ContactNotice; +import com.google.cloud.domains.v1alpha2.DomainNotice; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.RegisterDomainRequest; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.type.Money; +import java.util.ArrayList; + +public class SyncRegisterDomain { + + public static void main(String[] args) throws Exception { + syncRegisterDomain(); + } + + public static void syncRegisterDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegisterDomainRequest request = + RegisterDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllDomainNotices(new ArrayList()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.registerDomainAsync(request).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_registerdomain_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/SyncRegisterDomainLocationnameRegistrationMoney.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/SyncRegisterDomainLocationnameRegistrationMoney.java new file mode 100644 index 00000000..fd5725a9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/SyncRegisterDomainLocationnameRegistrationMoney.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.domains.v1alpha2.samples; + +// [START +// domains_v1alpha2_generated_domainsclient_registerdomain_locationnameregistrationmoney_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.type.Money; + +public class SyncRegisterDomainLocationnameRegistrationMoney { + + public static void main(String[] args) throws Exception { + syncRegisterDomainLocationnameRegistrationMoney(); + } + + public static void syncRegisterDomainLocationnameRegistrationMoney() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + Registration response = + domainsClient.registerDomainAsync(parent, registration, yearlyPrice).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_registerdomain_locationnameregistrationmoney_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/SyncRegisterDomainStringRegistrationMoney.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/SyncRegisterDomainStringRegistrationMoney.java new file mode 100644 index 00000000..b7cecbc9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/SyncRegisterDomainStringRegistrationMoney.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_registerdomain_stringregistrationmoney_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.type.Money; + +public class SyncRegisterDomainStringRegistrationMoney { + + public static void main(String[] args) throws Exception { + syncRegisterDomainStringRegistrationMoney(); + } + + public static void syncRegisterDomainStringRegistrationMoney() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + Registration response = + domainsClient.registerDomainAsync(parent, registration, yearlyPrice).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_registerdomain_stringregistrationmoney_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/AsyncResetAuthorizationCode.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/AsyncResetAuthorizationCode.java new file mode 100644 index 00000000..8d7b2cde --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/AsyncResetAuthorizationCode.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_resetauthorizationcode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.cloud.domains.v1alpha2.ResetAuthorizationCodeRequest; + +public class AsyncResetAuthorizationCode { + + public static void main(String[] args) throws Exception { + asyncResetAuthorizationCode(); + } + + public static void asyncResetAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ResetAuthorizationCodeRequest request = + ResetAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = + domainsClient.resetAuthorizationCodeCallable().futureCall(request); + // Do something. + AuthorizationCode response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_resetauthorizationcode_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/SyncResetAuthorizationCode.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/SyncResetAuthorizationCode.java new file mode 100644 index 00000000..4dd25fc7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/SyncResetAuthorizationCode.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_resetauthorizationcode_sync] +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.cloud.domains.v1alpha2.ResetAuthorizationCodeRequest; + +public class SyncResetAuthorizationCode { + + public static void main(String[] args) throws Exception { + syncResetAuthorizationCode(); + } + + public static void syncResetAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ResetAuthorizationCodeRequest request = + ResetAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + AuthorizationCode response = domainsClient.resetAuthorizationCode(request); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_resetauthorizationcode_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeRegistrationname.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeRegistrationname.java new file mode 100644 index 00000000..672912a7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeRegistrationname.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_resetauthorizationcode_registrationname_sync] +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncResetAuthorizationCodeRegistrationname { + + public static void main(String[] args) throws Exception { + syncResetAuthorizationCodeRegistrationname(); + } + + public static void syncResetAuthorizationCodeRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + AuthorizationCode response = domainsClient.resetAuthorizationCode(registration); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_resetauthorizationcode_registrationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeString.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeString.java new file mode 100644 index 00000000..d7d519fd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeString.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_resetauthorizationcode_string_sync] +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncResetAuthorizationCodeString { + + public static void main(String[] args) throws Exception { + syncResetAuthorizationCodeString(); + } + + public static void syncResetAuthorizationCodeString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + AuthorizationCode response = domainsClient.resetAuthorizationCode(registration); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_resetauthorizationcode_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/AsyncRetrieveAuthorizationCode.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/AsyncRetrieveAuthorizationCode.java new file mode 100644 index 00000000..460e4d52 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/AsyncRetrieveAuthorizationCode.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_retrieveauthorizationcode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.cloud.domains.v1alpha2.RetrieveAuthorizationCodeRequest; + +public class AsyncRetrieveAuthorizationCode { + + public static void main(String[] args) throws Exception { + asyncRetrieveAuthorizationCode(); + } + + public static void asyncRetrieveAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveAuthorizationCodeRequest request = + RetrieveAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = + domainsClient.retrieveAuthorizationCodeCallable().futureCall(request); + // Do something. + AuthorizationCode response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrieveauthorizationcode_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCode.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCode.java new file mode 100644 index 00000000..8db54d91 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCode.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_retrieveauthorizationcode_sync] +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.cloud.domains.v1alpha2.RetrieveAuthorizationCodeRequest; + +public class SyncRetrieveAuthorizationCode { + + public static void main(String[] args) throws Exception { + syncRetrieveAuthorizationCode(); + } + + public static void syncRetrieveAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveAuthorizationCodeRequest request = + RetrieveAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + AuthorizationCode response = domainsClient.retrieveAuthorizationCode(request); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrieveauthorizationcode_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeRegistrationname.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeRegistrationname.java new file mode 100644 index 00000000..30b61d50 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeRegistrationname.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_retrieveauthorizationcode_registrationname_sync] +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncRetrieveAuthorizationCodeRegistrationname { + + public static void main(String[] args) throws Exception { + syncRetrieveAuthorizationCodeRegistrationname(); + } + + public static void syncRetrieveAuthorizationCodeRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + AuthorizationCode response = domainsClient.retrieveAuthorizationCode(registration); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrieveauthorizationcode_registrationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeString.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeString.java new file mode 100644 index 00000000..6c8bbab8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeString.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_retrieveauthorizationcode_string_sync] +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncRetrieveAuthorizationCodeString { + + public static void main(String[] args) throws Exception { + syncRetrieveAuthorizationCodeString(); + } + + public static void syncRetrieveAuthorizationCodeString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + AuthorizationCode response = domainsClient.retrieveAuthorizationCode(registration); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrieveauthorizationcode_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/AsyncRetrieveRegisterParameters.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/AsyncRetrieveRegisterParameters.java new file mode 100644 index 00000000..c231c52c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/AsyncRetrieveRegisterParameters.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_retrieveregisterparameters_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.RetrieveRegisterParametersRequest; +import com.google.cloud.domains.v1alpha2.RetrieveRegisterParametersResponse; + +public class AsyncRetrieveRegisterParameters { + + public static void main(String[] args) throws Exception { + asyncRetrieveRegisterParameters(); + } + + public static void asyncRetrieveRegisterParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveRegisterParametersRequest request = + RetrieveRegisterParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + domainsClient.retrieveRegisterParametersCallable().futureCall(request); + // Do something. + RetrieveRegisterParametersResponse response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrieveregisterparameters_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParameters.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParameters.java new file mode 100644 index 00000000..c640ac57 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParameters.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_retrieveregisterparameters_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.RetrieveRegisterParametersRequest; +import com.google.cloud.domains.v1alpha2.RetrieveRegisterParametersResponse; + +public class SyncRetrieveRegisterParameters { + + public static void main(String[] args) throws Exception { + syncRetrieveRegisterParameters(); + } + + public static void syncRetrieveRegisterParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveRegisterParametersRequest request = + RetrieveRegisterParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + RetrieveRegisterParametersResponse response = + domainsClient.retrieveRegisterParameters(request); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrieveregisterparameters_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersLocationnameString.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersLocationnameString.java new file mode 100644 index 00000000..8d524f77 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersLocationnameString.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.domains.v1alpha2.samples; + +// [START +// domains_v1alpha2_generated_domainsclient_retrieveregisterparameters_locationnamestring_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.RetrieveRegisterParametersResponse; + +public class SyncRetrieveRegisterParametersLocationnameString { + + public static void main(String[] args) throws Exception { + syncRetrieveRegisterParametersLocationnameString(); + } + + public static void syncRetrieveRegisterParametersLocationnameString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + RetrieveRegisterParametersResponse response = + domainsClient.retrieveRegisterParameters(location, domainName); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrieveregisterparameters_locationnamestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersStringString.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersStringString.java new file mode 100644 index 00000000..ea3c8eb3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersStringString.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_retrieveregisterparameters_stringstring_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.RetrieveRegisterParametersResponse; + +public class SyncRetrieveRegisterParametersStringString { + + public static void main(String[] args) throws Exception { + syncRetrieveRegisterParametersStringString(); + } + + public static void syncRetrieveRegisterParametersStringString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + String domainName = "domainName-1244085905"; + RetrieveRegisterParametersResponse response = + domainsClient.retrieveRegisterParameters(location, domainName); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrieveregisterparameters_stringstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/AsyncRetrieveTransferParameters.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/AsyncRetrieveTransferParameters.java new file mode 100644 index 00000000..d1714557 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/AsyncRetrieveTransferParameters.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_retrievetransferparameters_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.RetrieveTransferParametersRequest; +import com.google.cloud.domains.v1alpha2.RetrieveTransferParametersResponse; + +public class AsyncRetrieveTransferParameters { + + public static void main(String[] args) throws Exception { + asyncRetrieveTransferParameters(); + } + + public static void asyncRetrieveTransferParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveTransferParametersRequest request = + RetrieveTransferParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + domainsClient.retrieveTransferParametersCallable().futureCall(request); + // Do something. + RetrieveTransferParametersResponse response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrievetransferparameters_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/SyncRetrieveTransferParameters.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/SyncRetrieveTransferParameters.java new file mode 100644 index 00000000..6e5c8656 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/SyncRetrieveTransferParameters.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_retrievetransferparameters_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.RetrieveTransferParametersRequest; +import com.google.cloud.domains.v1alpha2.RetrieveTransferParametersResponse; + +public class SyncRetrieveTransferParameters { + + public static void main(String[] args) throws Exception { + syncRetrieveTransferParameters(); + } + + public static void syncRetrieveTransferParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveTransferParametersRequest request = + RetrieveTransferParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + RetrieveTransferParametersResponse response = + domainsClient.retrieveTransferParameters(request); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrievetransferparameters_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersLocationnameString.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersLocationnameString.java new file mode 100644 index 00000000..1b38d199 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersLocationnameString.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.domains.v1alpha2.samples; + +// [START +// domains_v1alpha2_generated_domainsclient_retrievetransferparameters_locationnamestring_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.RetrieveTransferParametersResponse; + +public class SyncRetrieveTransferParametersLocationnameString { + + public static void main(String[] args) throws Exception { + syncRetrieveTransferParametersLocationnameString(); + } + + public static void syncRetrieveTransferParametersLocationnameString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + RetrieveTransferParametersResponse response = + domainsClient.retrieveTransferParameters(location, domainName); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrievetransferparameters_locationnamestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersStringString.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersStringString.java new file mode 100644 index 00000000..e27d062e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersStringString.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_retrievetransferparameters_stringstring_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.RetrieveTransferParametersResponse; + +public class SyncRetrieveTransferParametersStringString { + + public static void main(String[] args) throws Exception { + syncRetrieveTransferParametersStringString(); + } + + public static void syncRetrieveTransferParametersStringString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + String domainName = "domainName-1244085905"; + RetrieveTransferParametersResponse response = + domainsClient.retrieveTransferParameters(location, domainName); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrievetransferparameters_stringstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/AsyncSearchDomains.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/AsyncSearchDomains.java new file mode 100644 index 00000000..0394b081 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/AsyncSearchDomains.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_searchdomains_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.SearchDomainsRequest; +import com.google.cloud.domains.v1alpha2.SearchDomainsResponse; + +public class AsyncSearchDomains { + + public static void main(String[] args) throws Exception { + asyncSearchDomains(); + } + + public static void asyncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + SearchDomainsRequest request = + SearchDomainsRequest.newBuilder() + .setQuery("query107944136") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + domainsClient.searchDomainsCallable().futureCall(request); + // Do something. + SearchDomainsResponse response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_searchdomains_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/SyncSearchDomains.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/SyncSearchDomains.java new file mode 100644 index 00000000..d4c409fa --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/SyncSearchDomains.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_searchdomains_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.SearchDomainsRequest; +import com.google.cloud.domains.v1alpha2.SearchDomainsResponse; + +public class SyncSearchDomains { + + public static void main(String[] args) throws Exception { + syncSearchDomains(); + } + + public static void syncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + SearchDomainsRequest request = + SearchDomainsRequest.newBuilder() + .setQuery("query107944136") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + SearchDomainsResponse response = domainsClient.searchDomains(request); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_searchdomains_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/SyncSearchDomainsLocationnameString.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/SyncSearchDomainsLocationnameString.java new file mode 100644 index 00000000..fefca60b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/SyncSearchDomainsLocationnameString.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_searchdomains_locationnamestring_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.SearchDomainsResponse; + +public class SyncSearchDomainsLocationnameString { + + public static void main(String[] args) throws Exception { + syncSearchDomainsLocationnameString(); + } + + public static void syncSearchDomainsLocationnameString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String query = "query107944136"; + SearchDomainsResponse response = domainsClient.searchDomains(location, query); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_searchdomains_locationnamestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/SyncSearchDomainsStringString.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/SyncSearchDomainsStringString.java new file mode 100644 index 00000000..16f28a92 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/SyncSearchDomainsStringString.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_searchdomains_stringstring_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.SearchDomainsResponse; + +public class SyncSearchDomainsStringString { + + public static void main(String[] args) throws Exception { + syncSearchDomainsStringString(); + } + + public static void syncSearchDomainsStringString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + String query = "query107944136"; + SearchDomainsResponse response = domainsClient.searchDomains(location, query); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_searchdomains_stringstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/AsyncTransferDomain.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/AsyncTransferDomain.java new file mode 100644 index 00000000..a7a910fe --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/AsyncTransferDomain.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_transferdomain_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.ContactNotice; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.TransferDomainRequest; +import com.google.longrunning.Operation; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncTransferDomain { + + public static void main(String[] args) throws Exception { + asyncTransferDomain(); + } + + public static void asyncTransferDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + TransferDomainRequest request = + TransferDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setAuthorizationCode(AuthorizationCode.newBuilder().build()) + .setValidateOnly(true) + .build(); + ApiFuture future = domainsClient.transferDomainCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_transferdomain_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/AsyncTransferDomainLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/AsyncTransferDomainLRO.java new file mode 100644 index 00000000..11dfe2c0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/AsyncTransferDomainLRO.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_transferdomain_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.ContactNotice; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.OperationMetadata; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.TransferDomainRequest; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncTransferDomainLRO { + + public static void main(String[] args) throws Exception { + asyncTransferDomainLRO(); + } + + public static void asyncTransferDomainLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + TransferDomainRequest request = + TransferDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setAuthorizationCode(AuthorizationCode.newBuilder().build()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.transferDomainOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_transferdomain_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/SyncTransferDomain.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/SyncTransferDomain.java new file mode 100644 index 00000000..b9f21d26 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/SyncTransferDomain.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_transferdomain_sync] +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.ContactNotice; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.TransferDomainRequest; +import com.google.type.Money; +import java.util.ArrayList; + +public class SyncTransferDomain { + + public static void main(String[] args) throws Exception { + syncTransferDomain(); + } + + public static void syncTransferDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + TransferDomainRequest request = + TransferDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setAuthorizationCode(AuthorizationCode.newBuilder().build()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.transferDomainAsync(request).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_transferdomain_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode.java new file mode 100644 index 00000000..abcf7463 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode.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.domains.v1alpha2.samples; + +// [START +// domains_v1alpha2_generated_domainsclient_transferdomain_locationnameregistrationmoneyauthorizationcode_sync] +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.type.Money; + +public class SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode { + + public static void main(String[] args) throws Exception { + syncTransferDomainLocationnameRegistrationMoneyAuthorizationcode(); + } + + public static void syncTransferDomainLocationnameRegistrationMoneyAuthorizationcode() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + Registration response = + domainsClient + .transferDomainAsync(parent, registration, yearlyPrice, authorizationCode) + .get(); + } + } +} +// [END +// domains_v1alpha2_generated_domainsclient_transferdomain_locationnameregistrationmoneyauthorizationcode_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/SyncTransferDomainStringRegistrationMoneyAuthorizationcode.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/SyncTransferDomainStringRegistrationMoneyAuthorizationcode.java new file mode 100644 index 00000000..198646a4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/SyncTransferDomainStringRegistrationMoneyAuthorizationcode.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.domains.v1alpha2.samples; + +// [START +// domains_v1alpha2_generated_domainsclient_transferdomain_stringregistrationmoneyauthorizationcode_sync] +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.type.Money; + +public class SyncTransferDomainStringRegistrationMoneyAuthorizationcode { + + public static void main(String[] args) throws Exception { + syncTransferDomainStringRegistrationMoneyAuthorizationcode(); + } + + public static void syncTransferDomainStringRegistrationMoneyAuthorizationcode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + Registration response = + domainsClient + .transferDomainAsync(parent, registration, yearlyPrice, authorizationCode) + .get(); + } + } +} +// [END +// domains_v1alpha2_generated_domainsclient_transferdomain_stringregistrationmoneyauthorizationcode_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/AsyncUpdateRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/AsyncUpdateRegistration.java new file mode 100644 index 00000000..eb64f4f0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/AsyncUpdateRegistration.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_updateregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.UpdateRegistrationRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateRegistration { + + public static void main(String[] args) throws Exception { + asyncUpdateRegistration(); + } + + public static void asyncUpdateRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + UpdateRegistrationRequest request = + UpdateRegistrationRequest.newBuilder() + .setRegistration(Registration.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = domainsClient.updateRegistrationCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_updateregistration_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/AsyncUpdateRegistrationLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/AsyncUpdateRegistrationLRO.java new file mode 100644 index 00000000..7da4e257 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/AsyncUpdateRegistrationLRO.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_updateregistration_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.OperationMetadata; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.UpdateRegistrationRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateRegistrationLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateRegistrationLRO(); + } + + public static void asyncUpdateRegistrationLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + UpdateRegistrationRequest request = + UpdateRegistrationRequest.newBuilder() + .setRegistration(Registration.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + domainsClient.updateRegistrationOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_updateregistration_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/SyncUpdateRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/SyncUpdateRegistration.java new file mode 100644 index 00000000..b9c3cd9f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/SyncUpdateRegistration.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_updateregistration_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.UpdateRegistrationRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateRegistration { + + public static void main(String[] args) throws Exception { + syncUpdateRegistration(); + } + + public static void syncUpdateRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + UpdateRegistrationRequest request = + UpdateRegistrationRequest.newBuilder() + .setRegistration(Registration.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Registration response = domainsClient.updateRegistrationAsync(request).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_updateregistration_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/SyncUpdateRegistrationRegistrationFieldmask.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/SyncUpdateRegistrationRegistrationFieldmask.java new file mode 100644 index 00000000..ab615ed6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/SyncUpdateRegistrationRegistrationFieldmask.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_updateregistration_registrationfieldmask_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.protobuf.FieldMask; + +public class SyncUpdateRegistrationRegistrationFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateRegistrationRegistrationFieldmask(); + } + + public static void syncUpdateRegistrationRegistrationFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + Registration registration = Registration.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = domainsClient.updateRegistrationAsync(registration, updateMask).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_updateregistration_registrationfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainssettings/searchdomains/SyncSearchDomains.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainssettings/searchdomains/SyncSearchDomains.java new file mode 100644 index 00000000..dac85e19 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainssettings/searchdomains/SyncSearchDomains.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.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainssettings_searchdomains_sync] +import com.google.cloud.domains.v1alpha2.DomainsSettings; +import java.time.Duration; + +public class SyncSearchDomains { + + public static void main(String[] args) throws Exception { + syncSearchDomains(); + } + + public static void syncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DomainsSettings.Builder domainsSettingsBuilder = DomainsSettings.newBuilder(); + domainsSettingsBuilder + .searchDomainsSettings() + .setRetrySettings( + domainsSettingsBuilder + .searchDomainsSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + DomainsSettings domainsSettings = domainsSettingsBuilder.build(); + } +} +// [END domains_v1alpha2_generated_domainssettings_searchdomains_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1alpha2/stub/domainsstubsettings/searchdomains/SyncSearchDomains.java b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/stub/domainsstubsettings/searchdomains/SyncSearchDomains.java new file mode 100644 index 00000000..b2238ca5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1alpha2/stub/domainsstubsettings/searchdomains/SyncSearchDomains.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.domains.v1alpha2.stub.samples; + +// [START domains_v1alpha2_generated_domainsstubsettings_searchdomains_sync] +import com.google.cloud.domains.v1alpha2.stub.DomainsStubSettings; +import java.time.Duration; + +public class SyncSearchDomains { + + public static void main(String[] args) throws Exception { + syncSearchDomains(); + } + + public static void syncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DomainsStubSettings.Builder domainsSettingsBuilder = DomainsStubSettings.newBuilder(); + domainsSettingsBuilder + .searchDomainsSettings() + .setRetrySettings( + domainsSettingsBuilder + .searchDomainsSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + DomainsStubSettings domainsSettings = domainsSettingsBuilder.build(); + } +} +// [END domains_v1alpha2_generated_domainsstubsettings_searchdomains_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/AsyncConfigureContactSettings.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/AsyncConfigureContactSettings.java new file mode 100644 index 00000000..215f09bb --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/AsyncConfigureContactSettings.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_configurecontactsettings_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1beta1.ContactNotice; +import com.google.cloud.domains.v1beta1.ContactSettings; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class AsyncConfigureContactSettings { + + public static void main(String[] args) throws Exception { + asyncConfigureContactSettings(); + } + + public static void asyncConfigureContactSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureContactSettingsRequest request = + ConfigureContactSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setValidateOnly(true) + .build(); + ApiFuture future = + domainsClient.configureContactSettingsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_configurecontactsettings_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/AsyncConfigureContactSettingsLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/AsyncConfigureContactSettingsLRO.java new file mode 100644 index 00000000..385996bb --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/AsyncConfigureContactSettingsLRO.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_configurecontactsettings_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1beta1.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1beta1.ContactNotice; +import com.google.cloud.domains.v1beta1.ContactSettings; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.OperationMetadata; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class AsyncConfigureContactSettingsLRO { + + public static void main(String[] args) throws Exception { + asyncConfigureContactSettingsLRO(); + } + + public static void asyncConfigureContactSettingsLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureContactSettingsRequest request = + ConfigureContactSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.configureContactSettingsOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_configurecontactsettings_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/SyncConfigureContactSettings.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/SyncConfigureContactSettings.java new file mode 100644 index 00000000..5428e705 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/SyncConfigureContactSettings.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_configurecontactsettings_sync] +import com.google.cloud.domains.v1beta1.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1beta1.ContactNotice; +import com.google.cloud.domains.v1beta1.ContactSettings; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class SyncConfigureContactSettings { + + public static void main(String[] args) throws Exception { + syncConfigureContactSettings(); + } + + public static void syncConfigureContactSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureContactSettingsRequest request = + ConfigureContactSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.configureContactSettingsAsync(request).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_configurecontactsettings_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask.java new file mode 100644 index 00000000..44a22dcf --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask.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.domains.v1beta1.samples; + +// [START +// domains_v1beta1_generated_domainsclient_configurecontactsettings_registrationnamecontactsettingsfieldmask_sync] +import com.google.cloud.domains.v1beta1.ContactSettings; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureContactSettingsRegistrationnameContactsettingsFieldmask(); + } + + public static void syncConfigureContactSettingsRegistrationnameContactsettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureContactSettingsAsync(registration, contactSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1beta1_generated_domainsclient_configurecontactsettings_registrationnamecontactsettingsfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsStringContactsettingsFieldmask.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsStringContactsettingsFieldmask.java new file mode 100644 index 00000000..945c37c7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsStringContactsettingsFieldmask.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.domains.v1beta1.samples; + +// [START +// domains_v1beta1_generated_domainsclient_configurecontactsettings_stringcontactsettingsfieldmask_sync] +import com.google.cloud.domains.v1beta1.ContactSettings; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureContactSettingsStringContactsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureContactSettingsStringContactsettingsFieldmask(); + } + + public static void syncConfigureContactSettingsStringContactsettingsFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureContactSettingsAsync(registration, contactSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1beta1_generated_domainsclient_configurecontactsettings_stringcontactsettingsfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/AsyncConfigureDnsSettings.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/AsyncConfigureDnsSettings.java new file mode 100644 index 00000000..061e205d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/AsyncConfigureDnsSettings.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_configurednssettings_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1beta1.DnsSettings; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureDnsSettings { + + public static void main(String[] args) throws Exception { + asyncConfigureDnsSettings(); + } + + public static void asyncConfigureDnsSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureDnsSettingsRequest request = + ConfigureDnsSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + ApiFuture future = + domainsClient.configureDnsSettingsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_configurednssettings_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/AsyncConfigureDnsSettingsLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/AsyncConfigureDnsSettingsLRO.java new file mode 100644 index 00000000..d964a7ba --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/AsyncConfigureDnsSettingsLRO.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_configurednssettings_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1beta1.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1beta1.DnsSettings; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.OperationMetadata; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureDnsSettingsLRO { + + public static void main(String[] args) throws Exception { + asyncConfigureDnsSettingsLRO(); + } + + public static void asyncConfigureDnsSettingsLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureDnsSettingsRequest request = + ConfigureDnsSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.configureDnsSettingsOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_configurednssettings_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/SyncConfigureDnsSettings.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/SyncConfigureDnsSettings.java new file mode 100644 index 00000000..6fb47f60 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/SyncConfigureDnsSettings.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_configurednssettings_sync] +import com.google.cloud.domains.v1beta1.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1beta1.DnsSettings; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureDnsSettings { + + public static void main(String[] args) throws Exception { + syncConfigureDnsSettings(); + } + + public static void syncConfigureDnsSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureDnsSettingsRequest request = + ConfigureDnsSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.configureDnsSettingsAsync(request).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_configurednssettings_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask.java new file mode 100644 index 00000000..f7d660c0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask.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.domains.v1beta1.samples; + +// [START +// domains_v1beta1_generated_domainsclient_configurednssettings_registrationnamednssettingsfieldmask_sync] +import com.google.cloud.domains.v1beta1.DnsSettings; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask(); + } + + public static void syncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + } + } +} +// [END +// domains_v1beta1_generated_domainsclient_configurednssettings_registrationnamednssettingsfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/SyncConfigureDnsSettingsStringDnssettingsFieldmask.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/SyncConfigureDnsSettingsStringDnssettingsFieldmask.java new file mode 100644 index 00000000..abc07bd1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/SyncConfigureDnsSettingsStringDnssettingsFieldmask.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.domains.v1beta1.samples; + +// [START +// domains_v1beta1_generated_domainsclient_configurednssettings_stringdnssettingsfieldmask_sync] +import com.google.cloud.domains.v1beta1.DnsSettings; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureDnsSettingsStringDnssettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureDnsSettingsStringDnssettingsFieldmask(); + } + + public static void syncConfigureDnsSettingsStringDnssettingsFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + } + } +} +// [END +// domains_v1beta1_generated_domainsclient_configurednssettings_stringdnssettingsfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettings.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettings.java new file mode 100644 index 00000000..e31c6847 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettings.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_configuremanagementsettings_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.ManagementSettings; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureManagementSettings { + + public static void main(String[] args) throws Exception { + asyncConfigureManagementSettings(); + } + + public static void asyncConfigureManagementSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureManagementSettingsRequest request = + ConfigureManagementSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + domainsClient.configureManagementSettingsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_configuremanagementsettings_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettingsLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettingsLRO.java new file mode 100644 index 00000000..e4815127 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettingsLRO.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_configuremanagementsettings_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1beta1.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.ManagementSettings; +import com.google.cloud.domains.v1beta1.OperationMetadata; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureManagementSettingsLRO { + + public static void main(String[] args) throws Exception { + asyncConfigureManagementSettingsLRO(); + } + + public static void asyncConfigureManagementSettingsLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureManagementSettingsRequest request = + ConfigureManagementSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + domainsClient.configureManagementSettingsOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_configuremanagementsettings_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettings.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettings.java new file mode 100644 index 00000000..8d757360 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettings.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_configuremanagementsettings_sync] +import com.google.cloud.domains.v1beta1.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.ManagementSettings; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureManagementSettings { + + public static void main(String[] args) throws Exception { + syncConfigureManagementSettings(); + } + + public static void syncConfigureManagementSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureManagementSettingsRequest request = + ConfigureManagementSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Registration response = domainsClient.configureManagementSettingsAsync(request).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_configuremanagementsettings_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask.java new file mode 100644 index 00000000..0ca2de18 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask.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.domains.v1beta1.samples; + +// [START +// domains_v1beta1_generated_domainsclient_configuremanagementsettings_registrationnamemanagementsettingsfieldmask_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.ManagementSettings; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask(); + } + + public static void syncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureManagementSettingsAsync(registration, managementSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1beta1_generated_domainsclient_configuremanagementsettings_registrationnamemanagementsettingsfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsStringManagementsettingsFieldmask.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsStringManagementsettingsFieldmask.java new file mode 100644 index 00000000..26146447 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsStringManagementsettingsFieldmask.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.domains.v1beta1.samples; + +// [START +// domains_v1beta1_generated_domainsclient_configuremanagementsettings_stringmanagementsettingsfieldmask_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.ManagementSettings; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureManagementSettingsStringManagementsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureManagementSettingsStringManagementsettingsFieldmask(); + } + + public static void syncConfigureManagementSettingsStringManagementsettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureManagementSettingsAsync(registration, managementSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1beta1_generated_domainsclient_configuremanagementsettings_stringmanagementsettingsfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..bc916440 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.DomainsSettings; +import com.google.cloud.domains.v1beta1.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. + DomainsSettings domainsSettings = + DomainsSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + DomainsClient domainsClient = DomainsClient.create(domainsSettings); + } +} +// [END domains_v1beta1_generated_domainsclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000..17c532c7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_create_setcredentialsprovider1_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.DomainsSettings; + +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. + DomainsSettings domainsSettings = + DomainsSettings.newBuilder() + .setTransportChannelProvider( + DomainsSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + DomainsClient domainsClient = DomainsClient.create(domainsSettings); + } +} +// [END domains_v1beta1_generated_domainsclient_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..6540edf1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,37 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_create_setendpoint_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.DomainsSettings; +import com.google.cloud.domains.v1beta1.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. + DomainsSettings domainsSettings = DomainsSettings.newBuilder().setEndpoint(myEndpoint).build(); + DomainsClient domainsClient = DomainsClient.create(domainsSettings); + } +} +// [END domains_v1beta1_generated_domainsclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/AsyncDeleteRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/AsyncDeleteRegistration.java new file mode 100644 index 00000000..b6ed0ec3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/AsyncDeleteRegistration.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_deleteregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.DeleteRegistrationRequest; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.longrunning.Operation; + +public class AsyncDeleteRegistration { + + public static void main(String[] args) throws Exception { + asyncDeleteRegistration(); + } + + public static void asyncDeleteRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + DeleteRegistrationRequest request = + DeleteRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = domainsClient.deleteRegistrationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_deleteregistration_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/AsyncDeleteRegistrationLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/AsyncDeleteRegistrationLRO.java new file mode 100644 index 00000000..83766ffc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/AsyncDeleteRegistrationLRO.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_deleteregistration_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1beta1.DeleteRegistrationRequest; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.OperationMetadata; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.Empty; + +public class AsyncDeleteRegistrationLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteRegistrationLRO(); + } + + public static void asyncDeleteRegistrationLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + DeleteRegistrationRequest request = + DeleteRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + OperationFuture future = + domainsClient.deleteRegistrationOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_deleteregistration_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/SyncDeleteRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/SyncDeleteRegistration.java new file mode 100644 index 00000000..a5bf2163 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/SyncDeleteRegistration.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_deleteregistration_sync] +import com.google.cloud.domains.v1beta1.DeleteRegistrationRequest; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncDeleteRegistration { + + public static void main(String[] args) throws Exception { + syncDeleteRegistration(); + } + + public static void syncDeleteRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + DeleteRegistrationRequest request = + DeleteRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + domainsClient.deleteRegistrationAsync(request).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_deleteregistration_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/SyncDeleteRegistrationRegistrationname.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/SyncDeleteRegistrationRegistrationname.java new file mode 100644 index 00000000..1cff3d02 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/SyncDeleteRegistrationRegistrationname.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_deleteregistration_registrationname_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncDeleteRegistrationRegistrationname { + + public static void main(String[] args) throws Exception { + syncDeleteRegistrationRegistrationname(); + } + + public static void syncDeleteRegistrationRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + domainsClient.deleteRegistrationAsync(name).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_deleteregistration_registrationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/SyncDeleteRegistrationString.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/SyncDeleteRegistrationString.java new file mode 100644 index 00000000..5455fc90 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/SyncDeleteRegistrationString.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_deleteregistration_string_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncDeleteRegistrationString { + + public static void main(String[] args) throws Exception { + syncDeleteRegistrationString(); + } + + public static void syncDeleteRegistrationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + domainsClient.deleteRegistrationAsync(name).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_deleteregistration_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/AsyncExportRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/AsyncExportRegistration.java new file mode 100644 index 00000000..f2278a42 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/AsyncExportRegistration.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_exportregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.ExportRegistrationRequest; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.longrunning.Operation; + +public class AsyncExportRegistration { + + public static void main(String[] args) throws Exception { + asyncExportRegistration(); + } + + public static void asyncExportRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ExportRegistrationRequest request = + ExportRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = domainsClient.exportRegistrationCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_exportregistration_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/AsyncExportRegistrationLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/AsyncExportRegistrationLRO.java new file mode 100644 index 00000000..53b883e3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/AsyncExportRegistrationLRO.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_exportregistration_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.ExportRegistrationRequest; +import com.google.cloud.domains.v1beta1.OperationMetadata; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class AsyncExportRegistrationLRO { + + public static void main(String[] args) throws Exception { + asyncExportRegistrationLRO(); + } + + public static void asyncExportRegistrationLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ExportRegistrationRequest request = + ExportRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + OperationFuture future = + domainsClient.exportRegistrationOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_exportregistration_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/SyncExportRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/SyncExportRegistration.java new file mode 100644 index 00000000..2b89bc93 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/SyncExportRegistration.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_exportregistration_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.ExportRegistrationRequest; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncExportRegistration { + + public static void main(String[] args) throws Exception { + syncExportRegistration(); + } + + public static void syncExportRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ExportRegistrationRequest request = + ExportRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + Registration response = domainsClient.exportRegistrationAsync(request).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_exportregistration_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/SyncExportRegistrationRegistrationname.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/SyncExportRegistrationRegistrationname.java new file mode 100644 index 00000000..439a9494 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/SyncExportRegistrationRegistrationname.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_exportregistration_registrationname_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncExportRegistrationRegistrationname { + + public static void main(String[] args) throws Exception { + syncExportRegistrationRegistrationname(); + } + + public static void syncExportRegistrationRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + Registration response = domainsClient.exportRegistrationAsync(name).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_exportregistration_registrationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/SyncExportRegistrationString.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/SyncExportRegistrationString.java new file mode 100644 index 00000000..26d4adf3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/SyncExportRegistrationString.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_exportregistration_string_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncExportRegistrationString { + + public static void main(String[] args) throws Exception { + syncExportRegistrationString(); + } + + public static void syncExportRegistrationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + Registration response = domainsClient.exportRegistrationAsync(name).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_exportregistration_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/AsyncGetRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/AsyncGetRegistration.java new file mode 100644 index 00000000..6b221ce5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/AsyncGetRegistration.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_getregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.GetRegistrationRequest; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class AsyncGetRegistration { + + public static void main(String[] args) throws Exception { + asyncGetRegistration(); + } + + public static void asyncGetRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + GetRegistrationRequest request = + GetRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = domainsClient.getRegistrationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_getregistration_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/SyncGetRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/SyncGetRegistration.java new file mode 100644 index 00000000..378b99fd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/SyncGetRegistration.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_getregistration_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.GetRegistrationRequest; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncGetRegistration { + + public static void main(String[] args) throws Exception { + syncGetRegistration(); + } + + public static void syncGetRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + GetRegistrationRequest request = + GetRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + Registration response = domainsClient.getRegistration(request); + } + } +} +// [END domains_v1beta1_generated_domainsclient_getregistration_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/SyncGetRegistrationRegistrationname.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/SyncGetRegistrationRegistrationname.java new file mode 100644 index 00000000..15cf0f48 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/SyncGetRegistrationRegistrationname.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_getregistration_registrationname_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncGetRegistrationRegistrationname { + + public static void main(String[] args) throws Exception { + syncGetRegistrationRegistrationname(); + } + + public static void syncGetRegistrationRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + Registration response = domainsClient.getRegistration(name); + } + } +} +// [END domains_v1beta1_generated_domainsclient_getregistration_registrationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/SyncGetRegistrationString.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/SyncGetRegistrationString.java new file mode 100644 index 00000000..64bc510c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/SyncGetRegistrationString.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_getregistration_string_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncGetRegistrationString { + + public static void main(String[] args) throws Exception { + syncGetRegistrationString(); + } + + public static void syncGetRegistrationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + Registration response = domainsClient.getRegistration(name); + } + } +} +// [END domains_v1beta1_generated_domainsclient_getregistration_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/AsyncListRegistrations.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/AsyncListRegistrations.java new file mode 100644 index 00000000..49b03a33 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/AsyncListRegistrations.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_listregistrations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.ListRegistrationsRequest; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.Registration; + +public class AsyncListRegistrations { + + public static void main(String[] args) throws Exception { + asyncListRegistrations(); + } + + public static void asyncListRegistrations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ListRegistrationsRequest request = + ListRegistrationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + domainsClient.listRegistrationsPagedCallable().futureCall(request); + // Do something. + for (Registration element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1beta1_generated_domainsclient_listregistrations_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/AsyncListRegistrationsPaged.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/AsyncListRegistrationsPaged.java new file mode 100644 index 00000000..070a0628 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/AsyncListRegistrationsPaged.java @@ -0,0 +1,60 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_listregistrations_paged_async] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.ListRegistrationsRequest; +import com.google.cloud.domains.v1beta1.ListRegistrationsResponse; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.common.base.Strings; + +public class AsyncListRegistrationsPaged { + + public static void main(String[] args) throws Exception { + asyncListRegistrationsPaged(); + } + + public static void asyncListRegistrationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ListRegistrationsRequest request = + ListRegistrationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + ListRegistrationsResponse response = + domainsClient.listRegistrationsCallable().call(request); + for (Registration element : response.getRegistrationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END domains_v1beta1_generated_domainsclient_listregistrations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/SyncListRegistrations.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/SyncListRegistrations.java new file mode 100644 index 00000000..0e15bff5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/SyncListRegistrations.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_listregistrations_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.ListRegistrationsRequest; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.Registration; + +public class SyncListRegistrations { + + public static void main(String[] args) throws Exception { + syncListRegistrations(); + } + + public static void syncListRegistrations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ListRegistrationsRequest request = + ListRegistrationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (Registration element : domainsClient.listRegistrations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1beta1_generated_domainsclient_listregistrations_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/SyncListRegistrationsLocationname.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/SyncListRegistrationsLocationname.java new file mode 100644 index 00000000..824acde8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/SyncListRegistrationsLocationname.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_listregistrations_locationname_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.Registration; + +public class SyncListRegistrationsLocationname { + + public static void main(String[] args) throws Exception { + syncListRegistrationsLocationname(); + } + + public static void syncListRegistrationsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Registration element : domainsClient.listRegistrations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1beta1_generated_domainsclient_listregistrations_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/SyncListRegistrationsString.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/SyncListRegistrationsString.java new file mode 100644 index 00000000..01cbf30b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/SyncListRegistrationsString.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_listregistrations_string_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.Registration; + +public class SyncListRegistrationsString { + + public static void main(String[] args) throws Exception { + syncListRegistrationsString(); + } + + public static void syncListRegistrationsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Registration element : domainsClient.listRegistrations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1beta1_generated_domainsclient_listregistrations_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/AsyncRegisterDomain.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/AsyncRegisterDomain.java new file mode 100644 index 00000000..5950d03a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/AsyncRegisterDomain.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_registerdomain_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.ContactNotice; +import com.google.cloud.domains.v1beta1.DomainNotice; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.RegisterDomainRequest; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.longrunning.Operation; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncRegisterDomain { + + public static void main(String[] args) throws Exception { + asyncRegisterDomain(); + } + + public static void asyncRegisterDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegisterDomainRequest request = + RegisterDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllDomainNotices(new ArrayList()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setValidateOnly(true) + .build(); + ApiFuture future = domainsClient.registerDomainCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_registerdomain_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/AsyncRegisterDomainLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/AsyncRegisterDomainLRO.java new file mode 100644 index 00000000..17fb1f93 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/AsyncRegisterDomainLRO.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_registerdomain_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1beta1.ContactNotice; +import com.google.cloud.domains.v1beta1.DomainNotice; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.OperationMetadata; +import com.google.cloud.domains.v1beta1.RegisterDomainRequest; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncRegisterDomainLRO { + + public static void main(String[] args) throws Exception { + asyncRegisterDomainLRO(); + } + + public static void asyncRegisterDomainLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegisterDomainRequest request = + RegisterDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllDomainNotices(new ArrayList()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.registerDomainOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_registerdomain_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/SyncRegisterDomain.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/SyncRegisterDomain.java new file mode 100644 index 00000000..65a832a5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/SyncRegisterDomain.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_registerdomain_sync] +import com.google.cloud.domains.v1beta1.ContactNotice; +import com.google.cloud.domains.v1beta1.DomainNotice; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.RegisterDomainRequest; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.type.Money; +import java.util.ArrayList; + +public class SyncRegisterDomain { + + public static void main(String[] args) throws Exception { + syncRegisterDomain(); + } + + public static void syncRegisterDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegisterDomainRequest request = + RegisterDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllDomainNotices(new ArrayList()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.registerDomainAsync(request).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_registerdomain_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/SyncRegisterDomainLocationnameRegistrationMoney.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/SyncRegisterDomainLocationnameRegistrationMoney.java new file mode 100644 index 00000000..c288a90d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/SyncRegisterDomainLocationnameRegistrationMoney.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_registerdomain_locationnameregistrationmoney_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.type.Money; + +public class SyncRegisterDomainLocationnameRegistrationMoney { + + public static void main(String[] args) throws Exception { + syncRegisterDomainLocationnameRegistrationMoney(); + } + + public static void syncRegisterDomainLocationnameRegistrationMoney() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + Registration response = + domainsClient.registerDomainAsync(parent, registration, yearlyPrice).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_registerdomain_locationnameregistrationmoney_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/SyncRegisterDomainStringRegistrationMoney.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/SyncRegisterDomainStringRegistrationMoney.java new file mode 100644 index 00000000..bb16e9f8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/SyncRegisterDomainStringRegistrationMoney.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_registerdomain_stringregistrationmoney_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.type.Money; + +public class SyncRegisterDomainStringRegistrationMoney { + + public static void main(String[] args) throws Exception { + syncRegisterDomainStringRegistrationMoney(); + } + + public static void syncRegisterDomainStringRegistrationMoney() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + Registration response = + domainsClient.registerDomainAsync(parent, registration, yearlyPrice).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_registerdomain_stringregistrationmoney_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/AsyncResetAuthorizationCode.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/AsyncResetAuthorizationCode.java new file mode 100644 index 00000000..697007d6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/AsyncResetAuthorizationCode.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_resetauthorizationcode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.cloud.domains.v1beta1.ResetAuthorizationCodeRequest; + +public class AsyncResetAuthorizationCode { + + public static void main(String[] args) throws Exception { + asyncResetAuthorizationCode(); + } + + public static void asyncResetAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ResetAuthorizationCodeRequest request = + ResetAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = + domainsClient.resetAuthorizationCodeCallable().futureCall(request); + // Do something. + AuthorizationCode response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_resetauthorizationcode_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCode.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCode.java new file mode 100644 index 00000000..56a39840 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCode.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_resetauthorizationcode_sync] +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.cloud.domains.v1beta1.ResetAuthorizationCodeRequest; + +public class SyncResetAuthorizationCode { + + public static void main(String[] args) throws Exception { + syncResetAuthorizationCode(); + } + + public static void syncResetAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ResetAuthorizationCodeRequest request = + ResetAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + AuthorizationCode response = domainsClient.resetAuthorizationCode(request); + } + } +} +// [END domains_v1beta1_generated_domainsclient_resetauthorizationcode_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeRegistrationname.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeRegistrationname.java new file mode 100644 index 00000000..4c254701 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeRegistrationname.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_resetauthorizationcode_registrationname_sync] +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncResetAuthorizationCodeRegistrationname { + + public static void main(String[] args) throws Exception { + syncResetAuthorizationCodeRegistrationname(); + } + + public static void syncResetAuthorizationCodeRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + AuthorizationCode response = domainsClient.resetAuthorizationCode(registration); + } + } +} +// [END domains_v1beta1_generated_domainsclient_resetauthorizationcode_registrationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeString.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeString.java new file mode 100644 index 00000000..60cfee8b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeString.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_resetauthorizationcode_string_sync] +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncResetAuthorizationCodeString { + + public static void main(String[] args) throws Exception { + syncResetAuthorizationCodeString(); + } + + public static void syncResetAuthorizationCodeString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + AuthorizationCode response = domainsClient.resetAuthorizationCode(registration); + } + } +} +// [END domains_v1beta1_generated_domainsclient_resetauthorizationcode_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/AsyncRetrieveAuthorizationCode.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/AsyncRetrieveAuthorizationCode.java new file mode 100644 index 00000000..612ae6b2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/AsyncRetrieveAuthorizationCode.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_retrieveauthorizationcode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.cloud.domains.v1beta1.RetrieveAuthorizationCodeRequest; + +public class AsyncRetrieveAuthorizationCode { + + public static void main(String[] args) throws Exception { + asyncRetrieveAuthorizationCode(); + } + + public static void asyncRetrieveAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveAuthorizationCodeRequest request = + RetrieveAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = + domainsClient.retrieveAuthorizationCodeCallable().futureCall(request); + // Do something. + AuthorizationCode response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrieveauthorizationcode_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCode.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCode.java new file mode 100644 index 00000000..917c3b7c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCode.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_retrieveauthorizationcode_sync] +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.cloud.domains.v1beta1.RetrieveAuthorizationCodeRequest; + +public class SyncRetrieveAuthorizationCode { + + public static void main(String[] args) throws Exception { + syncRetrieveAuthorizationCode(); + } + + public static void syncRetrieveAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveAuthorizationCodeRequest request = + RetrieveAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + AuthorizationCode response = domainsClient.retrieveAuthorizationCode(request); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrieveauthorizationcode_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeRegistrationname.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeRegistrationname.java new file mode 100644 index 00000000..363a0495 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeRegistrationname.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_retrieveauthorizationcode_registrationname_sync] +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncRetrieveAuthorizationCodeRegistrationname { + + public static void main(String[] args) throws Exception { + syncRetrieveAuthorizationCodeRegistrationname(); + } + + public static void syncRetrieveAuthorizationCodeRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + AuthorizationCode response = domainsClient.retrieveAuthorizationCode(registration); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrieveauthorizationcode_registrationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeString.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeString.java new file mode 100644 index 00000000..cc51a186 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeString.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_retrieveauthorizationcode_string_sync] +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncRetrieveAuthorizationCodeString { + + public static void main(String[] args) throws Exception { + syncRetrieveAuthorizationCodeString(); + } + + public static void syncRetrieveAuthorizationCodeString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + AuthorizationCode response = domainsClient.retrieveAuthorizationCode(registration); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrieveauthorizationcode_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/AsyncRetrieveRegisterParameters.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/AsyncRetrieveRegisterParameters.java new file mode 100644 index 00000000..7734f388 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/AsyncRetrieveRegisterParameters.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_retrieveregisterparameters_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.RetrieveRegisterParametersRequest; +import com.google.cloud.domains.v1beta1.RetrieveRegisterParametersResponse; + +public class AsyncRetrieveRegisterParameters { + + public static void main(String[] args) throws Exception { + asyncRetrieveRegisterParameters(); + } + + public static void asyncRetrieveRegisterParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveRegisterParametersRequest request = + RetrieveRegisterParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + domainsClient.retrieveRegisterParametersCallable().futureCall(request); + // Do something. + RetrieveRegisterParametersResponse response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrieveregisterparameters_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParameters.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParameters.java new file mode 100644 index 00000000..51ef1071 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParameters.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_retrieveregisterparameters_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.RetrieveRegisterParametersRequest; +import com.google.cloud.domains.v1beta1.RetrieveRegisterParametersResponse; + +public class SyncRetrieveRegisterParameters { + + public static void main(String[] args) throws Exception { + syncRetrieveRegisterParameters(); + } + + public static void syncRetrieveRegisterParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveRegisterParametersRequest request = + RetrieveRegisterParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + RetrieveRegisterParametersResponse response = + domainsClient.retrieveRegisterParameters(request); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrieveregisterparameters_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersLocationnameString.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersLocationnameString.java new file mode 100644 index 00000000..086eb006 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersLocationnameString.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.domains.v1beta1.samples; + +// [START +// domains_v1beta1_generated_domainsclient_retrieveregisterparameters_locationnamestring_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.RetrieveRegisterParametersResponse; + +public class SyncRetrieveRegisterParametersLocationnameString { + + public static void main(String[] args) throws Exception { + syncRetrieveRegisterParametersLocationnameString(); + } + + public static void syncRetrieveRegisterParametersLocationnameString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + RetrieveRegisterParametersResponse response = + domainsClient.retrieveRegisterParameters(location, domainName); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrieveregisterparameters_locationnamestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersStringString.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersStringString.java new file mode 100644 index 00000000..b9644acf --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersStringString.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_retrieveregisterparameters_stringstring_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.RetrieveRegisterParametersResponse; + +public class SyncRetrieveRegisterParametersStringString { + + public static void main(String[] args) throws Exception { + syncRetrieveRegisterParametersStringString(); + } + + public static void syncRetrieveRegisterParametersStringString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + String domainName = "domainName-1244085905"; + RetrieveRegisterParametersResponse response = + domainsClient.retrieveRegisterParameters(location, domainName); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrieveregisterparameters_stringstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/AsyncRetrieveTransferParameters.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/AsyncRetrieveTransferParameters.java new file mode 100644 index 00000000..bf6d0fab --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/AsyncRetrieveTransferParameters.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_retrievetransferparameters_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.RetrieveTransferParametersRequest; +import com.google.cloud.domains.v1beta1.RetrieveTransferParametersResponse; + +public class AsyncRetrieveTransferParameters { + + public static void main(String[] args) throws Exception { + asyncRetrieveTransferParameters(); + } + + public static void asyncRetrieveTransferParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveTransferParametersRequest request = + RetrieveTransferParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + domainsClient.retrieveTransferParametersCallable().futureCall(request); + // Do something. + RetrieveTransferParametersResponse response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrievetransferparameters_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParameters.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParameters.java new file mode 100644 index 00000000..05fc65a5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParameters.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_retrievetransferparameters_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.RetrieveTransferParametersRequest; +import com.google.cloud.domains.v1beta1.RetrieveTransferParametersResponse; + +public class SyncRetrieveTransferParameters { + + public static void main(String[] args) throws Exception { + syncRetrieveTransferParameters(); + } + + public static void syncRetrieveTransferParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveTransferParametersRequest request = + RetrieveTransferParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + RetrieveTransferParametersResponse response = + domainsClient.retrieveTransferParameters(request); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrievetransferparameters_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersLocationnameString.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersLocationnameString.java new file mode 100644 index 00000000..ef57992a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersLocationnameString.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.domains.v1beta1.samples; + +// [START +// domains_v1beta1_generated_domainsclient_retrievetransferparameters_locationnamestring_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.RetrieveTransferParametersResponse; + +public class SyncRetrieveTransferParametersLocationnameString { + + public static void main(String[] args) throws Exception { + syncRetrieveTransferParametersLocationnameString(); + } + + public static void syncRetrieveTransferParametersLocationnameString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + RetrieveTransferParametersResponse response = + domainsClient.retrieveTransferParameters(location, domainName); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrievetransferparameters_locationnamestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersStringString.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersStringString.java new file mode 100644 index 00000000..ef253fd6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersStringString.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_retrievetransferparameters_stringstring_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.RetrieveTransferParametersResponse; + +public class SyncRetrieveTransferParametersStringString { + + public static void main(String[] args) throws Exception { + syncRetrieveTransferParametersStringString(); + } + + public static void syncRetrieveTransferParametersStringString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + String domainName = "domainName-1244085905"; + RetrieveTransferParametersResponse response = + domainsClient.retrieveTransferParameters(location, domainName); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrievetransferparameters_stringstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/AsyncSearchDomains.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/AsyncSearchDomains.java new file mode 100644 index 00000000..d97c5ea9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/AsyncSearchDomains.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_searchdomains_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.SearchDomainsRequest; +import com.google.cloud.domains.v1beta1.SearchDomainsResponse; + +public class AsyncSearchDomains { + + public static void main(String[] args) throws Exception { + asyncSearchDomains(); + } + + public static void asyncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + SearchDomainsRequest request = + SearchDomainsRequest.newBuilder() + .setQuery("query107944136") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + domainsClient.searchDomainsCallable().futureCall(request); + // Do something. + SearchDomainsResponse response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_searchdomains_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/SyncSearchDomains.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/SyncSearchDomains.java new file mode 100644 index 00000000..e3c366d1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/SyncSearchDomains.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_searchdomains_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.SearchDomainsRequest; +import com.google.cloud.domains.v1beta1.SearchDomainsResponse; + +public class SyncSearchDomains { + + public static void main(String[] args) throws Exception { + syncSearchDomains(); + } + + public static void syncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + SearchDomainsRequest request = + SearchDomainsRequest.newBuilder() + .setQuery("query107944136") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + SearchDomainsResponse response = domainsClient.searchDomains(request); + } + } +} +// [END domains_v1beta1_generated_domainsclient_searchdomains_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/SyncSearchDomainsLocationnameString.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/SyncSearchDomainsLocationnameString.java new file mode 100644 index 00000000..dfcfa1ef --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/SyncSearchDomainsLocationnameString.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_searchdomains_locationnamestring_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.SearchDomainsResponse; + +public class SyncSearchDomainsLocationnameString { + + public static void main(String[] args) throws Exception { + syncSearchDomainsLocationnameString(); + } + + public static void syncSearchDomainsLocationnameString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String query = "query107944136"; + SearchDomainsResponse response = domainsClient.searchDomains(location, query); + } + } +} +// [END domains_v1beta1_generated_domainsclient_searchdomains_locationnamestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/SyncSearchDomainsStringString.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/SyncSearchDomainsStringString.java new file mode 100644 index 00000000..d8ca63f5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/SyncSearchDomainsStringString.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_searchdomains_stringstring_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.SearchDomainsResponse; + +public class SyncSearchDomainsStringString { + + public static void main(String[] args) throws Exception { + syncSearchDomainsStringString(); + } + + public static void syncSearchDomainsStringString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + String query = "query107944136"; + SearchDomainsResponse response = domainsClient.searchDomains(location, query); + } + } +} +// [END domains_v1beta1_generated_domainsclient_searchdomains_stringstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/AsyncTransferDomain.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/AsyncTransferDomain.java new file mode 100644 index 00000000..14447c6a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/AsyncTransferDomain.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_transferdomain_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.ContactNotice; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.TransferDomainRequest; +import com.google.longrunning.Operation; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncTransferDomain { + + public static void main(String[] args) throws Exception { + asyncTransferDomain(); + } + + public static void asyncTransferDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + TransferDomainRequest request = + TransferDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setAuthorizationCode(AuthorizationCode.newBuilder().build()) + .setValidateOnly(true) + .build(); + ApiFuture future = domainsClient.transferDomainCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_transferdomain_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/AsyncTransferDomainLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/AsyncTransferDomainLRO.java new file mode 100644 index 00000000..c44656ef --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/AsyncTransferDomainLRO.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_transferdomain_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.ContactNotice; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.OperationMetadata; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.TransferDomainRequest; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncTransferDomainLRO { + + public static void main(String[] args) throws Exception { + asyncTransferDomainLRO(); + } + + public static void asyncTransferDomainLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + TransferDomainRequest request = + TransferDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setAuthorizationCode(AuthorizationCode.newBuilder().build()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.transferDomainOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_transferdomain_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/SyncTransferDomain.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/SyncTransferDomain.java new file mode 100644 index 00000000..a1276fbf --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/SyncTransferDomain.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_transferdomain_sync] +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.ContactNotice; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.TransferDomainRequest; +import com.google.type.Money; +import java.util.ArrayList; + +public class SyncTransferDomain { + + public static void main(String[] args) throws Exception { + syncTransferDomain(); + } + + public static void syncTransferDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + TransferDomainRequest request = + TransferDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setAuthorizationCode(AuthorizationCode.newBuilder().build()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.transferDomainAsync(request).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_transferdomain_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode.java new file mode 100644 index 00000000..3ff5c935 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode.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.domains.v1beta1.samples; + +// [START +// domains_v1beta1_generated_domainsclient_transferdomain_locationnameregistrationmoneyauthorizationcode_sync] +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.type.Money; + +public class SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode { + + public static void main(String[] args) throws Exception { + syncTransferDomainLocationnameRegistrationMoneyAuthorizationcode(); + } + + public static void syncTransferDomainLocationnameRegistrationMoneyAuthorizationcode() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + Registration response = + domainsClient + .transferDomainAsync(parent, registration, yearlyPrice, authorizationCode) + .get(); + } + } +} +// [END +// domains_v1beta1_generated_domainsclient_transferdomain_locationnameregistrationmoneyauthorizationcode_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/SyncTransferDomainStringRegistrationMoneyAuthorizationcode.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/SyncTransferDomainStringRegistrationMoneyAuthorizationcode.java new file mode 100644 index 00000000..bbc55f7c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/SyncTransferDomainStringRegistrationMoneyAuthorizationcode.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.domains.v1beta1.samples; + +// [START +// domains_v1beta1_generated_domainsclient_transferdomain_stringregistrationmoneyauthorizationcode_sync] +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.type.Money; + +public class SyncTransferDomainStringRegistrationMoneyAuthorizationcode { + + public static void main(String[] args) throws Exception { + syncTransferDomainStringRegistrationMoneyAuthorizationcode(); + } + + public static void syncTransferDomainStringRegistrationMoneyAuthorizationcode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + Registration response = + domainsClient + .transferDomainAsync(parent, registration, yearlyPrice, authorizationCode) + .get(); + } + } +} +// [END +// domains_v1beta1_generated_domainsclient_transferdomain_stringregistrationmoneyauthorizationcode_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/AsyncUpdateRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/AsyncUpdateRegistration.java new file mode 100644 index 00000000..28863258 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/AsyncUpdateRegistration.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_updateregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.UpdateRegistrationRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateRegistration { + + public static void main(String[] args) throws Exception { + asyncUpdateRegistration(); + } + + public static void asyncUpdateRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + UpdateRegistrationRequest request = + UpdateRegistrationRequest.newBuilder() + .setRegistration(Registration.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = domainsClient.updateRegistrationCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_updateregistration_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/AsyncUpdateRegistrationLRO.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/AsyncUpdateRegistrationLRO.java new file mode 100644 index 00000000..2a19fae5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/AsyncUpdateRegistrationLRO.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_updateregistration_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.OperationMetadata; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.UpdateRegistrationRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateRegistrationLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateRegistrationLRO(); + } + + public static void asyncUpdateRegistrationLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + UpdateRegistrationRequest request = + UpdateRegistrationRequest.newBuilder() + .setRegistration(Registration.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + domainsClient.updateRegistrationOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_updateregistration_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/SyncUpdateRegistration.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/SyncUpdateRegistration.java new file mode 100644 index 00000000..6d1dd4d9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/SyncUpdateRegistration.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_updateregistration_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.UpdateRegistrationRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateRegistration { + + public static void main(String[] args) throws Exception { + syncUpdateRegistration(); + } + + public static void syncUpdateRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + UpdateRegistrationRequest request = + UpdateRegistrationRequest.newBuilder() + .setRegistration(Registration.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Registration response = domainsClient.updateRegistrationAsync(request).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_updateregistration_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/SyncUpdateRegistrationRegistrationFieldmask.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/SyncUpdateRegistrationRegistrationFieldmask.java new file mode 100644 index 00000000..6353ec26 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/SyncUpdateRegistrationRegistrationFieldmask.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_updateregistration_registrationfieldmask_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.protobuf.FieldMask; + +public class SyncUpdateRegistrationRegistrationFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateRegistrationRegistrationFieldmask(); + } + + public static void syncUpdateRegistrationRegistrationFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + Registration registration = Registration.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = domainsClient.updateRegistrationAsync(registration, updateMask).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_updateregistration_registrationfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainssettings/searchdomains/SyncSearchDomains.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainssettings/searchdomains/SyncSearchDomains.java new file mode 100644 index 00000000..62b1cc73 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainssettings/searchdomains/SyncSearchDomains.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.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainssettings_searchdomains_sync] +import com.google.cloud.domains.v1beta1.DomainsSettings; +import java.time.Duration; + +public class SyncSearchDomains { + + public static void main(String[] args) throws Exception { + syncSearchDomains(); + } + + public static void syncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DomainsSettings.Builder domainsSettingsBuilder = DomainsSettings.newBuilder(); + domainsSettingsBuilder + .searchDomainsSettings() + .setRetrySettings( + domainsSettingsBuilder + .searchDomainsSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + DomainsSettings domainsSettings = domainsSettingsBuilder.build(); + } +} +// [END domains_v1beta1_generated_domainssettings_searchdomains_sync] diff --git a/samples/snippets/generated/com/google/cloud/domains/v1beta1/stub/domainsstubsettings/searchdomains/SyncSearchDomains.java b/samples/snippets/generated/com/google/cloud/domains/v1beta1/stub/domainsstubsettings/searchdomains/SyncSearchDomains.java new file mode 100644 index 00000000..344ebbb0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/domains/v1beta1/stub/domainsstubsettings/searchdomains/SyncSearchDomains.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.domains.v1beta1.stub.samples; + +// [START domains_v1beta1_generated_domainsstubsettings_searchdomains_sync] +import com.google.cloud.domains.v1beta1.stub.DomainsStubSettings; +import java.time.Duration; + +public class SyncSearchDomains { + + public static void main(String[] args) throws Exception { + syncSearchDomains(); + } + + public static void syncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DomainsStubSettings.Builder domainsSettingsBuilder = DomainsStubSettings.newBuilder(); + domainsSettingsBuilder + .searchDomainsSettings() + .setRetrySettings( + domainsSettingsBuilder + .searchDomainsSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + DomainsStubSettings domainsSettings = domainsSettingsBuilder.build(); + } +} +// [END domains_v1beta1_generated_domainsstubsettings_searchdomains_sync]