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

Commit ff91bef

Browse files
feat: add AnalyzeIamPolicy and AnalyzeIamPolicyLongrunning RPCs (#421)
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/816ff12b-c3e5-41e6-bb67-a4a76d38d18d/targets - [ ] To automatically regenerate this PR, check this box. PiperOrigin-RevId: 339708980 Source-Link: googleapis/googleapis@00bbad4
1 parent 7631fa1 commit ff91bef

29 files changed

+29676
-66
lines changed

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

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,6 +1021,156 @@ 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+
* Analyzes IAM policies asynchronously to answer which identities have what accesses on which
1073+
* resources, and writes the analysis results to a Google Cloud Storage or a BigQuery destination.
1074+
* For Cloud Storage destination, the output format is the JSON format that represents a
1075+
* [AnalyzeIamPolicyResponse][google.cloud.asset.v1.AnalyzeIamPolicyResponse]. This method
1076+
* implements the [google.longrunning.Operation][google.longrunning.Operation], which allows you
1077+
* to track the operation status. We recommend intervals of at least 2 seconds with exponential
1078+
* backoff retry to poll the operation result. The metadata contains the request to help callers
1079+
* 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+
* AnalyzeIamPolicyLongrunningRequest request = AnalyzeIamPolicyLongrunningRequest.newBuilder()
1088+
* .setAnalysisQuery(analysisQuery)
1089+
* .setOutputConfig(outputConfig)
1090+
* .build();
1091+
* AnalyzeIamPolicyLongrunningResponse response = assetServiceClient.analyzeIamPolicyLongrunningAsync(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<
1101+
AnalyzeIamPolicyLongrunningResponse, AnalyzeIamPolicyLongrunningRequest>
1102+
analyzeIamPolicyLongrunningAsync(AnalyzeIamPolicyLongrunningRequest request) {
1103+
return analyzeIamPolicyLongrunningOperationCallable().futureCall(request);
1104+
}
1105+
1106+
// AUTO-GENERATED DOCUMENTATION AND METHOD
1107+
/**
1108+
* Analyzes IAM policies asynchronously to answer which identities have what accesses on which
1109+
* resources, and writes the analysis results to a Google Cloud Storage or a BigQuery destination.
1110+
* For Cloud Storage destination, the output format is the JSON format that represents a
1111+
* [AnalyzeIamPolicyResponse][google.cloud.asset.v1.AnalyzeIamPolicyResponse]. This method
1112+
* implements the [google.longrunning.Operation][google.longrunning.Operation], which allows you
1113+
* to track the operation status. We recommend intervals of at least 2 seconds with exponential
1114+
* backoff retry to poll the operation result. The metadata contains the request to help callers
1115+
* to map responses to requests.
1116+
*
1117+
* <p>Sample code:
1118+
*
1119+
* <pre><code>
1120+
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
1121+
* IamPolicyAnalysisQuery analysisQuery = IamPolicyAnalysisQuery.newBuilder().build();
1122+
* IamPolicyAnalysisOutputConfig outputConfig = IamPolicyAnalysisOutputConfig.newBuilder().build();
1123+
* AnalyzeIamPolicyLongrunningRequest request = AnalyzeIamPolicyLongrunningRequest.newBuilder()
1124+
* .setAnalysisQuery(analysisQuery)
1125+
* .setOutputConfig(outputConfig)
1126+
* .build();
1127+
* OperationFuture&lt;AnalyzeIamPolicyLongrunningResponse, AnalyzeIamPolicyLongrunningRequest&gt; future = assetServiceClient.analyzeIamPolicyLongrunningOperationCallable().futureCall(request);
1128+
* // Do something
1129+
* AnalyzeIamPolicyLongrunningResponse response = future.get();
1130+
* }
1131+
* </code></pre>
1132+
*/
1133+
@BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
1134+
public final OperationCallable<
1135+
AnalyzeIamPolicyLongrunningRequest,
1136+
AnalyzeIamPolicyLongrunningResponse,
1137+
AnalyzeIamPolicyLongrunningRequest>
1138+
analyzeIamPolicyLongrunningOperationCallable() {
1139+
return stub.analyzeIamPolicyLongrunningOperationCallable();
1140+
}
1141+
1142+
// AUTO-GENERATED DOCUMENTATION AND METHOD
1143+
/**
1144+
* Analyzes IAM policies asynchronously to answer which identities have what accesses on which
1145+
* resources, and writes the analysis results to a Google Cloud Storage or a BigQuery destination.
1146+
* For Cloud Storage destination, the output format is the JSON format that represents a
1147+
* [AnalyzeIamPolicyResponse][google.cloud.asset.v1.AnalyzeIamPolicyResponse]. This method
1148+
* implements the [google.longrunning.Operation][google.longrunning.Operation], which allows you
1149+
* to track the operation status. We recommend intervals of at least 2 seconds with exponential
1150+
* backoff retry to poll the operation result. The metadata contains the request to help callers
1151+
* to map responses to requests.
1152+
*
1153+
* <p>Sample code:
1154+
*
1155+
* <pre><code>
1156+
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
1157+
* IamPolicyAnalysisQuery analysisQuery = IamPolicyAnalysisQuery.newBuilder().build();
1158+
* IamPolicyAnalysisOutputConfig outputConfig = IamPolicyAnalysisOutputConfig.newBuilder().build();
1159+
* AnalyzeIamPolicyLongrunningRequest request = AnalyzeIamPolicyLongrunningRequest.newBuilder()
1160+
* .setAnalysisQuery(analysisQuery)
1161+
* .setOutputConfig(outputConfig)
1162+
* .build();
1163+
* ApiFuture&lt;Operation&gt; future = assetServiceClient.analyzeIamPolicyLongrunningCallable().futureCall(request);
1164+
* // Do something
1165+
* Operation response = future.get();
1166+
* }
1167+
* </code></pre>
1168+
*/
1169+
public final UnaryCallable<AnalyzeIamPolicyLongrunningRequest, Operation>
1170+
analyzeIamPolicyLongrunningCallable() {
1171+
return stub.analyzeIamPolicyLongrunningCallable();
1172+
}
1173+
10241174
@Override
10251175
public final void close() {
10261176
stub.close();

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

Lines changed: 47 additions & 0 deletions
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 analyzeIamPolicyLongrunning. */
141+
public UnaryCallSettings<AnalyzeIamPolicyLongrunningRequest, Operation>
142+
analyzeIamPolicyLongrunningSettings() {
143+
return ((AssetServiceStubSettings) getStubSettings()).analyzeIamPolicyLongrunningSettings();
144+
}
145+
146+
/** Returns the object with the settings used for calls to analyzeIamPolicyLongrunning. */
147+
@BetaApi(
148+
"The surface for long-running operations is not stable yet and may change in the future.")
149+
public OperationCallSettings<
150+
AnalyzeIamPolicyLongrunningRequest,
151+
AnalyzeIamPolicyLongrunningResponse,
152+
AnalyzeIamPolicyLongrunningRequest>
153+
analyzeIamPolicyLongrunningOperationSettings() {
154+
return ((AssetServiceStubSettings) getStubSettings())
155+
.analyzeIamPolicyLongrunningOperationSettings();
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 analyzeIamPolicyLongrunning. */
323+
public UnaryCallSettings.Builder<AnalyzeIamPolicyLongrunningRequest, Operation>
324+
analyzeIamPolicyLongrunningSettings() {
325+
return getStubSettingsBuilder().analyzeIamPolicyLongrunningSettings();
326+
}
327+
328+
/** Returns the builder for the settings used for calls to analyzeIamPolicyLongrunning. */
329+
@BetaApi(
330+
"The surface for long-running operations is not stable yet and may change in the future.")
331+
public OperationCallSettings.Builder<
332+
AnalyzeIamPolicyLongrunningRequest,
333+
AnalyzeIamPolicyLongrunningResponse,
334+
AnalyzeIamPolicyLongrunningRequest>
335+
analyzeIamPolicyLongrunningOperationSettings() {
336+
return getStubSettingsBuilder().analyzeIamPolicyLongrunningOperationSettings();
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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
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.AnalyzeIamPolicyLongrunningRequest;
26+
import com.google.cloud.asset.v1.AnalyzeIamPolicyLongrunningResponse;
27+
import com.google.cloud.asset.v1.AnalyzeIamPolicyRequest;
28+
import com.google.cloud.asset.v1.AnalyzeIamPolicyResponse;
2529
import com.google.cloud.asset.v1.BatchGetAssetsHistoryRequest;
2630
import com.google.cloud.asset.v1.BatchGetAssetsHistoryResponse;
2731
import com.google.cloud.asset.v1.CreateFeedRequest;
@@ -112,6 +116,27 @@ 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+
AnalyzeIamPolicyLongrunningRequest,
127+
AnalyzeIamPolicyLongrunningResponse,
128+
AnalyzeIamPolicyLongrunningRequest>
129+
analyzeIamPolicyLongrunningOperationCallable() {
130+
throw new UnsupportedOperationException(
131+
"Not implemented: analyzeIamPolicyLongrunningOperationCallable()");
132+
}
133+
134+
public UnaryCallable<AnalyzeIamPolicyLongrunningRequest, Operation>
135+
analyzeIamPolicyLongrunningCallable() {
136+
throw new UnsupportedOperationException(
137+
"Not implemented: analyzeIamPolicyLongrunningCallable()");
138+
}
139+
115140
@Override
116141
public abstract void close();
117142
}

0 commit comments

Comments
 (0)