diff --git a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/AssetServiceClient.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/AssetServiceClient.java
index fc8484e62..b885e4813 100644
--- a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/AssetServiceClient.java
+++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/AssetServiceClient.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;
@@ -31,7 +32,6 @@
import com.google.cloud.asset.v1.stub.AssetServiceStubSettings;
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;
@@ -110,13 +110,28 @@
* AssetServiceClient assetServiceClient = AssetServiceClient.create(assetServiceSettings);
* }
*
+ * 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.
+ * AssetServiceSettings assetServiceSettings =
+ * AssetServiceSettings.newBuilder()
+ * .setTransportChannelProvider(
+ * AssetServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
+ * .build();
+ * AssetServiceClient assetServiceClient = AssetServiceClient.create(assetServiceSettings);
+ * }
+ *
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
public class AssetServiceClient implements BackgroundResource {
private final AssetServiceSettings settings;
private final AssetServiceStub stub;
- private final OperationsClient operationsClient;
+ private final OperationsClient httpJsonOperationsClient;
+ private final com.google.longrunning.OperationsClient operationsClient;
/** Constructs an instance of AssetServiceClient with default settings. */
public static final AssetServiceClient create() throws IOException {
@@ -147,13 +162,17 @@ public static final AssetServiceClient create(AssetServiceStub stub) {
protected AssetServiceClient(AssetServiceSettings settings) throws IOException {
this.settings = settings;
this.stub = ((AssetServiceStubSettings) 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 AssetServiceClient(AssetServiceStub 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 AssetServiceSettings getSettings() {
@@ -168,10 +187,18 @@ public AssetServiceStub 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.
/**
* Exports assets with time and resource types to a given Cloud Storage location/BigQuery table.
diff --git a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/AssetServiceSettings.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/AssetServiceSettings.java
index 7e1e9518e..9ed0dabea 100644
--- a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/AssetServiceSettings.java
+++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/AssetServiceSettings.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;
@@ -226,11 +227,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return AssetServiceStubSettings.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 AssetServiceStubSettings.defaultGrpcTransportProviderBuilder();
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return AssetServiceStubSettings.defaultHttpJsonTransportProviderBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return AssetServiceStubSettings.defaultTransportChannelProvider();
}
@@ -240,11 +248,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return AssetServiceStubSettings.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);
@@ -282,6 +296,11 @@ private static Builder createDefault() {
return new Builder(AssetServiceStubSettings.newBuilder());
}
+ @BetaApi
+ private static Builder createHttpJsonDefault() {
+ return new Builder(AssetServiceStubSettings.newHttpJsonBuilder());
+ }
+
public AssetServiceStubSettings.Builder getStubSettingsBuilder() {
return ((AssetServiceStubSettings.Builder) getStubSettings());
}
diff --git a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/AssetServiceStub.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/AssetServiceStub.java
index 4e17bcbc3..8be0b9772 100644
--- a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/AssetServiceStub.java
+++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/AssetServiceStub.java
@@ -72,7 +72,11 @@
public abstract class AssetServiceStub implements BackgroundResource {
public OperationsStub getOperationsStub() {
- throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
+ return null;
+ }
+
+ public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() {
+ return null;
}
public OperationCallable
diff --git a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/AssetServiceStubSettings.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/AssetServiceStubSettings.java
index 905ae39ac..8cc8a48a3 100644
--- a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/AssetServiceStubSettings.java
+++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/AssetServiceStubSettings.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;
@@ -547,6 +550,11 @@ public AssetServiceStub createStub() throws IOException {
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcAssetServiceStub.create(this);
}
+ if (getTransportChannelProvider()
+ .getTransportName()
+ .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
+ return HttpJsonAssetServiceStub.create(this);
+ }
throw new UnsupportedOperationException(
String.format(
"Transport not supported: %s", getTransportChannelProvider().getTransportName()));
@@ -579,18 +587,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(AssetServiceStubSettings.class))
@@ -598,11 +613,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(AssetServiceStubSettings.class))
+ .setTransportToken(
+ GaxHttpJsonProperties.getHttpJsonTokenName(),
+ GaxHttpJsonProperties.getHttpJsonVersion());
+ }
+
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return AssetServiceStubSettings.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);
@@ -884,6 +918,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
.exportAssetsSettings()
diff --git a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/HttpJsonAssetServiceCallableFactory.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/HttpJsonAssetServiceCallableFactory.java
new file mode 100644
index 000000000..08af9f934
--- /dev/null
+++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/HttpJsonAssetServiceCallableFactory.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.asset.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 AssetService service API.
+ *
+ * This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonAssetServiceCallableFactory
+ 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-asset/src/main/java/com/google/cloud/asset/v1/stub/HttpJsonAssetServiceStub.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/HttpJsonAssetServiceStub.java
new file mode 100644
index 000000000..b2b344b6a
--- /dev/null
+++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/HttpJsonAssetServiceStub.java
@@ -0,0 +1,1303 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.asset.v1.stub;
+
+import static com.google.cloud.asset.v1.AssetServiceClient.ListAssetsPagedResponse;
+import static com.google.cloud.asset.v1.AssetServiceClient.ListSavedQueriesPagedResponse;
+import static com.google.cloud.asset.v1.AssetServiceClient.SearchAllIamPoliciesPagedResponse;
+import static com.google.cloud.asset.v1.AssetServiceClient.SearchAllResourcesPagedResponse;
+
+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.asset.v1.AnalyzeIamPolicyLongrunningMetadata;
+import com.google.cloud.asset.v1.AnalyzeIamPolicyLongrunningRequest;
+import com.google.cloud.asset.v1.AnalyzeIamPolicyLongrunningResponse;
+import com.google.cloud.asset.v1.AnalyzeIamPolicyRequest;
+import com.google.cloud.asset.v1.AnalyzeIamPolicyResponse;
+import com.google.cloud.asset.v1.AnalyzeMoveRequest;
+import com.google.cloud.asset.v1.AnalyzeMoveResponse;
+import com.google.cloud.asset.v1.BatchGetAssetsHistoryRequest;
+import com.google.cloud.asset.v1.BatchGetAssetsHistoryResponse;
+import com.google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest;
+import com.google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse;
+import com.google.cloud.asset.v1.CreateFeedRequest;
+import com.google.cloud.asset.v1.CreateSavedQueryRequest;
+import com.google.cloud.asset.v1.DeleteFeedRequest;
+import com.google.cloud.asset.v1.DeleteSavedQueryRequest;
+import com.google.cloud.asset.v1.ExportAssetsRequest;
+import com.google.cloud.asset.v1.ExportAssetsResponse;
+import com.google.cloud.asset.v1.Feed;
+import com.google.cloud.asset.v1.GetFeedRequest;
+import com.google.cloud.asset.v1.GetSavedQueryRequest;
+import com.google.cloud.asset.v1.ListAssetsRequest;
+import com.google.cloud.asset.v1.ListAssetsResponse;
+import com.google.cloud.asset.v1.ListFeedsRequest;
+import com.google.cloud.asset.v1.ListFeedsResponse;
+import com.google.cloud.asset.v1.ListSavedQueriesRequest;
+import com.google.cloud.asset.v1.ListSavedQueriesResponse;
+import com.google.cloud.asset.v1.SavedQuery;
+import com.google.cloud.asset.v1.SearchAllIamPoliciesRequest;
+import com.google.cloud.asset.v1.SearchAllIamPoliciesResponse;
+import com.google.cloud.asset.v1.SearchAllResourcesRequest;
+import com.google.cloud.asset.v1.SearchAllResourcesResponse;
+import com.google.cloud.asset.v1.UpdateFeedRequest;
+import com.google.cloud.asset.v1.UpdateSavedQueryRequest;
+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 AssetService service API.
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonAssetServiceStub extends AssetServiceStub {
+ private static final TypeRegistry typeRegistry =
+ TypeRegistry.newBuilder()
+ .add(AnalyzeIamPolicyLongrunningMetadata.getDescriptor())
+ .add(ExportAssetsResponse.getDescriptor())
+ .add(AnalyzeIamPolicyLongrunningResponse.getDescriptor())
+ .add(ExportAssetsRequest.getDescriptor())
+ .build();
+
+ private static final ApiMethodDescriptor
+ exportAssetsMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.asset.v1.AssetService/ExportAssets")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=*/*}:exportAssets",
+ 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(
+ (ExportAssetsRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ listAssetsMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.asset.v1.AssetService/ListAssets")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=*/*}/assets",
+ 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, "assetTypes", request.getAssetTypesList());
+ serializer.putQueryParam(
+ fields, "contentType", request.getContentType());
+ serializer.putQueryParam(fields, "pageSize", request.getPageSize());
+ serializer.putQueryParam(fields, "pageToken", request.getPageToken());
+ serializer.putQueryParam(fields, "readTime", request.getReadTime());
+ serializer.putQueryParam(
+ fields, "relationshipTypes", request.getRelationshipTypesList());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListAssetsResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor<
+ BatchGetAssetsHistoryRequest, BatchGetAssetsHistoryResponse>
+ batchGetAssetsHistoryMethodDescriptor =
+ ApiMethodDescriptor
+ .newBuilder()
+ .setFullMethodName("google.cloud.asset.v1.AssetService/BatchGetAssetsHistory")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=*/*}:batchGetAssetsHistory",
+ 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, "assetNames", request.getAssetNamesList());
+ serializer.putQueryParam(
+ fields, "contentType", request.getContentType());
+ serializer.putQueryParam(
+ fields, "readTimeWindow", request.getReadTimeWindow());
+ serializer.putQueryParam(
+ fields, "relationshipTypes", request.getRelationshipTypesList());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(BatchGetAssetsHistoryResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor createFeedMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.asset.v1.AssetService/CreateFeed")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=*/*}/feeds",
+ 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(Feed.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor getFeedMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.asset.v1.AssetService/GetFeed")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=*/*/feeds/*}",
+ 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(Feed.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ listFeedsMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.asset.v1.AssetService/ListFeeds")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=*/*}/feeds",
+ 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 -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListFeedsResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor updateFeedMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.asset.v1.AssetService/UpdateFeed")
+ .setHttpMethod("PATCH")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{feed.name=*/*/feeds/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "feed.name", request.getFeed().getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create().toBody("*", request.toBuilder().build()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Feed.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor deleteFeedMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.asset.v1.AssetService/DeleteFeed")
+ .setHttpMethod("DELETE")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=*/*/feeds/*}",
+ 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(Empty.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ searchAllResourcesMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.asset.v1.AssetService/SearchAllResources")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{scope=*/*}:searchAllResources",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "scope", request.getScope());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(
+ fields, "assetTypes", request.getAssetTypesList());
+ serializer.putQueryParam(fields, "orderBy", request.getOrderBy());
+ serializer.putQueryParam(fields, "pageSize", request.getPageSize());
+ serializer.putQueryParam(fields, "pageToken", request.getPageToken());
+ serializer.putQueryParam(fields, "query", request.getQuery());
+ serializer.putQueryParam(fields, "readMask", request.getReadMask());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(SearchAllResourcesResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor<
+ SearchAllIamPoliciesRequest, SearchAllIamPoliciesResponse>
+ searchAllIamPoliciesMethodDescriptor =
+ ApiMethodDescriptor
+ .newBuilder()
+ .setFullMethodName("google.cloud.asset.v1.AssetService/SearchAllIamPolicies")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{scope=*/*}:searchAllIamPolicies",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "scope", request.getScope());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(
+ fields, "assetTypes", request.getAssetTypesList());
+ serializer.putQueryParam(fields, "orderBy", request.getOrderBy());
+ serializer.putQueryParam(fields, "pageSize", request.getPageSize());
+ serializer.putQueryParam(fields, "pageToken", request.getPageToken());
+ serializer.putQueryParam(fields, "query", request.getQuery());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(SearchAllIamPoliciesResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ analyzeIamPolicyMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.asset.v1.AssetService/AnalyzeIamPolicy")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{analysisQuery.scope=*/*}:analyzeIamPolicy",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(
+ fields,
+ "analysisQuery.scope",
+ request.getAnalysisQuery().getScope());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(
+ fields, "analysisQuery", request.getAnalysisQuery());
+ serializer.putQueryParam(
+ fields, "executionTimeout", request.getExecutionTimeout());
+ serializer.putQueryParam(
+ fields, "savedAnalysisQuery", request.getSavedAnalysisQuery());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(AnalyzeIamPolicyResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ analyzeIamPolicyLongrunningMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.asset.v1.AssetService/AnalyzeIamPolicyLongrunning")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{analysisQuery.scope=*/*}:analyzeIamPolicyLongrunning",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(
+ fields,
+ "analysisQuery.scope",
+ request.getAnalysisQuery().getScope());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create().toBody("*", request.toBuilder().build()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (AnalyzeIamPolicyLongrunningRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ analyzeMoveMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.asset.v1.AssetService/AnalyzeMove")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{resource=*/*}:analyzeMove",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "resource", request.getResource());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(
+ fields, "destinationParent", request.getDestinationParent());
+ serializer.putQueryParam(fields, "view", request.getView());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(AnalyzeMoveResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ createSavedQueryMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.asset.v1.AssetService/CreateSavedQuery")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=*/*}/savedQueries",
+ 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, "savedQueryId", request.getSavedQueryId());
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("savedQuery", request.getSavedQuery()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(SavedQuery.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ getSavedQueryMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.asset.v1.AssetService/GetSavedQuery")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=*/*/savedQueries/*}",
+ 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(SavedQuery.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ listSavedQueriesMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.asset.v1.AssetService/ListSavedQueries")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=*/*}/savedQueries",
+ 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(ListSavedQueriesResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ updateSavedQueryMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.asset.v1.AssetService/UpdateSavedQuery")
+ .setHttpMethod("PATCH")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{savedQuery.name=*/*/savedQueries/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(
+ fields, "savedQuery.name", request.getSavedQuery().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("savedQuery", request.getSavedQuery()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(SavedQuery.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ deleteSavedQueryMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.asset.v1.AssetService/DeleteSavedQuery")
+ .setHttpMethod("DELETE")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=*/*/savedQueries/*}",
+ 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(Empty.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor<
+ BatchGetEffectiveIamPoliciesRequest, BatchGetEffectiveIamPoliciesResponse>
+ batchGetEffectiveIamPoliciesMethodDescriptor =
+ ApiMethodDescriptor
+ .
+ newBuilder()
+ .setFullMethodName("google.cloud.asset.v1.AssetService/BatchGetEffectiveIamPolicies")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{scope=*/*}/effectiveIamPolicies:batchGet",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "scope", request.getScope());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "names", request.getNamesList());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(BatchGetEffectiveIamPoliciesResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private final UnaryCallable exportAssetsCallable;
+ private final OperationCallable
+ exportAssetsOperationCallable;
+ private final UnaryCallable listAssetsCallable;
+ private final UnaryCallable listAssetsPagedCallable;
+ private final UnaryCallable
+ batchGetAssetsHistoryCallable;
+ private final UnaryCallable createFeedCallable;
+ private final UnaryCallable getFeedCallable;
+ private final UnaryCallable listFeedsCallable;
+ private final UnaryCallable updateFeedCallable;
+ private final UnaryCallable deleteFeedCallable;
+ private final UnaryCallable
+ searchAllResourcesCallable;
+ private final UnaryCallable
+ searchAllResourcesPagedCallable;
+ private final UnaryCallable
+ searchAllIamPoliciesCallable;
+ private final UnaryCallable
+ searchAllIamPoliciesPagedCallable;
+ private final UnaryCallable
+ analyzeIamPolicyCallable;
+ private final UnaryCallable
+ analyzeIamPolicyLongrunningCallable;
+ private final OperationCallable<
+ AnalyzeIamPolicyLongrunningRequest,
+ AnalyzeIamPolicyLongrunningResponse,
+ AnalyzeIamPolicyLongrunningMetadata>
+ analyzeIamPolicyLongrunningOperationCallable;
+ private final UnaryCallable analyzeMoveCallable;
+ private final UnaryCallable createSavedQueryCallable;
+ private final UnaryCallable getSavedQueryCallable;
+ private final UnaryCallable
+ listSavedQueriesCallable;
+ private final UnaryCallable
+ listSavedQueriesPagedCallable;
+ private final UnaryCallable updateSavedQueryCallable;
+ private final UnaryCallable deleteSavedQueryCallable;
+ private final UnaryCallable<
+ BatchGetEffectiveIamPoliciesRequest, BatchGetEffectiveIamPoliciesResponse>
+ batchGetEffectiveIamPoliciesCallable;
+
+ private final BackgroundResource backgroundResources;
+ private final HttpJsonOperationsStub httpJsonOperationsStub;
+ private final HttpJsonStubCallableFactory callableFactory;
+
+ public static final HttpJsonAssetServiceStub create(AssetServiceStubSettings settings)
+ throws IOException {
+ return new HttpJsonAssetServiceStub(settings, ClientContext.create(settings));
+ }
+
+ public static final HttpJsonAssetServiceStub create(ClientContext clientContext)
+ throws IOException {
+ return new HttpJsonAssetServiceStub(
+ AssetServiceStubSettings.newHttpJsonBuilder().build(), clientContext);
+ }
+
+ public static final HttpJsonAssetServiceStub create(
+ ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException {
+ return new HttpJsonAssetServiceStub(
+ AssetServiceStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory);
+ }
+
+ /**
+ * Constructs an instance of HttpJsonAssetServiceStub, 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 HttpJsonAssetServiceStub(AssetServiceStubSettings settings, ClientContext clientContext)
+ throws IOException {
+ this(settings, clientContext, new HttpJsonAssetServiceCallableFactory());
+ }
+
+ /**
+ * Constructs an instance of HttpJsonAssetServiceStub, 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 HttpJsonAssetServiceStub(
+ AssetServiceStubSettings settings,
+ ClientContext clientContext,
+ HttpJsonStubCallableFactory callableFactory)
+ throws IOException {
+ this.callableFactory = callableFactory;
+ this.httpJsonOperationsStub =
+ HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry);
+
+ HttpJsonCallSettings exportAssetsTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(exportAssetsMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings listAssetsTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(listAssetsMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ batchGetAssetsHistoryTransportSettings =
+ HttpJsonCallSettings
+ .newBuilder()
+ .setMethodDescriptor(batchGetAssetsHistoryMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings createFeedTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(createFeedMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings getFeedTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(getFeedMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings listFeedsTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(listFeedsMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings updateFeedTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(updateFeedMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings deleteFeedTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(deleteFeedMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ searchAllResourcesTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(searchAllResourcesMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ searchAllIamPoliciesTransportSettings =
+ HttpJsonCallSettings
+ .newBuilder()
+ .setMethodDescriptor(searchAllIamPoliciesMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ analyzeIamPolicyTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(analyzeIamPolicyMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ analyzeIamPolicyLongrunningTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(analyzeIamPolicyLongrunningMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings analyzeMoveTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(analyzeMoveMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings createSavedQueryTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(createSavedQueryMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings getSavedQueryTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(getSavedQueryMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ listSavedQueriesTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(listSavedQueriesMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings updateSavedQueryTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(updateSavedQueryMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings deleteSavedQueryTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(deleteSavedQueryMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ batchGetEffectiveIamPoliciesTransportSettings =
+ HttpJsonCallSettings
+ .
+ newBuilder()
+ .setMethodDescriptor(batchGetEffectiveIamPoliciesMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+
+ this.exportAssetsCallable =
+ callableFactory.createUnaryCallable(
+ exportAssetsTransportSettings, settings.exportAssetsSettings(), clientContext);
+ this.exportAssetsOperationCallable =
+ callableFactory.createOperationCallable(
+ exportAssetsTransportSettings,
+ settings.exportAssetsOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.listAssetsCallable =
+ callableFactory.createUnaryCallable(
+ listAssetsTransportSettings, settings.listAssetsSettings(), clientContext);
+ this.listAssetsPagedCallable =
+ callableFactory.createPagedCallable(
+ listAssetsTransportSettings, settings.listAssetsSettings(), clientContext);
+ this.batchGetAssetsHistoryCallable =
+ callableFactory.createUnaryCallable(
+ batchGetAssetsHistoryTransportSettings,
+ settings.batchGetAssetsHistorySettings(),
+ clientContext);
+ this.createFeedCallable =
+ callableFactory.createUnaryCallable(
+ createFeedTransportSettings, settings.createFeedSettings(), clientContext);
+ this.getFeedCallable =
+ callableFactory.createUnaryCallable(
+ getFeedTransportSettings, settings.getFeedSettings(), clientContext);
+ this.listFeedsCallable =
+ callableFactory.createUnaryCallable(
+ listFeedsTransportSettings, settings.listFeedsSettings(), clientContext);
+ this.updateFeedCallable =
+ callableFactory.createUnaryCallable(
+ updateFeedTransportSettings, settings.updateFeedSettings(), clientContext);
+ this.deleteFeedCallable =
+ callableFactory.createUnaryCallable(
+ deleteFeedTransportSettings, settings.deleteFeedSettings(), clientContext);
+ this.searchAllResourcesCallable =
+ callableFactory.createUnaryCallable(
+ searchAllResourcesTransportSettings,
+ settings.searchAllResourcesSettings(),
+ clientContext);
+ this.searchAllResourcesPagedCallable =
+ callableFactory.createPagedCallable(
+ searchAllResourcesTransportSettings,
+ settings.searchAllResourcesSettings(),
+ clientContext);
+ this.searchAllIamPoliciesCallable =
+ callableFactory.createUnaryCallable(
+ searchAllIamPoliciesTransportSettings,
+ settings.searchAllIamPoliciesSettings(),
+ clientContext);
+ this.searchAllIamPoliciesPagedCallable =
+ callableFactory.createPagedCallable(
+ searchAllIamPoliciesTransportSettings,
+ settings.searchAllIamPoliciesSettings(),
+ clientContext);
+ this.analyzeIamPolicyCallable =
+ callableFactory.createUnaryCallable(
+ analyzeIamPolicyTransportSettings, settings.analyzeIamPolicySettings(), clientContext);
+ this.analyzeIamPolicyLongrunningCallable =
+ callableFactory.createUnaryCallable(
+ analyzeIamPolicyLongrunningTransportSettings,
+ settings.analyzeIamPolicyLongrunningSettings(),
+ clientContext);
+ this.analyzeIamPolicyLongrunningOperationCallable =
+ callableFactory.createOperationCallable(
+ analyzeIamPolicyLongrunningTransportSettings,
+ settings.analyzeIamPolicyLongrunningOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.analyzeMoveCallable =
+ callableFactory.createUnaryCallable(
+ analyzeMoveTransportSettings, settings.analyzeMoveSettings(), clientContext);
+ this.createSavedQueryCallable =
+ callableFactory.createUnaryCallable(
+ createSavedQueryTransportSettings, settings.createSavedQuerySettings(), clientContext);
+ this.getSavedQueryCallable =
+ callableFactory.createUnaryCallable(
+ getSavedQueryTransportSettings, settings.getSavedQuerySettings(), clientContext);
+ this.listSavedQueriesCallable =
+ callableFactory.createUnaryCallable(
+ listSavedQueriesTransportSettings, settings.listSavedQueriesSettings(), clientContext);
+ this.listSavedQueriesPagedCallable =
+ callableFactory.createPagedCallable(
+ listSavedQueriesTransportSettings, settings.listSavedQueriesSettings(), clientContext);
+ this.updateSavedQueryCallable =
+ callableFactory.createUnaryCallable(
+ updateSavedQueryTransportSettings, settings.updateSavedQuerySettings(), clientContext);
+ this.deleteSavedQueryCallable =
+ callableFactory.createUnaryCallable(
+ deleteSavedQueryTransportSettings, settings.deleteSavedQuerySettings(), clientContext);
+ this.batchGetEffectiveIamPoliciesCallable =
+ callableFactory.createUnaryCallable(
+ batchGetEffectiveIamPoliciesTransportSettings,
+ settings.batchGetEffectiveIamPoliciesSettings(),
+ clientContext);
+
+ this.backgroundResources =
+ new BackgroundResourceAggregation(clientContext.getBackgroundResources());
+ }
+
+ @InternalApi
+ public static List getMethodDescriptors() {
+ List methodDescriptors = new ArrayList<>();
+ methodDescriptors.add(exportAssetsMethodDescriptor);
+ methodDescriptors.add(listAssetsMethodDescriptor);
+ methodDescriptors.add(batchGetAssetsHistoryMethodDescriptor);
+ methodDescriptors.add(createFeedMethodDescriptor);
+ methodDescriptors.add(getFeedMethodDescriptor);
+ methodDescriptors.add(listFeedsMethodDescriptor);
+ methodDescriptors.add(updateFeedMethodDescriptor);
+ methodDescriptors.add(deleteFeedMethodDescriptor);
+ methodDescriptors.add(searchAllResourcesMethodDescriptor);
+ methodDescriptors.add(searchAllIamPoliciesMethodDescriptor);
+ methodDescriptors.add(analyzeIamPolicyMethodDescriptor);
+ methodDescriptors.add(analyzeIamPolicyLongrunningMethodDescriptor);
+ methodDescriptors.add(analyzeMoveMethodDescriptor);
+ methodDescriptors.add(createSavedQueryMethodDescriptor);
+ methodDescriptors.add(getSavedQueryMethodDescriptor);
+ methodDescriptors.add(listSavedQueriesMethodDescriptor);
+ methodDescriptors.add(updateSavedQueryMethodDescriptor);
+ methodDescriptors.add(deleteSavedQueryMethodDescriptor);
+ methodDescriptors.add(batchGetEffectiveIamPoliciesMethodDescriptor);
+ return methodDescriptors;
+ }
+
+ public HttpJsonOperationsStub getHttpJsonOperationsStub() {
+ return httpJsonOperationsStub;
+ }
+
+ @Override
+ public UnaryCallable exportAssetsCallable() {
+ return exportAssetsCallable;
+ }
+
+ @Override
+ public OperationCallable
+ exportAssetsOperationCallable() {
+ return exportAssetsOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable listAssetsCallable() {
+ return listAssetsCallable;
+ }
+
+ @Override
+ public UnaryCallable listAssetsPagedCallable() {
+ return listAssetsPagedCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ batchGetAssetsHistoryCallable() {
+ return batchGetAssetsHistoryCallable;
+ }
+
+ @Override
+ public UnaryCallable createFeedCallable() {
+ return createFeedCallable;
+ }
+
+ @Override
+ public UnaryCallable getFeedCallable() {
+ return getFeedCallable;
+ }
+
+ @Override
+ public UnaryCallable listFeedsCallable() {
+ return listFeedsCallable;
+ }
+
+ @Override
+ public UnaryCallable updateFeedCallable() {
+ return updateFeedCallable;
+ }
+
+ @Override
+ public UnaryCallable deleteFeedCallable() {
+ return deleteFeedCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ searchAllResourcesCallable() {
+ return searchAllResourcesCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ searchAllResourcesPagedCallable() {
+ return searchAllResourcesPagedCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ searchAllIamPoliciesCallable() {
+ return searchAllIamPoliciesCallable;
+ }
+
+ @Override
+ public UnaryCallable