Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Commit

Permalink
feat(v1): add AnalyzeIamPolicy and ExportIamPolicyAnalysis RPCs (#301)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 328059685

Source-Author: Google APIs <noreply@google.com>
Source-Date: Sun Aug 23 17:12:48 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 72eb54c45231d84266ca059473bc1793c394fcb2
Source-Link: googleapis/googleapis@72eb54c
  • Loading branch information
yoshi-automation authored Aug 24, 2020
1 parent bdc9a79 commit ac94faf
Show file tree
Hide file tree
Showing 29 changed files with 32,976 additions and 128 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,155 @@ public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies(
return stub.searchAllIamPoliciesCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Analyzes IAM policies to answer which identities have what accesses on which resources.
*
* <p>Sample code:
*
* <pre><code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* IamPolicyAnalysisQuery analysisQuery = IamPolicyAnalysisQuery.newBuilder().build();
* AnalyzeIamPolicyRequest request = AnalyzeIamPolicyRequest.newBuilder()
* .setAnalysisQuery(analysisQuery)
* .build();
* AnalyzeIamPolicyResponse response = assetServiceClient.analyzeIamPolicy(request);
* }
* </code></pre>
*
* @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 to answer which identities have what accesses on which resources.
*
* <p>Sample code:
*
* <pre><code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* IamPolicyAnalysisQuery analysisQuery = IamPolicyAnalysisQuery.newBuilder().build();
* AnalyzeIamPolicyRequest request = AnalyzeIamPolicyRequest.newBuilder()
* .setAnalysisQuery(analysisQuery)
* .build();
* ApiFuture&lt;AnalyzeIamPolicyResponse&gt; future = assetServiceClient.analyzeIamPolicyCallable().futureCall(request);
* // Do something
* AnalyzeIamPolicyResponse response = future.get();
* }
* </code></pre>
*/
public final UnaryCallable<AnalyzeIamPolicyRequest, AnalyzeIamPolicyResponse>
analyzeIamPolicyCallable() {
return stub.analyzeIamPolicyCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Exports the answers of which identities have what accesses on which resources to a Google Cloud
* Storage or a BigQuery destination. For Cloud Storage destination, the output format is the JSON
* format that represents a
* [google.cloud.asset.v1.AnalyzeIamPolicyResponse][google.cloud.asset.v1.AnalyzeIamPolicyResponse].
* This method implements the [google.longrunning.Operation][google.longrunning.Operation], which
* allows you to track the export status. We recommend intervals of at least 2 seconds with
* exponential retry to poll the export operation result. The metadata contains the request to
* help callers to map responses to requests.
*
* <p>Sample code:
*
* <pre><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();
* }
* </code></pre>
*
* @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 OperationFuture<ExportIamPolicyAnalysisResponse, ExportIamPolicyAnalysisRequest>
exportIamPolicyAnalysisAsync(ExportIamPolicyAnalysisRequest request) {
return exportIamPolicyAnalysisOperationCallable().futureCall(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Exports the answers of which identities have what accesses on which resources to a Google Cloud
* Storage or a BigQuery destination. For Cloud Storage destination, the output format is the JSON
* format that represents a
* [google.cloud.asset.v1.AnalyzeIamPolicyResponse][google.cloud.asset.v1.AnalyzeIamPolicyResponse].
* This method implements the [google.longrunning.Operation][google.longrunning.Operation], which
* allows you to track the export status. We recommend intervals of at least 2 seconds with
* exponential retry to poll the export operation result. The metadata contains the request to
* help callers to map responses to requests.
*
* <p>Sample code:
*
* <pre><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&lt;ExportIamPolicyAnalysisResponse, ExportIamPolicyAnalysisRequest&gt; future = assetServiceClient.exportIamPolicyAnalysisOperationCallable().futureCall(request);
* // Do something
* ExportIamPolicyAnalysisResponse response = future.get();
* }
* </code></pre>
*/
@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 the answers of which identities have what accesses on which resources to a Google Cloud
* Storage or a BigQuery destination. For Cloud Storage destination, the output format is the JSON
* format that represents a
* [google.cloud.asset.v1.AnalyzeIamPolicyResponse][google.cloud.asset.v1.AnalyzeIamPolicyResponse].
* This method implements the [google.longrunning.Operation][google.longrunning.Operation], which
* allows you to track the export status. We recommend intervals of at least 2 seconds with
* exponential retry to poll the export operation result. The metadata contains the request to
* help callers to map responses to requests.
*
* <p>Sample code:
*
* <pre><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&lt;Operation&gt; future = assetServiceClient.exportIamPolicyAnalysisCallable().futureCall(request);
* // Do something
* Operation response = future.get();
* }
* </code></pre>
*/
public final UnaryCallable<ExportIamPolicyAnalysisRequest, Operation>
exportIamPolicyAnalysisCallable() {
return stub.exportIamPolicyAnalysisCallable();
}

