Skip to main content

cloudasset_iam_policies

Creates, updates, deletes, gets or lists a cloudasset_iam_policies resource.

Overview​

Namecloudasset_iam_policies
TypeResource
Idgoogle.cloudasset.cloudasset_iam_policies

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
policyResultsarrayThe effective policies for a batch of resources. Note that the results order is the same as the order of BatchGetEffectiveIamPoliciesRequest.names. When a resource does not have any effective IAM policies, its corresponding policy_result will contain empty EffectiveIamPolicy.policies.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
batch_getselectscopenamesGets effective IAM policies for a batch of resources.
analyze_iam_policyexecscopeanalysisQuery.accessSelector.permissions, analysisQuery.accessSelector.roles, analysisQuery.conditionContext.accessTime, analysisQuery.identitySelector.identity, analysisQuery.options.analyzeServiceAccountImpersonation, analysisQuery.options.expandGroups, analysisQuery.options.expandResources, analysisQuery.options.expandRoles, analysisQuery.options.outputGroupEdges, analysisQuery.options.outputResourceEdges, analysisQuery.resourceSelector.fullResourceName, executionTimeout, savedAnalysisQueryAnalyzes IAM policies to answer which identities have what accesses on which resources.
analyze_iam_policy_longrunningexecscopeAnalyzes IAM policies asynchronously to answer which identities have what accesses on which resources, and writes the analysis results to a Google Cloud Storage or a BigQuery destination. For Cloud Storage destination, the output format is the JSON format that represents a AnalyzeIamPolicyResponse. This method implements the google.longrunning.Operation, which allows you to track the operation status. We recommend intervals of at least 2 seconds with exponential backoff retry to poll the operation result. The metadata contains the metadata for the long-running operation.
search_all_iam_policiesexecscopeassetTypes, orderBy, pageSize, pageToken, querySearches all IAM policies within the specified scope, such as a project, folder, or organization. The caller must be granted the cloudasset.assets.searchAllIamPolicies permission on the desired scope, otherwise the request will be rejected.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
scopestring
analysisQuery.accessSelector.permissionsstring
analysisQuery.accessSelector.rolesstring
analysisQuery.conditionContext.accessTimestring (google-datetime)
analysisQuery.identitySelector.identitystring
analysisQuery.options.analyzeServiceAccountImpersonationboolean
analysisQuery.options.expandGroupsboolean
analysisQuery.options.expandResourcesboolean
analysisQuery.options.expandRolesboolean
analysisQuery.options.outputGroupEdgesboolean
analysisQuery.options.outputResourceEdgesboolean
analysisQuery.resourceSelector.fullResourceNamestring
assetTypesstring
executionTimeoutstring (google-duration)
namesstring
orderBystring
pageSizeinteger (int32)
pageTokenstring
querystring
savedAnalysisQuerystring

SELECT examples​

Gets effective IAM policies for a batch of resources.

SELECT
policyResults
FROM google.cloudasset.cloudasset_iam_policies
WHERE scope = '{{ scope }}' -- required
AND names = '{{ names }}'
;

Lifecycle Methods​

Analyzes IAM policies to answer which identities have what accesses on which resources.

EXEC google.cloudasset.cloudasset_iam_policies.analyze_iam_policy
@scope='{{ scope }}' --required,
@analysisQuery.accessSelector.permissions='{{ analysisQuery.accessSelector.permissions }}',
@analysisQuery.accessSelector.roles='{{ analysisQuery.accessSelector.roles }}',
@analysisQuery.conditionContext.accessTime='{{ analysisQuery.conditionContext.accessTime }}',
@analysisQuery.identitySelector.identity='{{ analysisQuery.identitySelector.identity }}',
@analysisQuery.options.analyzeServiceAccountImpersonation={{ analysisQuery.options.analyzeServiceAccountImpersonation }},
@analysisQuery.options.expandGroups={{ analysisQuery.options.expandGroups }},
@analysisQuery.options.expandResources={{ analysisQuery.options.expandResources }},
@analysisQuery.options.expandRoles={{ analysisQuery.options.expandRoles }},
@analysisQuery.options.outputGroupEdges={{ analysisQuery.options.outputGroupEdges }},
@analysisQuery.options.outputResourceEdges={{ analysisQuery.options.outputResourceEdges }},
@analysisQuery.resourceSelector.fullResourceName='{{ analysisQuery.resourceSelector.fullResourceName }}',
@executionTimeout='{{ executionTimeout }}',
@savedAnalysisQuery='{{ savedAnalysisQuery }}'
;