As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

Types for Google Cloud Asset v1p4beta1 API

class google.cloud.asset_v1p4beta1.types.IamPolicyAnalysisResult(mapping=None, **kwargs)[source]

IAM Policy analysis result, consisting of one IAM policy binding and derived access control lists.

attached_resource_full_name

The full name of the resource to which the [iam_binding][google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult.iam_binding] policy attaches.

Type

str

iam_binding

The Cloud IAM policy binding under analysis.

Type

Binding

access_control_lists

The access control lists derived from the [iam_binding][google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult.iam_binding] that match or potentially match resource and access selectors specified in the request.

Type

Sequence[AccessControlList]

identity_list

The identity list derived from members of the [iam_binding][google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult.iam_binding] that match or potentially match identity selector specified in the request.

Type

IdentityList

fully_explored

Represents whether all nodes in the transitive closure of the [iam_binding][google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult.iam_binding] node have been explored.

Type

bool

class Access(mapping=None, **kwargs)[source]

A role or permission that appears in an access control list.

role

The role.

Type

str

permission

The permission.

Type

str

analysis_state

The analysis state of this access node.

Type

AnalysisState

class AccessControlList(mapping=None, **kwargs)[source]

An access control list, derived from the above IAM policy binding, which contains a set of resources and accesses. May include one item from each set to compose an access control entry.

NOTICE that there could be multiple access control lists for one IAM policy binding. The access control lists are created based on resource and access combinations.

For example, assume we have the following cases in one IAM policy binding:

  • Permission P1 and P2 apply to resource R1 and R2;

  • Permission P3 applies to resource R2 and R3;

This will result in the following access control lists:

  • AccessControlList 1: [R1, R2], [P1, P2]

  • AccessControlList 2: [R2, R3], [P3]

resources

The resources that match one of the following conditions:

  • The resource_selector, if it is specified in request;

  • Otherwise, resources reachable from the policy attached resource.

Type

Sequence[Resource]

accesses

The accesses that match one of the following conditions:

  • The access_selector, if it is specified in request;

  • Otherwise, access specifiers reachable from the policy binding’s role.

Type

Sequence[Access]

resource_edges

Resource edges of the graph starting from the policy attached resource to any descendant resources. The [Edge.source_node][google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult.Edge.source_node] contains the full resource name of a parent resource and [Edge.target_node][google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult.Edge.target_node] contains the full resource name of a child resource. This field is present only if the output_resource_edges option is enabled in request.

Type

Sequence[Edge]

class AnalysisState(mapping=None, **kwargs)[source]

Represents analysis state of each node in the result graph or non-critical errors in the response.

code

The Google standard error code that best describes the state. For example:

  • OK means the node has been successfully explored;

  • PERMISSION_DENIED means an access denied error is encountered;

  • DEADLINE_EXCEEDED means the node hasn’t been explored in time;

Type

Code

cause

The human-readable description of the cause of failure.

Type

str

class Edge(mapping=None, **kwargs)[source]

A directional edge.

source_node

The source node of the edge.

Type

str

target_node

The target node of the edge.

Type

str

class Identity(mapping=None, **kwargs)[source]

An identity that appears in an access control list.

name

The identity name in any form of members appear in IAM policy binding, such as:

  • user:foo@google.com

  • group:group1@google.com

  • serviceAccount:s1@prj1.iam.gserviceaccount.com

  • projectOwner:some_project_id

  • domain:google.com

  • allUsers

  • etc.

Type

str

analysis_state

The analysis state of this identity node.

Type

AnalysisState

class IdentityList(mapping=None, **kwargs)[source]
identities

Only the identities that match one of the following conditions will be presented:

  • The identity_selector, if it is specified in request;

  • Otherwise, identities reachable from the policy binding’s members.

Type

Sequence[Identity]

group_edges

Group identity edges of the graph starting from the binding’s group members to any node of the [identities][google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult.IdentityList.identities]. The [Edge.source_node][google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult.Edge.source_node] contains a group, such as “group:parent@google.com”. The [Edge.target_node][google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult.Edge.target_node] contains a member of the group, such as “group:child@google.com” or “user:foo@google.com”. This field is present only if the output_group_edges option is enabled in request.

Type

Sequence[Edge]

class Resource(mapping=None, **kwargs)[source]

A GCP resource that appears in an access control list.

full_resource_name

The full resource name.

Type

str

analysis_state

The analysis state of this resource node.

Type

AnalysisState

class google.cloud.asset_v1p4beta1.types.IamPolicyAnalysisQuery(mapping=None, **kwargs)[source]

IAM policy analysis query message.

parent

Required. The relative name of the root asset. Only resources and IAM policies within the parent will be analyzed. This can only be an organization number (such as “organizations/123”) or a folder number (such as “folders/123”).

Type

str

resource_selector

Optional. Specifies a resource for analysis. Leaving it empty means ANY.

Type

ResourceSelector

identity_selector