@Override
public final void close() {
stub.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,30 @@ public UnaryCallSettings<DeleteFeedRequest, Empty> deleteFeedSettings() {
return ((AssetServiceStubSettings) getStubSettings()).searchAllIamPoliciesSettings();
}

/** Returns the object with the settings used for calls to analyzeIamPolicy. */
public UnaryCallSettings<AnalyzeIamPolicyRequest, AnalyzeIamPolicyResponse>
analyzeIamPolicySettings() {
return ((AssetServiceStubSettings) getStubSettings()).analyzeIamPolicySettings();
}

/** Returns the object with the settings used for calls to exportIamPolicyAnalysis. */
public UnaryCallSettings<ExportIamPolicyAnalysisRequest, Operation>
exportIamPolicyAnalysisSettings() {
return ((AssetServiceStubSettings) getStubSettings()).exportIamPolicyAnalysisSettings();
}

/** Returns the object with the settings used for calls to exportIamPolicyAnalysis. */
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
public OperationCallSettings<
ExportIamPolicyAnalysisRequest,
ExportIamPolicyAnalysisResponse,
ExportIamPolicyAnalysisRequest>
exportIamPolicyAnalysisOperationSettings() {
return ((AssetServiceStubSettings) getStubSettings())
.exportIamPolicyAnalysisOperationSettings();
}

public static final AssetServiceSettings create(AssetServiceStubSettings stub)
throws IOException {
return new AssetServiceSettings.Builder(stub.toBuilder()).build();
Expand Down Expand Up @@ -289,6 +313,29 @@ public UnaryCallSettings.Builder<DeleteFeedRequest, Empty> deleteFeedSettings()
return getStubSettingsBuilder().searchAllIamPoliciesSettings();
}

/** Returns the builder for the settings used for calls to analyzeIamPolicy. */
public UnaryCallSettings.Builder<AnalyzeIamPolicyRequest, AnalyzeIamPolicyResponse>
analyzeIamPolicySettings() {
return getStubSettingsBuilder().analyzeIamPolicySettings();
}

/** Returns the builder for the settings used for calls to exportIamPolicyAnalysis. */
public UnaryCallSettings.Builder<ExportIamPolicyAnalysisRequest, Operation>
exportIamPolicyAnalysisSettings() {
return getStubSettingsBuilder().exportIamPolicyAnalysisSettings();
}

/** Returns the builder for the settings used for calls to exportIamPolicyAnalysis. */
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
public OperationCallSettings.Builder<
ExportIamPolicyAnalysisRequest,
ExportIamPolicyAnalysisResponse,
ExportIamPolicyAnalysisRequest>
exportIamPolicyAnalysisOperationSettings() {
return getStubSettingsBuilder().exportIamPolicyAnalysisOperationSettings();
}

@Override
public AssetServiceSettings build() throws IOException {
return new AssetServiceSettings(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@
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.v1.AnalyzeIamPolicyRequest;
import com.google.cloud.asset.v1.AnalyzeIamPolicyResponse;
import com.google.cloud.asset.v1.BatchGetAssetsHistoryRequest;
import com.google.cloud.asset.v1.BatchGetAssetsHistoryResponse;
import com.google.cloud.asset.v1.CreateFeedRequest;
import com.google.cloud.asset.v1.DeleteFeedRequest;
import com.google.cloud.asset.v1.ExportAssetsRequest;
import com.google.cloud.asset.v1.ExportAssetsResponse;
import com.google.cloud.asset.v1.ExportIamPolicyAnalysisRequest;
import com.google.cloud.asset.v1.ExportIamPolicyAnalysisResponse;
import com.google.cloud.asset.v1.Feed;
import com.google.cloud.asset.v1.GetFeedRequest;
import com.google.cloud.asset.v1.ListFeedsRequest;
Expand Down Expand Up @@ -112,6 +116,26 @@ public UnaryCallable<DeleteFeedRequest, Empty> deleteFeedCallable() {
throw new UnsupportedOperationException("Not implemented: searchAllIamPoliciesCallable()");
}

public UnaryCallable<AnalyzeIamPolicyRequest, AnalyzeIamPolicyResponse>
analyzeIamPolicyCallable() {
throw new UnsupportedOperationException("Not implemented: analyzeIamPolicyCallable()");
}

@BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallable<
ExportIamPolicyAnalysisRequest,
ExportIamPolicyAnalysisResponse,
ExportIamPolicyAnalysisRequest>
exportIamPolicyAnalysisOperationCallable() {
throw new UnsupportedOperationException(
"Not implemented: exportIamPolicyAnalysisOperationCallable()");
}

public UnaryCallable<ExportIamPolicyAnalysisRequest, Operation>
exportIamPolicyAnalysisCallable() {
throw new UnsupportedOperationException("Not implemented: exportIamPolicyAnalysisCallable()");
}

@Override
public abstract void close();
}
Loading

0 comments on commit ac94faf

Please sign in to comment.