diff --git a/java-deploy/google-cloud-deploy/src/main/java/com/google/cloud/deploy/v1/CloudDeployClient.java b/java-deploy/google-cloud-deploy/src/main/java/com/google/cloud/deploy/v1/CloudDeployClient.java
index 99cb92cc6c9a..a184d3813ef4 100644
--- a/java-deploy/google-cloud-deploy/src/main/java/com/google/cloud/deploy/v1/CloudDeployClient.java
+++ b/java-deploy/google-cloud-deploy/src/main/java/com/google/cloud/deploy/v1/CloudDeployClient.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.deploy.v1.stub.CloudDeployStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.longrunning.Operation;
-import com.google.longrunning.OperationsClient;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import java.io.IOException;
@@ -105,13 +105,28 @@
* CloudDeployClient cloudDeployClient = CloudDeployClient.create(cloudDeploySettings);
* }
*
+ * 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.
+ * CloudDeploySettings cloudDeploySettings =
+ * CloudDeploySettings.newBuilder()
+ * .setTransportChannelProvider(
+ * CloudDeploySettings.defaultHttpJsonTransportProviderBuilder().build())
+ * .build();
+ * CloudDeployClient cloudDeployClient = CloudDeployClient.create(cloudDeploySettings);
+ * }
+ *
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
public class CloudDeployClient implements BackgroundResource {
private final CloudDeploySettings settings;
private final CloudDeployStub stub;
- private final OperationsClient operationsClient;
+ private final OperationsClient httpJsonOperationsClient;
+ private final com.google.longrunning.OperationsClient operationsClient;
/** Constructs an instance of CloudDeployClient with default settings. */
public static final CloudDeployClient create() throws IOException {
@@ -130,7 +145,6 @@ public static final CloudDeployClient create(CloudDeploySettings settings) throw
* Constructs an instance of CloudDeployClient, using the given stub for making calls. This is for
* advanced usage - prefer using create(CloudDeploySettings).
*/
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public static final CloudDeployClient create(CloudDeployStub stub) {
return new CloudDeployClient(stub);
}
@@ -143,21 +157,23 @@ public static final CloudDeployClient create(CloudDeployStub stub) {
protected CloudDeployClient(CloudDeploySettings settings) throws IOException {
this.settings = settings;
this.stub = ((CloudDeployStubSettings) 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());
}
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
protected CloudDeployClient(CloudDeployStub 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 CloudDeploySettings getSettings() {
return settings;
}
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public CloudDeployStub getStub() {
return stub;
}
@@ -166,10 +182,19 @@ public CloudDeployStub 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.
+ */
+ @BetaApi
+ public final OperationsClient getHttpJsonOperationsClient() {
+ return httpJsonOperationsClient;
+ }
+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists DeliveryPipelines in a given project and location.
@@ -314,7 +339,7 @@ public final ListDeliveryPipelinesPagedResponse listDeliveryPipelines(
* while (true) {
* ListDeliveryPipelinesResponse response =
* cloudDeployClient.listDeliveryPipelinesCallable().call(request);
- * for (DeliveryPipeline element : response.getResponsesList()) {
+ * for (DeliveryPipeline element : response.getDeliveryPipelinesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
@@ -1020,7 +1045,7 @@ public final ListTargetsPagedResponse listTargets(ListTargetsRequest request) {
* .build();
* while (true) {
* ListTargetsResponse response = cloudDeployClient.listTargetsCallable().call(request);
- * for (Target element : response.getResponsesList()) {
+ * for (Target element : response.getTargetsList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
@@ -1689,7 +1714,7 @@ public final ListReleasesPagedResponse listReleases(ListReleasesRequest request)
* .build();
* while (true) {
* ListReleasesResponse response = cloudDeployClient.listReleasesCallable().call(request);
- * for (Release element : response.getResponsesList()) {
+ * for (Release element : response.getReleasesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
@@ -2241,7 +2266,7 @@ public final ListRolloutsPagedResponse listRollouts(ListRolloutsRequest request)
* .build();
* while (true) {
* ListRolloutsResponse response = cloudDeployClient.listRolloutsCallable().call(request);
- * for (Rollout element : response.getResponsesList()) {
+ * for (Rollout element : response.getRolloutsList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
diff --git a/java-deploy/google-cloud-deploy/src/main/java/com/google/cloud/deploy/v1/CloudDeploySettings.java b/java-deploy/google-cloud-deploy/src/main/java/com/google/cloud/deploy/v1/CloudDeploySettings.java
index 0463ade641f2..dc75aab6245d 100644
--- a/java-deploy/google-cloud-deploy/src/main/java/com/google/cloud/deploy/v1/CloudDeploySettings.java
+++ b/java-deploy/google-cloud-deploy/src/main/java/com/google/cloud/deploy/v1/CloudDeploySettings.java
@@ -26,6 +26,7 @@
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
@@ -249,11 +250,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return CloudDeployStubSettings.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 CloudDeployStubSettings.defaultGrpcTransportProviderBuilder();
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return CloudDeployStubSettings.defaultHttpJsonTransportProviderBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return CloudDeployStubSettings.defaultTransportChannelProvider();
}
@@ -263,11 +271,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return CloudDeployStubSettings.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);
@@ -305,6 +319,11 @@ private static Builder createDefault() {
return new Builder(CloudDeployStubSettings.newBuilder());
}
+ @BetaApi
+ private static Builder createHttpJsonDefault() {
+ return new Builder(CloudDeployStubSettings.newHttpJsonBuilder());
+ }
+
public CloudDeployStubSettings.Builder getStubSettingsBuilder() {
return ((CloudDeployStubSettings.Builder) getStubSettings());
}
diff --git a/java-deploy/google-cloud-deploy/src/main/java/com/google/cloud/deploy/v1/stub/CloudDeployStub.java b/java-deploy/google-cloud-deploy/src/main/java/com/google/cloud/deploy/v1/stub/CloudDeployStub.java
index a708fabb24db..04291252e1dc 100644
--- a/java-deploy/google-cloud-deploy/src/main/java/com/google/cloud/deploy/v1/stub/CloudDeployStub.java
+++ b/java-deploy/google-cloud-deploy/src/main/java/com/google/cloud/deploy/v1/stub/CloudDeployStub.java
@@ -68,7 +68,11 @@
public abstract class CloudDeployStub implements BackgroundResource {
public OperationsStub getOperationsStub() {
- throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
+ return null;
+ }
+
+ public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() {
+ return null;
}
public UnaryCallable
diff --git a/java-deploy/google-cloud-deploy/src/main/java/com/google/cloud/deploy/v1/stub/CloudDeployStubSettings.java b/java-deploy/google-cloud-deploy/src/main/java/com/google/cloud/deploy/v1/stub/CloudDeployStubSettings.java
index b1a6f904f55a..5e4f799d4d14 100644
--- a/java-deploy/google-cloud-deploy/src/main/java/com/google/cloud/deploy/v1/stub/CloudDeployStubSettings.java
+++ b/java-deploy/google-cloud-deploy/src/main/java/com/google/cloud/deploy/v1/stub/CloudDeployStubSettings.java
@@ -31,6 +31,9 @@
import com.google.api.gax.grpc.GrpcTransportChannel;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
import com.google.api.gax.grpc.ProtoOperationTransformers;
+import com.google.api.gax.httpjson.GaxHttpJsonProperties;
+import com.google.api.gax.httpjson.HttpJsonTransportChannel;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.longrunning.OperationSnapshot;
import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
import com.google.api.gax.retrying.RetrySettings;
@@ -551,13 +554,17 @@ public UnaryCallSettings getConfigSettings() {
return getConfigSettings;
}
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public CloudDeployStub createStub() throws IOException {
if (getTransportChannelProvider()
.getTransportName()
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcCloudDeployStub.create(this);
}
+ if (getTransportChannelProvider()
+ .getTransportName()
+ .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
+ return HttpJsonCloudDeployStub.create(this);
+ }
throw new UnsupportedOperationException(
String.format(
"Transport not supported: %s", getTransportChannelProvider().getTransportName()));
@@ -590,18 +597,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
.setUseJwtAccessWithScope(true);
}
- /** Returns a builder for the default ChannelProvider for this service. */
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return InstantiatingGrpcChannelProvider.newBuilder()
.setMaxInboundMessageSize(Integer.MAX_VALUE);
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return InstantiatingHttpJsonChannelProvider.newBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return defaultGrpcTransportProviderBuilder().build();
}
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
- public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() {
return ApiClientHeaderProvider.newBuilder()
.setGeneratedLibToken(
"gapic", GaxProperties.getLibraryVersion(CloudDeployStubSettings.class))
@@ -609,11 +623,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
}
- /** Returns a new builder for this class. */
+ @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
+ public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() {
+ return ApiClientHeaderProvider.newBuilder()
+ .setGeneratedLibToken(
+ "gapic", GaxProperties.getLibraryVersion(CloudDeployStubSettings.class))
+ .setTransportToken(
+ GaxHttpJsonProperties.getHttpJsonTokenName(),
+ GaxHttpJsonProperties.getHttpJsonVersion());
+ }
+
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return CloudDeployStubSettings.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);
@@ -880,6 +913,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
.listDeliveryPipelinesSettings()
diff --git a/java-deploy/google-cloud-deploy/src/main/java/com/google/cloud/deploy/v1/stub/HttpJsonCloudDeployCallableFactory.java b/java-deploy/google-cloud-deploy/src/main/java/com/google/cloud/deploy/v1/stub/HttpJsonCloudDeployCallableFactory.java
new file mode 100644
index 000000000000..b95d414b5b9b
--- /dev/null
+++ b/java-deploy/google-cloud-deploy/src/main/java/com/google/cloud/deploy/v1/stub/HttpJsonCloudDeployCallableFactory.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.deploy.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 CloudDeploy service API.
+ *
+ * This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonCloudDeployCallableFactory
+ implements HttpJsonStubCallableFactory {
+
+ @Override
+ public UnaryCallable createUnaryCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ UnaryCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createUnaryCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ UnaryCallable createPagedCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ PagedCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createPagedCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public UnaryCallable createBatchingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ BatchingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createBatchingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ @Override
+ public
+ OperationCallable createOperationCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ OperationCallSettings callSettings,
+ ClientContext clientContext,
+ OperationsStub operationsStub) {
+ UnaryCallable innerCallable =
+ HttpJsonCallableFactory.createBaseUnaryCallable(
+ httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext);
+ HttpJsonOperationSnapshotCallable initialCallable =
+ new HttpJsonOperationSnapshotCallable(
+ innerCallable,
+ httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory());
+ return HttpJsonCallableFactory.createOperationCallable(
+ callSettings, clientContext, operationsStub.longRunningClient(), initialCallable);
+ }
+
+ @Override
+ public
+ ServerStreamingCallable createServerStreamingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ ServerStreamingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createServerStreamingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+}
diff --git a/java-deploy/google-cloud-deploy/src/main/java/com/google/cloud/deploy/v1/stub/HttpJsonCloudDeployStub.java b/java-deploy/google-cloud-deploy/src/main/java/com/google/cloud/deploy/v1/stub/HttpJsonCloudDeployStub.java
new file mode 100644
index 000000000000..40195165d07b
--- /dev/null
+++ b/java-deploy/google-cloud-deploy/src/main/java/com/google/cloud/deploy/v1/stub/HttpJsonCloudDeployStub.java
@@ -0,0 +1,1340 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.deploy.v1.stub;
+
+import static com.google.cloud.deploy.v1.CloudDeployClient.ListDeliveryPipelinesPagedResponse;
+import static com.google.cloud.deploy.v1.CloudDeployClient.ListReleasesPagedResponse;
+import static com.google.cloud.deploy.v1.CloudDeployClient.ListRolloutsPagedResponse;
+import static com.google.cloud.deploy.v1.CloudDeployClient.ListTargetsPagedResponse;
+
+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.deploy.v1.ApproveRolloutRequest;
+import com.google.cloud.deploy.v1.ApproveRolloutResponse;
+import com.google.cloud.deploy.v1.Config;
+import com.google.cloud.deploy.v1.CreateDeliveryPipelineRequest;
+import com.google.cloud.deploy.v1.CreateReleaseRequest;
+import com.google.cloud.deploy.v1.CreateRolloutRequest;
+import com.google.cloud.deploy.v1.CreateTargetRequest;
+import com.google.cloud.deploy.v1.DeleteDeliveryPipelineRequest;
+import com.google.cloud.deploy.v1.DeleteTargetRequest;
+import com.google.cloud.deploy.v1.DeliveryPipeline;
+import com.google.cloud.deploy.v1.GetConfigRequest;
+import com.google.cloud.deploy.v1.GetDeliveryPipelineRequest;
+import com.google.cloud.deploy.v1.GetReleaseRequest;
+import com.google.cloud.deploy.v1.GetRolloutRequest;
+import com.google.cloud.deploy.v1.GetTargetRequest;
+import com.google.cloud.deploy.v1.ListDeliveryPipelinesRequest;
+import com.google.cloud.deploy.v1.ListDeliveryPipelinesResponse;
+import com.google.cloud.deploy.v1.ListReleasesRequest;
+import com.google.cloud.deploy.v1.ListReleasesResponse;
+import com.google.cloud.deploy.v1.ListRolloutsRequest;
+import com.google.cloud.deploy.v1.ListRolloutsResponse;
+import com.google.cloud.deploy.v1.ListTargetsRequest;
+import com.google.cloud.deploy.v1.ListTargetsResponse;
+import com.google.cloud.deploy.v1.OperationMetadata;
+import com.google.cloud.deploy.v1.Release;
+import com.google.cloud.deploy.v1.Rollout;
+import com.google.cloud.deploy.v1.Target;
+import com.google.cloud.deploy.v1.UpdateDeliveryPipelineRequest;
+import com.google.cloud.deploy.v1.UpdateTargetRequest;
+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 CloudDeploy service API.
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonCloudDeployStub extends CloudDeployStub {
+ private static final TypeRegistry typeRegistry =
+ TypeRegistry.newBuilder()
+ .add(Empty.getDescriptor())
+ .add(OperationMetadata.getDescriptor())
+ .add(Rollout.getDescriptor())
+ .add(DeliveryPipeline.getDescriptor())
+ .add(Target.getDescriptor())
+ .add(Release.getDescriptor())
+ .build();
+
+ private static final ApiMethodDescriptor<
+ ListDeliveryPipelinesRequest, ListDeliveryPipelinesResponse>
+ listDeliveryPipelinesMethodDescriptor =
+ ApiMethodDescriptor
+ .newBuilder()
+ .setFullMethodName("google.cloud.deploy.v1.CloudDeploy/ListDeliveryPipelines")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*}/deliveryPipelines",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "filter", request.getFilter());
+ serializer.putQueryParam(fields, "orderBy", request.getOrderBy());
+ serializer.putQueryParam(fields, "pageSize", request.getPageSize());
+ serializer.putQueryParam(fields, "pageToken", request.getPageToken());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListDeliveryPipelinesResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ getDeliveryPipelineMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.deploy.v1.CloudDeploy/GetDeliveryPipeline")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/deliveryPipelines/*}",
+ 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(DeliveryPipeline.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ createDeliveryPipelineMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.deploy.v1.CloudDeploy/CreateDeliveryPipeline")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*}/deliveryPipelines",
+ 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, "deliveryPipelineId", request.getDeliveryPipelineId());
+ serializer.putQueryParam(fields, "requestId", request.getRequestId());
+ serializer.putQueryParam(
+ fields, "validateOnly", request.getValidateOnly());
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("deliveryPipeline", request.getDeliveryPipeline()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (CreateDeliveryPipelineRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ updateDeliveryPipelineMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.deploy.v1.CloudDeploy/UpdateDeliveryPipeline")
+ .setHttpMethod("PATCH")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{deliveryPipeline.name=projects/*/locations/*/deliveryPipelines/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(
+ fields,
+ "deliveryPipeline.name",
+ request.getDeliveryPipeline().getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(
+ fields, "allowMissing", request.getAllowMissing());
+ serializer.putQueryParam(fields, "requestId", request.getRequestId());
+ serializer.putQueryParam(fields, "updateMask", request.getUpdateMask());
+ serializer.putQueryParam(
+ fields, "validateOnly", request.getValidateOnly());
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("deliveryPipeline", request.getDeliveryPipeline()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (UpdateDeliveryPipelineRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ deleteDeliveryPipelineMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.deploy.v1.CloudDeploy/DeleteDeliveryPipeline")
+ .setHttpMethod("DELETE")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/deliveryPipelines/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(
+ fields, "allowMissing", request.getAllowMissing());
+ serializer.putQueryParam(fields, "etag", request.getEtag());
+ serializer.putQueryParam(fields, "force", request.getForce());
+ serializer.putQueryParam(fields, "requestId", request.getRequestId());
+ serializer.putQueryParam(
+ fields, "validateOnly", request.getValidateOnly());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (DeleteDeliveryPipelineRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ listTargetsMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.deploy.v1.CloudDeploy/ListTargets")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*}/targets",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "filter", request.getFilter());
+ serializer.putQueryParam(fields, "orderBy", request.getOrderBy());
+ serializer.putQueryParam(fields, "pageSize", request.getPageSize());
+ serializer.putQueryParam(fields, "pageToken", request.getPageToken());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListTargetsResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor getTargetMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.deploy.v1.CloudDeploy/GetTarget")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/targets/*}",
+ 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(Target.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ createTargetMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.deploy.v1.CloudDeploy/CreateTarget")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*}/targets",
+ 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, "requestId", request.getRequestId());
+ serializer.putQueryParam(fields, "targetId", request.getTargetId());
+ serializer.putQueryParam(
+ fields, "validateOnly", request.getValidateOnly());
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create().toBody("target", request.getTarget()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (CreateTargetRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ updateTargetMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.deploy.v1.CloudDeploy/UpdateTarget")
+ .setHttpMethod("PATCH")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{target.name=projects/*/locations/*/targets/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(
+ fields, "target.name", request.getTarget().getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(
+ fields, "allowMissing", request.getAllowMissing());
+ serializer.putQueryParam(fields, "requestId", request.getRequestId());
+ serializer.putQueryParam(fields, "updateMask", request.getUpdateMask());
+ serializer.putQueryParam(
+ fields, "validateOnly", request.getValidateOnly());
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create().toBody("target", request.getTarget()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (UpdateTargetRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ deleteTargetMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.deploy.v1.CloudDeploy/DeleteTarget")
+ .setHttpMethod("DELETE")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/targets/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(
+ fields, "allowMissing", request.getAllowMissing());
+ serializer.putQueryParam(fields, "etag", request.getEtag());
+ serializer.putQueryParam(fields, "requestId", request.getRequestId());
+ serializer.putQueryParam(
+ fields, "validateOnly", request.getValidateOnly());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (DeleteTargetRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ listReleasesMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.deploy.v1.CloudDeploy/ListReleases")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*/deliveryPipelines/*}/releases",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "filter", request.getFilter());
+ serializer.putQueryParam(fields, "orderBy", request.getOrderBy());
+ serializer.putQueryParam(fields, "pageSize", request.getPageSize());
+ serializer.putQueryParam(fields, "pageToken", request.getPageToken());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListReleasesResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor getReleaseMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.deploy.v1.CloudDeploy/GetRelease")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/deliveryPipelines/*/releases/*}",
+ 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(Release.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ createReleaseMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.deploy.v1.CloudDeploy/CreateRelease")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*/deliveryPipelines/*}/releases",
+ 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, "releaseId", request.getReleaseId());
+ serializer.putQueryParam(fields, "requestId", request.getRequestId());
+ serializer.putQueryParam(
+ fields, "validateOnly", request.getValidateOnly());
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create().toBody("release", request.getRelease()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (CreateReleaseRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ approveRolloutMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.deploy.v1.CloudDeploy/ApproveRollout")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/deliveryPipelines/*/releases/*/rollouts/*}:approve",
+ 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(ApproveRolloutResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ listRolloutsMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.deploy.v1.CloudDeploy/ListRollouts")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*/deliveryPipelines/*/releases/*}/rollouts",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "filter", request.getFilter());
+ serializer.putQueryParam(fields, "orderBy", request.getOrderBy());
+ serializer.putQueryParam(fields, "pageSize", request.getPageSize());
+ serializer.putQueryParam(fields, "pageToken", request.getPageToken());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListRolloutsResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor getRolloutMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.deploy.v1.CloudDeploy/GetRollout")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/deliveryPipelines/*/releases/*/rollouts/*}",
+ 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(Rollout.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ createRolloutMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.deploy.v1.CloudDeploy/CreateRollout")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*/deliveryPipelines/*/releases/*}/rollouts",
+ 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, "requestId", request.getRequestId());
+ serializer.putQueryParam(fields, "rolloutId", request.getRolloutId());
+ serializer.putQueryParam(
+ fields, "validateOnly", request.getValidateOnly());
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create().toBody("rollout", request.getRollout()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (CreateRolloutRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor getConfigMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.deploy.v1.CloudDeploy/GetConfig")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/config}",
+ 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(Config.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private final UnaryCallable
+ listDeliveryPipelinesCallable;
+ private final UnaryCallable
+ listDeliveryPipelinesPagedCallable;
+ private final UnaryCallable
+ getDeliveryPipelineCallable;
+ private final UnaryCallable
+ createDeliveryPipelineCallable;
+ private final OperationCallable<
+ CreateDeliveryPipelineRequest, DeliveryPipeline, OperationMetadata>
+ createDeliveryPipelineOperationCallable;
+ private final UnaryCallable
+ updateDeliveryPipelineCallable;
+ private final OperationCallable<
+ UpdateDeliveryPipelineRequest, DeliveryPipeline, OperationMetadata>
+ updateDeliveryPipelineOperationCallable;
+ private final UnaryCallable
+ deleteDeliveryPipelineCallable;
+ private final OperationCallable
+ deleteDeliveryPipelineOperationCallable;
+ private final UnaryCallable listTargetsCallable;
+ private final UnaryCallable
+ listTargetsPagedCallable;
+ private final UnaryCallable getTargetCallable;
+ private final UnaryCallable createTargetCallable;
+ private final OperationCallable
+ createTargetOperationCallable;
+ private final UnaryCallable updateTargetCallable;
+ private final OperationCallable
+ updateTargetOperationCallable;
+ private final UnaryCallable deleteTargetCallable;
+ private final OperationCallable
+ deleteTargetOperationCallable;
+ private final UnaryCallable listReleasesCallable;
+ private final UnaryCallable
+ listReleasesPagedCallable;
+ private final UnaryCallable getReleaseCallable;
+ private final UnaryCallable createReleaseCallable;
+ private final OperationCallable
+ createReleaseOperationCallable;
+ private final UnaryCallable approveRolloutCallable;
+ private final UnaryCallable listRolloutsCallable;
+ private final UnaryCallable
+ listRolloutsPagedCallable;
+ private final UnaryCallable getRolloutCallable;
+ private final UnaryCallable createRolloutCallable;
+ private final OperationCallable
+ createRolloutOperationCallable;
+ private final UnaryCallable getConfigCallable;
+
+ private final BackgroundResource backgroundResources;
+ private final HttpJsonOperationsStub httpJsonOperationsStub;
+ private final HttpJsonStubCallableFactory callableFactory;
+
+ public static final HttpJsonCloudDeployStub create(CloudDeployStubSettings settings)
+ throws IOException {
+ return new HttpJsonCloudDeployStub(settings, ClientContext.create(settings));
+ }
+
+ public static final HttpJsonCloudDeployStub create(ClientContext clientContext)
+ throws IOException {
+ return new HttpJsonCloudDeployStub(
+ CloudDeployStubSettings.newHttpJsonBuilder().build(), clientContext);
+ }
+
+ public static final HttpJsonCloudDeployStub create(
+ ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException {
+ return new HttpJsonCloudDeployStub(
+ CloudDeployStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory);
+ }
+
+ /**
+ * Constructs an instance of HttpJsonCloudDeployStub, 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 HttpJsonCloudDeployStub(CloudDeployStubSettings settings, ClientContext clientContext)
+ throws IOException {
+ this(settings, clientContext, new HttpJsonCloudDeployCallableFactory());
+ }
+
+ /**
+ * Constructs an instance of HttpJsonCloudDeployStub, 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 HttpJsonCloudDeployStub(
+ CloudDeployStubSettings settings,
+ ClientContext clientContext,
+ HttpJsonStubCallableFactory callableFactory)
+ throws IOException {
+ this.callableFactory = callableFactory;
+ this.httpJsonOperationsStub =
+ HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry);
+
+ HttpJsonCallSettings
+ listDeliveryPipelinesTransportSettings =
+ HttpJsonCallSettings
+ .newBuilder()
+ .setMethodDescriptor(listDeliveryPipelinesMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ getDeliveryPipelineTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(getDeliveryPipelineMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ createDeliveryPipelineTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(createDeliveryPipelineMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ updateDeliveryPipelineTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(updateDeliveryPipelineMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ deleteDeliveryPipelineTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(deleteDeliveryPipelineMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings listTargetsTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(listTargetsMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings getTargetTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(getTargetMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings createTargetTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(createTargetMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings updateTargetTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(updateTargetMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings deleteTargetTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(deleteTargetMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings listReleasesTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(listReleasesMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings getReleaseTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(getReleaseMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings createReleaseTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(createReleaseMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ approveRolloutTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(approveRolloutMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings listRolloutsTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(listRolloutsMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings getRolloutTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(getRolloutMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings createRolloutTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(createRolloutMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings getConfigTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(getConfigMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+
+ this.listDeliveryPipelinesCallable =
+ callableFactory.createUnaryCallable(
+ listDeliveryPipelinesTransportSettings,
+ settings.listDeliveryPipelinesSettings(),
+ clientContext);
+ this.listDeliveryPipelinesPagedCallable =
+ callableFactory.createPagedCallable(
+ listDeliveryPipelinesTransportSettings,
+ settings.listDeliveryPipelinesSettings(),
+ clientContext);
+ this.getDeliveryPipelineCallable =
+ callableFactory.createUnaryCallable(
+ getDeliveryPipelineTransportSettings,
+ settings.getDeliveryPipelineSettings(),
+ clientContext);
+ this.createDeliveryPipelineCallable =
+ callableFactory.createUnaryCallable(
+ createDeliveryPipelineTransportSettings,
+ settings.createDeliveryPipelineSettings(),
+ clientContext);
+ this.createDeliveryPipelineOperationCallable =
+ callableFactory.createOperationCallable(
+ createDeliveryPipelineTransportSettings,
+ settings.createDeliveryPipelineOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.updateDeliveryPipelineCallable =
+ callableFactory.createUnaryCallable(
+ updateDeliveryPipelineTransportSettings,
+ settings.updateDeliveryPipelineSettings(),
+ clientContext);
+ this.updateDeliveryPipelineOperationCallable =
+ callableFactory.createOperationCallable(
+ updateDeliveryPipelineTransportSettings,
+ settings.updateDeliveryPipelineOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.deleteDeliveryPipelineCallable =
+ callableFactory.createUnaryCallable(
+ deleteDeliveryPipelineTransportSettings,
+ settings.deleteDeliveryPipelineSettings(),
+ clientContext);
+ this.deleteDeliveryPipelineOperationCallable =
+ callableFactory.createOperationCallable(
+ deleteDeliveryPipelineTransportSettings,
+ settings.deleteDeliveryPipelineOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.listTargetsCallable =
+ callableFactory.createUnaryCallable(
+ listTargetsTransportSettings, settings.listTargetsSettings(), clientContext);
+ this.listTargetsPagedCallable =
+ callableFactory.createPagedCallable(
+ listTargetsTransportSettings, settings.listTargetsSettings(), clientContext);
+ this.getTargetCallable =
+ callableFactory.createUnaryCallable(
+ getTargetTransportSettings, settings.getTargetSettings(), clientContext);
+ this.createTargetCallable =
+ callableFactory.createUnaryCallable(
+ createTargetTransportSettings, settings.createTargetSettings(), clientContext);
+ this.createTargetOperationCallable =
+ callableFactory.createOperationCallable(
+ createTargetTransportSettings,
+ settings.createTargetOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.updateTargetCallable =
+ callableFactory.createUnaryCallable(
+ updateTargetTransportSettings, settings.updateTargetSettings(), clientContext);
+ this.updateTargetOperationCallable =
+ callableFactory.createOperationCallable(
+ updateTargetTransportSettings,
+ settings.updateTargetOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.deleteTargetCallable =
+ callableFactory.createUnaryCallable(
+ deleteTargetTransportSettings, settings.deleteTargetSettings(), clientContext);
+ this.deleteTargetOperationCallable =
+ callableFactory.createOperationCallable(
+ deleteTargetTransportSettings,
+ settings.deleteTargetOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.listReleasesCallable =
+ callableFactory.createUnaryCallable(
+ listReleasesTransportSettings, settings.listReleasesSettings(), clientContext);
+ this.listReleasesPagedCallable =
+ callableFactory.createPagedCallable(
+ listReleasesTransportSettings, settings.listReleasesSettings(), clientContext);
+ this.getReleaseCallable =
+ callableFactory.createUnaryCallable(
+ getReleaseTransportSettings, settings.getReleaseSettings(), clientContext);
+ this.createReleaseCallable =
+ callableFactory.createUnaryCallable(
+ createReleaseTransportSettings, settings.createReleaseSettings(), clientContext);
+ this.createReleaseOperationCallable =
+ callableFactory.createOperationCallable(
+ createReleaseTransportSettings,
+ settings.createReleaseOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.approveRolloutCallable =
+ callableFactory.createUnaryCallable(
+ approveRolloutTransportSettings, settings.approveRolloutSettings(), clientContext);
+ this.listRolloutsCallable =
+ callableFactory.createUnaryCallable(
+ listRolloutsTransportSettings, settings.listRolloutsSettings(), clientContext);
+ this.listRolloutsPagedCallable =
+ callableFactory.createPagedCallable(
+ listRolloutsTransportSettings, settings.listRolloutsSettings(), clientContext);
+ this.getRolloutCallable =
+ callableFactory.createUnaryCallable(
+ getRolloutTransportSettings, settings.getRolloutSettings(), clientContext);
+ this.createRolloutCallable =
+ callableFactory.createUnaryCallable(
+ createRolloutTransportSettings, settings.createRolloutSettings(), clientContext);
+ this.createRolloutOperationCallable =
+ callableFactory.createOperationCallable(
+ createRolloutTransportSettings,
+ settings.createRolloutOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.getConfigCallable =
+ callableFactory.createUnaryCallable(
+ getConfigTransportSettings, settings.getConfigSettings(), clientContext);
+
+ this.backgroundResources =
+ new BackgroundResourceAggregation(clientContext.getBackgroundResources());
+ }
+
+ @InternalApi
+ public static List getMethodDescriptors() {
+ List methodDescriptors = new ArrayList<>();
+ methodDescriptors.add(listDeliveryPipelinesMethodDescriptor);
+ methodDescriptors.add(getDeliveryPipelineMethodDescriptor);
+ methodDescriptors.add(createDeliveryPipelineMethodDescriptor);
+ methodDescriptors.add(updateDeliveryPipelineMethodDescriptor);
+ methodDescriptors.add(deleteDeliveryPipelineMethodDescriptor);
+ methodDescriptors.add(listTargetsMethodDescriptor);
+ methodDescriptors.add(getTargetMethodDescriptor);
+ methodDescriptors.add(createTargetMethodDescriptor);
+ methodDescriptors.add(updateTargetMethodDescriptor);
+ methodDescriptors.add(deleteTargetMethodDescriptor);
+ methodDescriptors.add(listReleasesMethodDescriptor);
+ methodDescriptors.add(getReleaseMethodDescriptor);
+ methodDescriptors.add(createReleaseMethodDescriptor);
+ methodDescriptors.add(approveRolloutMethodDescriptor);
+ methodDescriptors.add(listRolloutsMethodDescriptor);
+ methodDescriptors.add(getRolloutMethodDescriptor);
+ methodDescriptors.add(createRolloutMethodDescriptor);
+ methodDescriptors.add(getConfigMethodDescriptor);
+ return methodDescriptors;
+ }
+
+ public HttpJsonOperationsStub getHttpJsonOperationsStub() {
+ return httpJsonOperationsStub;
+ }
+
+ @Override
+ public UnaryCallable
+ listDeliveryPipelinesCallable() {
+ return listDeliveryPipelinesCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ listDeliveryPipelinesPagedCallable() {
+ return listDeliveryPipelinesPagedCallable;
+ }
+
+ @Override
+ public UnaryCallable getDeliveryPipelineCallable() {
+ return getDeliveryPipelineCallable;
+ }
+
+ @Override
+ public UnaryCallable createDeliveryPipelineCallable() {
+ return createDeliveryPipelineCallable;
+ }
+
+ @Override
+ public OperationCallable
+ createDeliveryPipelineOperationCallable() {
+ return createDeliveryPipelineOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable updateDeliveryPipelineCallable() {
+ return updateDeliveryPipelineCallable;
+ }
+
+ @Override
+ public OperationCallable
+ updateDeliveryPipelineOperationCallable() {
+ return updateDeliveryPipelineOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable deleteDeliveryPipelineCallable() {
+ return deleteDeliveryPipelineCallable;
+ }
+
+ @Override
+ public OperationCallable
+ deleteDeliveryPipelineOperationCallable() {
+ return deleteDeliveryPipelineOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable listTargetsCallable() {
+ return listTargetsCallable;
+ }
+
+ @Override
+ public UnaryCallable listTargetsPagedCallable() {
+ return listTargetsPagedCallable;
+ }
+
+ @Override
+ public UnaryCallable getTargetCallable() {
+ return getTargetCallable;
+ }
+
+ @Override
+ public UnaryCallable createTargetCallable() {
+ return createTargetCallable;
+ }
+
+ @Override
+ public OperationCallable
+ createTargetOperationCallable() {
+ return createTargetOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable updateTargetCallable() {
+ return updateTargetCallable;
+ }
+
+ @Override
+ public OperationCallable