Optional. Specifies an identity for analysis. Leaving it empty means ANY.

Type

IdentitySelector

access_selector

Optional. Specifies roles or permissions for analysis. Leaving it empty means ANY.

Type

AccessSelector

class AccessSelector(mapping=None, **kwargs)[source]

Specifies roles and/or permissions to analyze, to determine both the identities possessing them and the resources they control. If multiple values are specified, results will include identities and resources matching any of them.

roles

Optional. The roles to appear in result.

Type

Sequence[str]

permissions

Optional. The permissions to appear in result.

Type

Sequence[str]

class IdentitySelector(mapping=None, **kwargs)[source]

Specifies an identity for which to determine resource access, based on roles assigned either directly to them or to the groups they belong to, directly or indirectly.

identity

Required. The identity appear in the form of members in IAM policy binding.

Type

str

class ResourceSelector(mapping=None, **kwargs)[source]

Specifies the resource to analyze for access policies, which may be set directly on the resource, or on ancestors such as organizations, folders or projects. At least one of [ResourceSelector][google.cloud.asset.v1p4beta1.IamPolicyAnalysisQuery.ResourceSelector], [IdentitySelector][google.cloud.asset.v1p4beta1.IamPolicyAnalysisQuery.IdentitySelector] or [AccessSelector][google.cloud.asset.v1p4beta1.IamPolicyAnalysisQuery.AccessSelector] must be specified in a request.

full_resource_name

Required. The full resource name .

Type

str

class google.cloud.asset_v1p4beta1.types.AnalyzeIamPolicyRequest(mapping=None, **kwargs)[source]

A request message for [AssetService.AnalyzeIamPolicy][google.cloud.asset.v1p4beta1.AssetService.AnalyzeIamPolicy].

analysis_query

Required. The request query.

Type

IamPolicyAnalysisQuery

options

Optional. The request options.

Type

Options

class Options(mapping=None, **kwargs)[source]

Contains request options.

expand_groups

Optional. If true, the identities section of the result will expand any Google groups appearing in an IAM policy binding.

If [identity_selector][] is specified, the identity in the result will be determined by the selector, and this flag will have no effect.

Default is false.

Type

bool

expand_roles

Optional. If true, the access section of result will expand any roles appearing in IAM policy bindings to include their permissions.

If [access_selector][] is specified, the access section of the result will be determined by the selector, and this flag will have no effect.

Default is false.

Type

bool

expand_resources

Optional. If true, the resource section of the result will expand any resource attached to an IAM policy to include resources lower in the resource hierarchy.

For example, if the request analyzes for which resources user A has permission P, and the results include an IAM policy with P on a GCP folder, the results will also include resources in that folder with permission P.

If [resource_selector][] is specified, the resource section of the result will be determined by the selector, and this flag will have no effect. Default is false.

Type

bool

output_resource_edges

Optional. If true, the result will output resource edges, starting from the policy attached resource, to any expanded resources. Default is false.

Type

bool

output_group_edges

Optional. If true, the result will output group identity edges, starting from the binding’s group members, to any expanded identities. Default is false.

Type

bool

analyze_service_account_impersonation

Optional. If true, the response will include access analysis from identities to resources via service account impersonation. This is a very expensive operation, because many derived queries will be executed. We highly recommend you use ExportIamPolicyAnalysis rpc instead.

For example, if the request analyzes for which resources user A has permission P, and there’s an IAM policy states user A has iam.serviceAccounts.getAccessToken permission to a service account SA, and there’s another IAM policy states service account SA has permission P to a GCP folder F, then user A potentially has access to the GCP folder F. And those advanced analysis results will be included in [AnalyzeIamPolicyResponse.service_account_impersonation_analysis][google.cloud.asset.v1p4beta1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis].

Another example, if the request analyzes for who has permission P to a GCP folder F, and there’s an IAM policy states user A has iam.serviceAccounts.actAs permission to a service account SA, and there’s another IAM policy states service account SA has permission P to the GCP folder F, then user A potentially has access to the GCP folder F. And those advanced analysis results will be included in [AnalyzeIamPolicyResponse.service_account_impersonation_analysis][google.cloud.asset.v1p4beta1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis].

Default is false.

Type

bool

execution_timeout

Optional. Amount of time executable has to complete. See JSON representation of Duration.

If this field is set with a value less than the RPC deadline, and the execution of your query hasn’t finished in the specified execution timeout, you will get a response with partial result. Otherwise, your query’s execution will continue until the RPC deadline. If it’s not finished until then, you will get a DEADLINE_EXCEEDED error.

Default is empty.

Type

Duration

class google.cloud.asset_v1p4beta1.types.AnalyzeIamPolicyResponse(mapping=None, **kwargs)[source]

A response message for [AssetService.AnalyzeIamPolicy][google.cloud.asset.v1p4beta1.AssetService.AnalyzeIamPolicy].

main_analysis

The main analysis that matches the original request.

Type

IamPolicyAnalysis

service_account_impersonation_analysis

