This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *
+ *
+ * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+ * IamPolicyAnalysisQuery analysisQuery = IamPolicyAnalysisQuery.newBuilder().build();
+ * AnalyzeIamPolicyRequest request = AnalyzeIamPolicyRequest.newBuilder()
+ * .setAnalysisQuery(analysisQuery)
+ * .build();
+ * AnalyzeIamPolicyResponse response = assetServiceClient.analyzeIamPolicy(request);
+ * }
+ *
+ *
+ *
+ * Note: close() needs to be called on the assetServiceClient object to clean up resources such + * as threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *
The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *
See the individual methods for example code. + * + *
Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *
This class can be customized by passing in a custom instance of AssetServiceSettings to + * create(). For example: + * + *
To customize credentials: + * + *
+ *
+ * AssetServiceSettings assetServiceSettings =
+ * AssetServiceSettings.newBuilder()
+ * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ * .build();
+ * AssetServiceClient assetServiceClient =
+ * AssetServiceClient.create(assetServiceSettings);
+ *
+ *
+ *
+ * To customize the endpoint:
+ *
+ *
+ *
+ * AssetServiceSettings assetServiceSettings =
+ * AssetServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * AssetServiceClient assetServiceClient =
+ * AssetServiceClient.create(assetServiceSettings);
+ *
+ *
+ */
+@Generated("by gapic-generator")
+@BetaApi
+public class AssetServiceClient implements BackgroundResource {
+ private final AssetServiceSettings settings;
+ private final AssetServiceStub stub;
+ private final OperationsClient operationsClient;
+
+ /** Constructs an instance of AssetServiceClient with default settings. */
+ public static final AssetServiceClient create() throws IOException {
+ return create(AssetServiceSettings.newBuilder().build());
+ }
+
+ /**
+ * Constructs an instance of AssetServiceClient, using the given settings. The channels are
+ * created based on the settings passed in, or defaults for any settings that are not set.
+ */
+ public static final AssetServiceClient create(AssetServiceSettings settings) throws IOException {
+ return new AssetServiceClient(settings);
+ }
+
+ /**
+ * Constructs an instance of AssetServiceClient, using the given stub for making calls. This is
+ * for advanced usage - prefer to use AssetServiceSettings}.
+ */
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public static final AssetServiceClient create(AssetServiceStub stub) {
+ return new AssetServiceClient(stub);
+ }
+
+ /**
+ * Constructs an instance of AssetServiceClient, 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 AssetServiceClient(AssetServiceSettings settings) throws IOException {
+ this.settings = settings;
+ this.stub = ((AssetServiceStubSettings) settings.getStubSettings()).createStub();
+ this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ protected AssetServiceClient(AssetServiceStub stub) {
+ this.settings = null;
+ this.stub = stub;
+ this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
+ }
+
+ public final AssetServiceSettings getSettings() {
+ return settings;
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public AssetServiceStub getStub() {
+ return stub;
+ }
+
+ /**
+ * Returns the OperationsClient that can be used to query the status of a long-running operation
+ * returned by another API method call.
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationsClient getOperationsClient() {
+ return operationsClient;
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Analyzes IAM policies based on the specified request. Returns a list of
+ * [IamPolicyAnalysisResult][google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult] matching the
+ * request.
+ *
+ * Sample code: + * + *
+ * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+ * IamPolicyAnalysisQuery analysisQuery = IamPolicyAnalysisQuery.newBuilder().build();
+ * AnalyzeIamPolicyRequest request = AnalyzeIamPolicyRequest.newBuilder()
+ * .setAnalysisQuery(analysisQuery)
+ * .build();
+ * AnalyzeIamPolicyResponse response = assetServiceClient.analyzeIamPolicy(request);
+ * }
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest request) {
+ return analyzeIamPolicyCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Analyzes IAM policies based on the specified request. Returns a list of
+ * [IamPolicyAnalysisResult][google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult] matching the
+ * request.
+ *
+ * Sample code: + * + *
+ * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+ * IamPolicyAnalysisQuery analysisQuery = IamPolicyAnalysisQuery.newBuilder().build();
+ * AnalyzeIamPolicyRequest request = AnalyzeIamPolicyRequest.newBuilder()
+ * .setAnalysisQuery(analysisQuery)
+ * .build();
+ * ApiFuture<AnalyzeIamPolicyResponse> future = assetServiceClient.analyzeIamPolicyCallable().futureCall(request);
+ * // Do something
+ * AnalyzeIamPolicyResponse response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallableSample code: + * + *
+ * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+ * IamPolicyAnalysisQuery analysisQuery = IamPolicyAnalysisQuery.newBuilder().build();
+ * IamPolicyAnalysisOutputConfig outputConfig = IamPolicyAnalysisOutputConfig.newBuilder().build();
+ * ExportIamPolicyAnalysisRequest request = ExportIamPolicyAnalysisRequest.newBuilder()
+ * .setAnalysisQuery(analysisQuery)
+ * .setOutputConfig(outputConfig)
+ * .build();
+ * ExportIamPolicyAnalysisResponse response = assetServiceClient.exportIamPolicyAnalysisAsync(request).get();
+ * }
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFutureSample code: + * + *
+ * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+ * IamPolicyAnalysisQuery analysisQuery = IamPolicyAnalysisQuery.newBuilder().build();
+ * IamPolicyAnalysisOutputConfig outputConfig = IamPolicyAnalysisOutputConfig.newBuilder().build();
+ * ExportIamPolicyAnalysisRequest request = ExportIamPolicyAnalysisRequest.newBuilder()
+ * .setAnalysisQuery(analysisQuery)
+ * .setOutputConfig(outputConfig)
+ * .build();
+ * OperationFuture<ExportIamPolicyAnalysisResponse, ExportIamPolicyAnalysisRequest> future = assetServiceClient.exportIamPolicyAnalysisOperationCallable().futureCall(request);
+ * // Do something
+ * ExportIamPolicyAnalysisResponse response = future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallable<
+ ExportIamPolicyAnalysisRequest,
+ ExportIamPolicyAnalysisResponse,
+ ExportIamPolicyAnalysisRequest>
+ exportIamPolicyAnalysisOperationCallable() {
+ return stub.exportIamPolicyAnalysisOperationCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Exports IAM policy analysis based on the specified request. This API implements the
+ * [google.longrunning.Operation][google.longrunning.Operation] API allowing you to keep track of
+ * the export. The metadata contains the request to help callers to map responses to requests.
+ *
+ * Sample code: + * + *
+ * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+ * IamPolicyAnalysisQuery analysisQuery = IamPolicyAnalysisQuery.newBuilder().build();
+ * IamPolicyAnalysisOutputConfig outputConfig = IamPolicyAnalysisOutputConfig.newBuilder().build();
+ * ExportIamPolicyAnalysisRequest request = ExportIamPolicyAnalysisRequest.newBuilder()
+ * .setAnalysisQuery(analysisQuery)
+ * .setOutputConfig(outputConfig)
+ * .build();
+ * ApiFuture<Operation> future = assetServiceClient.exportIamPolicyAnalysisCallable().futureCall(request);
+ * // Do something
+ * Operation response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallableThe default instance has everything set to sensible defaults: + * + *
The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *
For example, to set the total timeout of analyzeIamPolicy to 30 seconds: + * + *
+ *
+ * AssetServiceSettings.Builder assetServiceSettingsBuilder =
+ * AssetServiceSettings.newBuilder();
+ * assetServiceSettingsBuilder
+ * .analyzeIamPolicySettings()
+ * .setRetrySettings(
+ * assetServiceSettingsBuilder.analyzeIamPolicySettings().getRetrySettings().toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * AssetServiceSettings assetServiceSettings = assetServiceSettingsBuilder.build();
+ *
+ *
+ */
+@Generated("by gapic-generator")
+@BetaApi
+public class AssetServiceSettings extends ClientSettingsNote: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction The interfaces provided are listed below, along with usage samples.
+ *
+ * ================== AssetServiceClient ==================
+ *
+ * Service Description: Asset service definition.
+ *
+ * Sample for AssetServiceClient:
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator")
+@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+public abstract class AssetServiceStub implements BackgroundResource {
+
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationsStub getOperationsStub() {
+ throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
+ }
+
+ public UnaryCallable The default instance has everything set to sensible defaults:
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ * For example, to set the total timeout of analyzeIamPolicy to 30 seconds:
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction This class is for advanced usage.
+ */
+@Generated("by gapic-generator")
+@BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+public class GrpcAssetServiceCallableFactory implements GrpcStubCallableFactory {
+ @Override
+ public This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator")
+@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+public class GrpcAssetServiceStub extends AssetServiceStub {
+
+ private static final MethodDescriptor
+ *
+ */
+@Generated("by gapic-generator")
+package com.google.cloud.asset.v1p4beta1;
+
+import javax.annotation.Generated;
diff --git a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p4beta1/stub/AssetServiceStub.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p4beta1/stub/AssetServiceStub.java
new file mode 100644
index 000000000..e446003d8
--- /dev/null
+++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p4beta1/stub/AssetServiceStub.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2020 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.v1p4beta1.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.asset.v1p4beta1.AnalyzeIamPolicyRequest;
+import com.google.cloud.asset.v1p4beta1.AnalyzeIamPolicyResponse;
+import com.google.cloud.asset.v1p4beta1.ExportIamPolicyAnalysisRequest;
+import com.google.cloud.asset.v1p4beta1.ExportIamPolicyAnalysisResponse;
+import com.google.longrunning.Operation;
+import com.google.longrunning.stub.OperationsStub;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS
+/**
+ * Base stub class for Cloud Asset API.
+ *
+ *
+ * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+ * IamPolicyAnalysisQuery analysisQuery = IamPolicyAnalysisQuery.newBuilder().build();
+ * AnalyzeIamPolicyRequest request = AnalyzeIamPolicyRequest.newBuilder()
+ * .setAnalysisQuery(analysisQuery)
+ * .build();
+ * AnalyzeIamPolicyResponse response = assetServiceClient.analyzeIamPolicy(request);
+ * }
+ *
+ *
+ *
+ *
+ *
+ *
+ */
+@Generated("by gapic-generator")
+@BetaApi
+public class AssetServiceStubSettings extends StubSettings
+ * AssetServiceStubSettings.Builder assetServiceSettingsBuilder =
+ * AssetServiceStubSettings.newBuilder();
+ * assetServiceSettingsBuilder
+ * .analyzeIamPolicySettings()
+ * .setRetrySettings(
+ * assetServiceSettingsBuilder.analyzeIamPolicySettings().getRetrySettings().toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * AssetServiceStubSettings assetServiceSettings = assetServiceSettingsBuilder.build();
+ *
+ *