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

Commit ac94faf

Browse files
feat(v1): add AnalyzeIamPolicy and ExportIamPolicyAnalysis RPCs (#301)
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
1 parent bdc9a79 commit ac94faf

29 files changed

+32976
-128
lines changed

google-cloud-asset/src/main/java/com/google/cloud/asset/v1/AssetServiceClient.java

+149
Original file line numberDiff line numberDiff line change
@@ -1021,6 +1021,155 @@ public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies(
10211021
return stub.searchAllIamPoliciesCallable();
10221022
}
10231023

1024+
// AUTO-GENERATED DOCUMENTATION AND METHOD
1025+
/**
1026+
* Analyzes IAM policies to answer which identities have what accesses on which resources.
1027+
*
1028+
* <p>Sample code:
1029+
*
1030+
* <pre><code>
1031+
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
1032+
* IamPolicyAnalysisQuery analysisQuery = IamPolicyAnalysisQuery.newBuilder().build();
1033+
* AnalyzeIamPolicyRequest request = AnalyzeIamPolicyRequest.newBuilder()
1034+
* .setAnalysisQuery(analysisQuery)
1035+
* .build();
1036+
* AnalyzeIamPolicyResponse response = assetServiceClient.analyzeIamPolicy(request);
1037+
* }
1038+
* </code></pre>
1039+
*
1040+
* @param request The request object containing all of the parameters for the API call.
1041+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
1042+
*/
1043+
public final AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest request) {
1044+
return analyzeIamPolicyCallable().call(request);
1045+
}
1046+
1047+
// AUTO-GENERATED DOCUMENTATION AND METHOD
1048+
/**
1049+
* Analyzes IAM policies to answer which identities have what accesses on which resources.
1050+
*
1051+
* <p>Sample code:
1052+
*
1053+
* <pre><code>
1054+
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
1055+
* IamPolicyAnalysisQuery analysisQuery = IamPolicyAnalysisQuery.newBuilder().build();
1056+
* AnalyzeIamPolicyRequest request = AnalyzeIamPolicyRequest.newBuilder()
1057+
* .setAnalysisQuery(analysisQuery)
1058+
* .build();
1059+
* ApiFuture&lt;AnalyzeIamPolicyResponse&gt; future = assetServiceClient.analyzeIamPolicyCallable().futureCall(request);
1060+
* // Do something
1061+
* AnalyzeIamPolicyResponse response = future.get();
1062+
* }
1063+
* </code></pre>
1064+
*/
1065+
public final UnaryCallable<AnalyzeIamPolicyRequest, AnalyzeIamPolicyResponse>
1066+
analyzeIamPolicyCallable() {
1067+
return stub.analyzeIamPolicyCallable();
1068+
}
1069+
1070+
// AUTO-GENERATED DOCUMENTATION AND METHOD
1071+
/**
1072+
* Exports the answers of which identities have what accesses on which resources to a Google Cloud
1073+
* Storage or a BigQuery destination. For Cloud Storage destination, the output format is the JSON
1074+
* format that represents a
1075+
* [google.cloud.asset.v1.AnalyzeIamPolicyResponse][google.cloud.asset.v1.AnalyzeIamPolicyResponse].
1076+
* This method implements the [google.longrunning.Operation][google.longrunning.Operation], which
1077+
* allows you to track the export status. We recommend intervals of at least 2 seconds with
1078+
* exponential retry to poll the export operation result. The metadata contains the request to
1079+
* help callers to map responses to requests.
1080+
*
1081+
* <p>Sample code:
1082+
*
1083+
* <pre><code>
1084+
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
1085+
* IamPolicyAnalysisQuery analysisQuery = IamPolicyAnalysisQuery.newBuilder().build();
1086+
* IamPolicyAnalysisOutputConfig outputConfig = IamPolicyAnalysisOutputConfig.newBuilder().build();
1087+
* ExportIamPolicyAnalysisRequest request = ExportIamPolicyAnalysisRequest.newBuilder()
1088+
* .setAnalysisQuery(analysisQuery)
1089+
* .setOutputConfig(outputConfig)
1090+
* .build();
1091+
* ExportIamPolicyAnalysisResponse response = assetServiceClient.exportIamPolicyAnalysisAsync(request).get();
1092+
* }
1093+
* </code></pre>
1094+
*
1095+
* @param request The request object containing all of the parameters for the API call.
1096+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
1097+
*/
1098+
@BetaApi(
1099+
"The surface for long-running operations is not stable yet and may change in the future.")
1100+
public final OperationFuture<ExportIamPolicyAnalysisResponse, ExportIamPolicyAnalysisRequest>
1101+
exportIamPolicyAnalysisAsync(ExportIamPolicyAnalysisRequest request) {
1102+
return exportIamPolicyAnalysisOperationCallable().futureCall(request);
1103+
}
1104+
1105+
// AUTO-GENERATED DOCUMENTATION AND METHOD
1106+
/**
1107+
* Exports the answers of which identities have what accesses on which resources to a Google Cloud
1108+
* Storage or a BigQuery destination. For Cloud Storage destination, the output format is the JSON
1109+
* format that represents a
1110+
* [google.cloud.asset.v1.AnalyzeIamPolicyResponse][google.cloud.asset.v1.AnalyzeIamPolicyResponse].
1111+
* This method implements the [google.longrunning.Operation][google.longrunning.Operation], which
1112+
* allows you to track the export status. We recommend intervals of at least 2 seconds with
1113+
* exponential retry to poll the export operation result. The metadata contains the request to
1114+
* help callers to map responses to requests.
1115+
*
1116+
* <p>Sample code:
1117+
*
1118+
* <pre><code>
1119+
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
1120+
* IamPolicyAnalysisQuery analysisQuery = IamPolicyAnalysisQuery.newBuilder().build();
1121+
* IamPolicyAnalysisOutputConfig outputConfig = IamPolicyAnalysisOutputConfig.newBuilder().build();
1122+
* ExportIamPolicyAnalysisRequest request = ExportIamPolicyAnalysisRequest.newBuilder()
1123+
* .setAnalysisQuery(analysisQuery)
1124+
* .setOutputConfig(outputConfig)
1125+
* .build();
1126+
* OperationFuture&lt;ExportIamPolicyAnalysisResponse, ExportIamPolicyAnalysisRequest&gt; future = assetServiceClient.exportIamPolicyAnalysisOperationCallable().futureCall(request);
1127+
* // Do something
1128+
* ExportIamPolicyAnalysisResponse response = future.get();
1129+
* }
1130+
* </code></pre>
1131+
*/
1132+
@BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
1133+
public final OperationCallable<
1134+
ExportIamPolicyAnalysisRequest,
1135+
ExportIamPolicyAnalysisResponse,
1136+
ExportIamPolicyAnalysisRequest>
1137+
exportIamPolicyAnalysisOperationCallable() {
1138+
return stub.exportIamPolicyAnalysisOperationCallable();
1139+
}
1140+
1141+
// AUTO-GENERATED DOCUMENTATION AND METHOD
1142+
/**
1143+
* Exports the answers of which identities have what accesses on which resources to a Google Cloud
1144+
* Storage or a BigQuery destination. For Cloud Storage destination, the output format is the JSON
1145+
* format that represents a
1146+
* [google.cloud.asset.v1.AnalyzeIamPolicyResponse][google.cloud.asset.v1.AnalyzeIamPolicyResponse].
1147+
* This method implements the [google.longrunning.Operation][google.longrunning.Operation], which
1148+
* allows you to track the export status. We recommend intervals of at least 2 seconds with
1149+
* exponential retry to poll the export operation result. The metadata contains the request to
1150+
* help callers to map responses to requests.
1151+
*
1152+
* <p>Sample code:
1153+
*
1154+
* <pre><code>
1155+
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
1156+
* IamPolicyAnalysisQuery analysisQuery = IamPolicyAnalysisQuery.newBuilder().build();
1157+
* IamPolicyAnalysisOutputConfig outputConfig = IamPolicyAnalysisOutputConfig.newBuilder().build();
1158+
* ExportIamPolicyAnalysisRequest request = ExportIamPolicyAnalysisRequest.newBuilder()
1159+
* .setAnalysisQuery(analysisQuery)
1160+
* .setOutputConfig(outputConfig)
1161+
* .build();
1162+
* ApiFuture&lt;Operation&gt; future = assetServiceClient.exportIamPolicyAnalysisCallable().futureCall(request);
1163+
* // Do something
1164+
* Operation response = future.get();
1165+
* }
1166+
* </code></pre>
1167+
*/
1168+
public final UnaryCallable<ExportIamPolicyAnalysisRequest, Operation>
1169+
exportIamPolicyAnalysisCallable() {
1170+
return stub.exportIamPolicyAnalysisCallable();
1171+
}
1172+
10241173
@Override
10251174
public final void close() {
10261175
stub.close();

google-cloud-asset/src/main/java/com/google/cloud/asset/v1/AssetServiceSettings.java

+47
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,30 @@ public UnaryCallSettings<DeleteFeedRequest, Empty> deleteFeedSettings() {
131131
return ((AssetServiceStubSettings) getStubSettings()).searchAllIamPoliciesSettings();
132132
}
133133

134+
/** Returns the object with the settings used for calls to analyzeIamPolicy. */
135+
public UnaryCallSettings<AnalyzeIamPolicyRequest, AnalyzeIamPolicyResponse>
136+
analyzeIamPolicySettings() {
137+
return ((AssetServiceStubSettings) getStubSettings()).analyzeIamPolicySettings();
138+
}
139+
140+
/** Returns the object with the settings used for calls to exportIamPolicyAnalysis. */
141+
public UnaryCallSettings<ExportIamPolicyAnalysisRequest, Operation>
142+
exportIamPolicyAnalysisSettings() {
143+
return ((AssetServiceStubSettings) getStubSettings()).exportIamPolicyAnalysisSettings();
144+
}
145+
146+
/** Returns the object with the settings used for calls to exportIamPolicyAnalysis. */
147+
@BetaApi(
148+
"The surface for long-running operations is not stable yet and may change in the future.")
149+
public OperationCallSettings<
150+
ExportIamPolicyAnalysisRequest,
151+
ExportIamPolicyAnalysisResponse,
152+
ExportIamPolicyAnalysisRequest>
153+
exportIamPolicyAnalysisOperationSettings() {
154+
return ((AssetServiceStubSettings) getStubSettings())
155+
.exportIamPolicyAnalysisOperationSettings();
156+
}
157+
134158
public static final AssetServiceSettings create(AssetServiceStubSettings stub)
135159
throws IOException {
136160
return new AssetServiceSettings.Builder(stub.toBuilder()).build();
@@ -289,6 +313,29 @@ public UnaryCallSettings.Builder<DeleteFeedRequest, Empty> deleteFeedSettings()
289313
return getStubSettingsBuilder().searchAllIamPoliciesSettings();
290314
}
291315

316+
/** Returns the builder for the settings used for calls to analyzeIamPolicy. */
317+
public UnaryCallSettings.Builder<AnalyzeIamPolicyRequest, AnalyzeIamPolicyResponse>
318+
analyzeIamPolicySettings() {
319+
return getStubSettingsBuilder().analyzeIamPolicySettings();
320+
}
321+
322+
/** Returns the builder for the settings used for calls to exportIamPolicyAnalysis. */
323+
public UnaryCallSettings.Builder<ExportIamPolicyAnalysisRequest, Operation>
324+
exportIamPolicyAnalysisSettings() {
325+
return getStubSettingsBuilder().exportIamPolicyAnalysisSettings();
326+
}
327+
328+
/** Returns the builder for the settings used for calls to exportIamPolicyAnalysis. */
329+
@BetaApi(
330+
"The surface for long-running operations is not stable yet and may change in the future.")
331+
public OperationCallSettings.Builder<
332+
ExportIamPolicyAnalysisRequest,
333+
ExportIamPolicyAnalysisResponse,
334+
ExportIamPolicyAnalysisRequest>
335+
exportIamPolicyAnalysisOperationSettings() {
336+
return getStubSettingsBuilder().exportIamPolicyAnalysisOperationSettings();
337+
}
338+
292339
@Override
293340
public AssetServiceSettings build() throws IOException {
294341
return new AssetServiceSettings(this);

google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/AssetServiceStub.java

+24
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,16 @@
2222
import com.google.api.gax.core.BackgroundResource;
2323
import com.google.api.gax.rpc.OperationCallable;
2424
import com.google.api.gax.rpc.UnaryCallable;
25+
import com.google.cloud.asset.v1.AnalyzeIamPolicyRequest;
26+
import com.google.cloud.asset.v1.AnalyzeIamPolicyResponse;
2527
import com.google.cloud.asset.v1.BatchGetAssetsHistoryRequest;
2628
import com.google.cloud.asset.v1.BatchGetAssetsHistoryResponse;
2729
import com.google.cloud.asset.v1.CreateFeedRequest;
2830
import com.google.cloud.asset.v1.DeleteFeedRequest;
2931
import com.google.cloud.asset.v1.ExportAssetsRequest;
3032
import com.google.cloud.asset.v1.ExportAssetsResponse;
33+
import com.google.cloud.asset.v1.ExportIamPolicyAnalysisRequest;
34+
import com.google.cloud.asset.v1.ExportIamPolicyAnalysisResponse;
3135
import com.google.cloud.asset.v1.Feed;
3236
import com.google.cloud.asset.v1.GetFeedRequest;
3337
import com.google.cloud.asset.v1.ListFeedsRequest;
@@ -112,6 +116,26 @@ public UnaryCallable<DeleteFeedRequest, Empty> deleteFeedCallable() {
112116
throw new UnsupportedOperationException("Not implemented: searchAllIamPoliciesCallable()");
113117
}
114118

119+
public UnaryCallable<AnalyzeIamPolicyRequest, AnalyzeIamPolicyResponse>
120+
analyzeIamPolicyCallable() {
121+
throw new UnsupportedOperationException("Not implemented: analyzeIamPolicyCallable()");
122+
}
123+
124+
@BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
125+
public OperationCallable<
126+
ExportIamPolicyAnalysisRequest,
127+
ExportIamPolicyAnalysisResponse,
128+
ExportIamPolicyAnalysisRequest>
129+
exportIamPolicyAnalysisOperationCallable() {
130+
throw new UnsupportedOperationException(
131+
"Not implemented: exportIamPolicyAnalysisOperationCallable()");
132+
}
133+
134+
public UnaryCallable<ExportIamPolicyAnalysisRequest, Operation>
135+
exportIamPolicyAnalysisCallable() {
136+
throw new UnsupportedOperationException("Not implemented: exportIamPolicyAnalysisCallable()");
137+
}
138+
115139
@Override
116140
public abstract void close();
117141
}

0 commit comments

Comments
 (0)