The service account impersonation analysis if [AnalyzeIamPolicyRequest.analyze_service_account_impersonation][] is enabled.

Type

Sequence[IamPolicyAnalysis]

fully_explored

Represents whether all entries in the [main_analysis][google.cloud.asset.v1p4beta1.AnalyzeIamPolicyResponse.main_analysis] and [service_account_impersonation_analysis][google.cloud.asset.v1p4beta1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis] have been fully explored to answer the query in the request.

Type

bool

non_critical_errors

A list of non-critical errors happened during the request handling to explain why fully_explored is false, or empty if no error happened.

Type

Sequence[AnalysisState]

class IamPolicyAnalysis(mapping=None, **kwargs)[source]

An analysis message to group the query and results.

analysis_query

The analysis query.

Type

IamPolicyAnalysisQuery

analysis_results

A list of [IamPolicyAnalysisResult][google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult] that matches the analysis query, or empty if no result is found.

Type

Sequence[IamPolicyAnalysisResult]

fully_explored

Represents whether all entries in the [analysis_results][google.cloud.asset.v1p4beta1.AnalyzeIamPolicyResponse.IamPolicyAnalysis.analysis_results] have been fully explored to answer the query.

Type

bool

class google.cloud.asset_v1p4beta1.types.IamPolicyAnalysisOutputConfig(mapping=None, **kwargs)[source]

Output configuration for export IAM policy analysis destination.

gcs_destination

Destination on Cloud Storage.

Type

GcsDestination

class GcsDestination(mapping=None, **kwargs)[source]

A Cloud Storage location.

uri

Required. The uri of the Cloud Storage object. It’s the same uri that is used by gsutil. For example: “gs://bucket_name/object_name”. See Viewing and Editing Object Metadata for more information.

Type

str

class google.cloud.asset_v1p4beta1.types.ExportIamPolicyAnalysisRequest(mapping=None, **kwargs)[source]

A request message for [AssetService.ExportIamPolicyAnalysis][google.cloud.asset.v1p4beta1.AssetService.ExportIamPolicyAnalysis].

analysis_query

Required. The request query.

Type

IamPolicyAnalysisQuery

options

Optional. The request options.

Type

Options

output_config

Required. Output configuration indicating where the results will be output to.

Type

IamPolicyAnalysisOutputConfig

class Options(mapping=None, **kwargs)[source]

Contains request options.

expand_groups

Optional. If true, the identities section of the result will expand any Google groups appearing in an IAM policy binding.

If [identity_selector][] is specified, the identity in the result will be determined by the selector, and this flag will have no effect.

Default is false.

Type

bool

expand_roles

Optional. If true, the access section of result will expand any roles appearing in IAM policy bindings to include their permissions.

If [access_selector][] is specified, the access section of the result will be determined by the selector, and this flag will have no effect.

Default is false.

Type

bool

expand_resources

Optional. If true, the resource section of the result will expand any resource attached to an IAM policy to include resources lower in the resource hierarchy.

For example, if the request analyzes for which resources user A has permission P, and the results include an IAM policy with P on a GCP folder, the results will also include resources in that folder with permission P.

If [resource_selector][] is specified, the resource section of the result will be determined by the selector, and this flag will have no effect. Default is false.

Type

bool

output_resource_edges

Optional. If true, the result will output resource edges, starting from the policy attached resource, to any expanded resources. Default is false.

Type

bool

output_group_edges

Optional. If true, the result will output group identity edges, starting from the binding’s group members, to any expanded identities. Default is false.

Type

bool

analyze_service_account_impersonation

Optional. If true, the response will include access analysis from identities to resources via service account impersonation. This is a very expensive operation, because many derived queries will be executed.

For example, if the request analyzes for which resources user A has permission P, and there’s an IAM policy states user A has iam.serviceAccounts.getAccessToken permission to a service account SA, and there’s another IAM policy states service account SA has permission P to a GCP folder F, then user A potentially has access to the GCP folder F. And those advanced analysis results will be included in [AnalyzeIamPolicyResponse.service_account_impersonation_analysis][google.cloud.asset.v1p4beta1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis].

Another example, if the request analyzes for who has permission P to a GCP folder F, and there’s an IAM policy states user A has iam.serviceAccounts.actAs permission to a service account SA, and there’s another IAM policy states service account SA has permission P to the GCP folder F, then user A potentially has access to the GCP folder F. And those advanced analysis results will be included in [AnalyzeIamPolicyResponse.service_account_impersonation_analysis][google.cloud.asset.v1p4beta1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis].

Default is false.

Type

bool

class google.cloud.asset_v1p4beta1.types.ExportIamPolicyAnalysisResponse(mapping=None, **kwargs)[source]

The export IAM policy analysis response. This message is returned by the [google.longrunning.Operations.GetOperation][] method in the returned [google.longrunning.Operation.response][] field.

output_config

Output configuration indicating where the results were output to.

Type

IamPolicyAnalysisOutputConfig