Skip to content

Commit

Permalink
feat: Add client library support for AssetService v1 BatchGetEffectiv…
Browse files Browse the repository at this point in the history
…eIamPolicies API (#1300)

- [ ] Regenerate this pull request now.

Committer: haochunzhang@

PiperOrigin-RevId: 468010360

Source-Link: googleapis/googleapis@4bda299

Source-Link: https://github.com/googleapis/googleapis-gen/commit/8ed040614d04743f16cf4e4844b716fed998f94c
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOGVkMDQwNjE0ZDA0NzQzZjE2Y2Y0ZTQ4NDRiNzE2ZmVkOTk4Zjk0YyJ9

feat: Release of query system
Committer: lvv@

PiperOrigin-RevId: 466748663

Source-Link: googleapis/googleapis@80d630f

Source-Link: https://github.com/googleapis/googleapis-gen/commit/252f5ade18a31a72f12810bbfd1d83d56a8e72e1
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjUyZjVhZGUxOGEzMWE3MmYxMjgxMGJiZmQxZDgzZDU2YThlNzJlMSJ9

feat: Add client library support for AssetService v1 BatchGetEffectiveIamPolicies API
Committer: haochunzhang@

PiperOrigin-RevId: 466134014

Source-Link: googleapis/googleapis@63c73fb

Source-Link: https://github.com/googleapis/googleapis-gen/commit/2350945f7a70ecaaecf9a1fdd7d6e70ac50e862d
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjM1MDk0NWY3YTcwZWNhYWVjZjlhMWZkZDdkNmU3MGFjNTBlODYyZCJ9
  • Loading branch information
gcf-owl-bot[bot] authored Aug 16, 2022
1 parent d01d900 commit 3919a1d
Show file tree
Hide file tree
Showing 35 changed files with 13,325 additions and 388 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,13 @@ public final UnaryCallable<DeleteFeedRequest, Empty> deleteFeedCallable() {
* <li>`labels.env:&#42;` to find Cloud resources that have a label "env".
* <li>`kmsKey:key` to find Cloud resources encrypted with a customer-managed encryption key
* whose name contains the word "key".
* <li>`relationships:instance-group-1` to find Cloud resources that have relationships with
* "instance-group-1" in the related resource name.
* <li>`relationships:INSTANCE_TO_INSTANCEGROUP` to find compute instances that have
* relationships of type "INSTANCE_TO_INSTANCEGROUP".
* <li>`relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find compute instances
* that have relationships with "instance-group-1" in the compute instance group
* resource name, for relationship type "INSTANCE_TO_INSTANCEGROUP".
* <li>`state:ACTIVE` to find Cloud resources whose state contains "ACTIVE" as a word.
* <li>`NOT state:ACTIVE` to find Cloud resources whose state doesn't contain "ACTIVE" as a
* word.
Expand Down Expand Up @@ -1219,8 +1226,8 @@ public final SearchAllResourcesPagedResponse searchAllResources(
* the specified `scope`. Note that the query string is compared against each Cloud IAM policy
* binding, including its principals, roles, and Cloud IAM conditions. The returned Cloud IAM
* policies will only contain the bindings that match your query. To learn more about the IAM
* policy structure, see [IAM policy
* doc](https://cloud.google.com/iam/docs/policies#structure).
* policy structure, see the [IAM policy
* documentation](https://cloud.google.com/iam/help/allow-policies/structure).
* <p>Examples:
* <ul>
* <li>`policy:amy{@literal @}gmail.com` to find IAM policy bindings that specify user
Expand Down Expand Up @@ -1596,6 +1603,86 @@ public final UnaryCallable<AnalyzeMoveRequest, AnalyzeMoveResponse> analyzeMoveC
return stub.analyzeMoveCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Issue a job that queries assets using a SQL statement compatible with [BigQuery Standard
* SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql).
*
* <p>If the query execution finishes within timeout and there's no pagination, the full query
* results will be returned in the `QueryAssetsResponse`.
*
* <p>Otherwise, full query results can be obtained by issuing extra requests with the
* `job_reference` from the a previous `QueryAssets` call.
*
* <p>Note, the query result has approximately 10 GB limitation enforced by BigQuery
* https://cloud.google.com/bigquery/docs/best-practices-performance-output, queries return larger
* results will result in errors.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* QueryAssetsRequest request =
* QueryAssetsRequest.newBuilder()
* .setParent(FolderName.of("[FOLDER]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setTimeout(Duration.newBuilder().build())
* .setOutputConfig(QueryAssetsOutputConfig.newBuilder().build())
* .build();
* QueryAssetsResponse response = assetServiceClient.queryAssets(request);
* }
* }</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 QueryAssetsResponse queryAssets(QueryAssetsRequest request) {
return queryAssetsCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Issue a job that queries assets using a SQL statement compatible with [BigQuery Standard
* SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql).
*
* <p>If the query execution finishes within timeout and there's no pagination, the full query
* results will be returned in the `QueryAssetsResponse`.
*
* <p>Otherwise, full query results can be obtained by issuing extra requests with the
* `job_reference` from the a previous `QueryAssets` call.
*
* <p>Note, the query result has approximately 10 GB limitation enforced by BigQuery
* https://cloud.google.com/bigquery/docs/best-practices-performance-output, queries return larger
* results will result in errors.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* QueryAssetsRequest request =
* QueryAssetsRequest.newBuilder()
* .setParent(FolderName.of("[FOLDER]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setTimeout(Duration.newBuilder().build())
* .setOutputConfig(QueryAssetsOutputConfig.newBuilder().build())
* .build();
* ApiFuture<QueryAssetsResponse> future =
* assetServiceClient.queryAssetsCallable().futureCall(request);
* // Do something.
* QueryAssetsResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<QueryAssetsRequest, QueryAssetsResponse> queryAssetsCallable() {
return stub.queryAssetsCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a saved query in a parent project/folder/organization.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ public UnaryCallSettings<AnalyzeMoveRequest, AnalyzeMoveResponse> analyzeMoveSet
return ((AssetServiceStubSettings) getStubSettings()).analyzeMoveSettings();
}

/** Returns the object with the settings used for calls to queryAssets. */
public UnaryCallSettings<QueryAssetsRequest, QueryAssetsResponse> queryAssetsSettings() {
return ((AssetServiceStubSettings) getStubSettings()).queryAssetsSettings();
}

/** Returns the object with the settings used for calls to createSavedQuery. */
public UnaryCallSettings<CreateSavedQueryRequest, SavedQuery> createSavedQuerySettings() {
return ((AssetServiceStubSettings) getStubSettings()).createSavedQuerySettings();
Expand Down Expand Up @@ -409,6 +414,12 @@ public UnaryCallSettings.Builder<DeleteFeedRequest, Empty> deleteFeedSettings()
return getStubSettingsBuilder().analyzeMoveSettings();
}

/** Returns the builder for the settings used for calls to queryAssets. */
public UnaryCallSettings.Builder<QueryAssetsRequest, QueryAssetsResponse>
queryAssetsSettings() {
return getStubSettingsBuilder().queryAssetsSettings();
}

/** Returns the builder for the settings used for calls to createSavedQuery. */
public UnaryCallSettings.Builder<CreateSavedQueryRequest, SavedQuery>
createSavedQuerySettings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
"ListSavedQueries": {
"methods": ["listSavedQueries", "listSavedQueries", "listSavedQueries", "listSavedQueries", "listSavedQueries", "listSavedQueriesPagedCallable", "listSavedQueriesCallable"]
},
"QueryAssets": {
"methods": ["queryAssets", "queryAssetsCallable"]
},
"SearchAllIamPolicies": {
"methods": ["searchAllIamPolicies", "searchAllIamPolicies", "searchAllIamPoliciesPagedCallable", "searchAllIamPoliciesCallable"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
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.QueryAssetsRequest;
import com.google.cloud.asset.v1.QueryAssetsResponse;
import com.google.cloud.asset.v1.SavedQuery;
import com.google.cloud.asset.v1.SearchAllIamPoliciesRequest;
import com.google.cloud.asset.v1.SearchAllIamPoliciesResponse;
Expand Down Expand Up @@ -165,6 +167,10 @@ public UnaryCallable<AnalyzeMoveRequest, AnalyzeMoveResponse> analyzeMoveCallabl
throw new UnsupportedOperationException("Not implemented: analyzeMoveCallable()");
}

public UnaryCallable<QueryAssetsRequest, QueryAssetsResponse> queryAssetsCallable() {
throw new UnsupportedOperationException("Not implemented: queryAssetsCallable()");
}

public UnaryCallable<CreateSavedQueryRequest, SavedQuery> createSavedQueryCallable() {
throw new UnsupportedOperationException("Not implemented: createSavedQueryCallable()");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
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.QueryAssetsRequest;
import com.google.cloud.asset.v1.QueryAssetsResponse;
import com.google.cloud.asset.v1.ResourceSearchResult;
import com.google.cloud.asset.v1.SavedQuery;
import com.google.cloud.asset.v1.SearchAllIamPoliciesRequest;
Expand Down Expand Up @@ -168,6 +170,7 @@ public class AssetServiceStubSettings extends StubSettings<AssetServiceStubSetti
AnalyzeIamPolicyLongrunningMetadata>
analyzeIamPolicyLongrunningOperationSettings;
private final UnaryCallSettings<AnalyzeMoveRequest, AnalyzeMoveResponse> analyzeMoveSettings;
private final UnaryCallSettings<QueryAssetsRequest, QueryAssetsResponse> queryAssetsSettings;
private final UnaryCallSettings<CreateSavedQueryRequest, SavedQuery> createSavedQuerySettings;
private final UnaryCallSettings<GetSavedQueryRequest, SavedQuery> getSavedQuerySettings;
private final PagedCallSettings<
Expand Down Expand Up @@ -510,6 +513,11 @@ public UnaryCallSettings<AnalyzeMoveRequest, AnalyzeMoveResponse> analyzeMoveSet
return analyzeMoveSettings;
}

/** Returns the object with the settings used for calls to queryAssets. */
public UnaryCallSettings<QueryAssetsRequest, QueryAssetsResponse> queryAssetsSettings() {
return queryAssetsSettings;
}

/** Returns the object with the settings used for calls to createSavedQuery. */
public UnaryCallSettings<CreateSavedQueryRequest, SavedQuery> createSavedQuerySettings() {
return createSavedQuerySettings;
Expand Down Expand Up @@ -667,6 +675,7 @@ protected AssetServiceStubSettings(Builder settingsBuilder) throws IOException {
analyzeIamPolicyLongrunningOperationSettings =
settingsBuilder.analyzeIamPolicyLongrunningOperationSettings().build();
analyzeMoveSettings = settingsBuilder.analyzeMoveSettings().build();
queryAssetsSettings = settingsBuilder.queryAssetsSettings().build();
createSavedQuerySettings = settingsBuilder.createSavedQuerySettings().build();
getSavedQuerySettings = settingsBuilder.getSavedQuerySettings().build();
listSavedQueriesSettings = settingsBuilder.listSavedQueriesSettings().build();
Expand Down Expand Up @@ -713,6 +722,8 @@ public static class Builder extends StubSettings.Builder<AssetServiceStubSetting
analyzeIamPolicyLongrunningOperationSettings;
private final UnaryCallSettings.Builder<AnalyzeMoveRequest, AnalyzeMoveResponse>
analyzeMoveSettings;
private final UnaryCallSettings.Builder<QueryAssetsRequest, QueryAssetsResponse>
queryAssetsSettings;
private final UnaryCallSettings.Builder<CreateSavedQueryRequest, SavedQuery>
createSavedQuerySettings;
private final UnaryCallSettings.Builder<GetSavedQueryRequest, SavedQuery> getSavedQuerySettings;
Expand Down Expand Up @@ -746,6 +757,12 @@ public static class Builder extends StubSettings.Builder<AssetServiceStubSetting
"retry_policy_3_codes",
ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList(StatusCode.Code.UNAVAILABLE)));
definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
definitions.put(
"retry_policy_4_codes",
ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList(StatusCode.Code.UNAVAILABLE)));
definitions.put(
"retry_policy_6_codes",
ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList(StatusCode.Code.UNAVAILABLE)));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}

Expand Down Expand Up @@ -797,6 +814,28 @@ public static class Builder extends StubSettings.Builder<AssetServiceStubSetting
definitions.put("retry_policy_3_params", settings);
settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
definitions.put("no_retry_params", settings);
settings =
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(100L))
.setRetryDelayMultiplier(1.3)
.setMaxRetryDelay(Duration.ofMillis(60000L))
.setInitialRpcTimeout(Duration.ofMillis(200000L))
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ofMillis(200000L))
.setTotalTimeout(Duration.ofMillis(200000L))
.build();
definitions.put("retry_policy_4_params", settings);
settings =
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(100L))
.setRetryDelayMultiplier(1.3)
.setMaxRetryDelay(Duration.ofMillis(60000L))
.setInitialRpcTimeout(Duration.ofMillis(300000L))
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ofMillis(300000L))
.setTotalTimeout(Duration.ofMillis(300000L))
.build();
definitions.put("retry_policy_6_params", settings);
RETRY_PARAM_DEFINITIONS = definitions.build();
}

Expand All @@ -823,6 +862,7 @@ protected Builder(ClientContext clientContext) {
analyzeIamPolicyLongrunningSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
analyzeIamPolicyLongrunningOperationSettings = OperationCallSettings.newBuilder();
analyzeMoveSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
queryAssetsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
createSavedQuerySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
getSavedQuerySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listSavedQueriesSettings = PagedCallSettings.newBuilder(LIST_SAVED_QUERIES_PAGE_STR_FACT);
Expand All @@ -845,6 +885,7 @@ protected Builder(ClientContext clientContext) {
analyzeIamPolicySettings,
analyzeIamPolicyLongrunningSettings,
analyzeMoveSettings,
queryAssetsSettings,
createSavedQuerySettings,
getSavedQuerySettings,
listSavedQueriesSettings,
Expand Down Expand Up @@ -874,6 +915,7 @@ protected Builder(AssetServiceStubSettings settings) {
analyzeIamPolicyLongrunningOperationSettings =
settings.analyzeIamPolicyLongrunningOperationSettings.toBuilder();
analyzeMoveSettings = settings.analyzeMoveSettings.toBuilder();
queryAssetsSettings = settings.queryAssetsSettings.toBuilder();
createSavedQuerySettings = settings.createSavedQuerySettings.toBuilder();
getSavedQuerySettings = settings.getSavedQuerySettings.toBuilder();
listSavedQueriesSettings = settings.listSavedQueriesSettings.toBuilder();
Expand All @@ -897,6 +939,7 @@ protected Builder(AssetServiceStubSettings settings) {
analyzeIamPolicySettings,
analyzeIamPolicyLongrunningSettings,
analyzeMoveSettings,
queryAssetsSettings,
createSavedQuerySettings,
getSavedQuerySettings,
listSavedQueriesSettings,
Expand Down Expand Up @@ -997,6 +1040,11 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));

builder
.queryAssetsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_4_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_4_params"));

builder
.createSavedQuerySettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
Expand Down Expand Up @@ -1024,8 +1072,8 @@ private static Builder initDefaults(Builder builder) {

builder
.batchGetEffectiveIamPoliciesSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_6_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_6_params"));

builder
.exportAssetsOperationSettings()
Expand Down Expand Up @@ -1192,6 +1240,12 @@ public UnaryCallSettings.Builder<DeleteFeedRequest, Empty> deleteFeedSettings()
return analyzeMoveSettings;
}

/** Returns the builder for the settings used for calls to queryAssets. */
public UnaryCallSettings.Builder<QueryAssetsRequest, QueryAssetsResponse>
queryAssetsSettings() {
return queryAssetsSettings;
}

/** Returns the builder for the settings used for calls to createSavedQuery. */
public UnaryCallSettings.Builder<CreateSavedQueryRequest, SavedQuery>
createSavedQuerySettings() {
Expand Down
Loading

0 comments on commit 3919a1d

Please sign in to comment.