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.AnalyzeIamPolicyRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

analysis_query

Required. The request query.

Type

google.cloud.asset_v1p4beta1.types.IamPolicyAnalysisQuery

options

Optional. The request options.

Type

google.cloud.asset_v1p4beta1.types.AnalyzeIamPolicyRequest.Options

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

Bases: proto.message.Message

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

google.protobuf.duration_pb2.Duration

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

Bases: proto.message.Message

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

main_analysis

The main analysis that matches the original request.

Type

google.cloud.asset_v1p4beta1.types.AnalyzeIamPolicyResponse.IamPolicyAnalysis

service_account_impersonation_analysis

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

Type

Sequence[google.cloud.asset_v1p4beta1.types.AnalyzeIamPolicyResponse.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[google.cloud.asset_v1p4beta1.types.IamPolicyAnalysisResult.AnalysisState]

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

Bases: proto.message.Message

An analysis message to group the query and results.

analysis_query

The analysis query.

Type

google.cloud.asset_v1p4beta1.types.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[google.cloud.asset_v1p4beta1.types.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.ExportIamPolicyAnalysisRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

analysis_query

Required. The request query.

Type

google.cloud.asset_v1p4beta1.types.IamPolicyAnalysisQuery

options

Optional. The request options.

Type

google.cloud.asset_v1p4beta1.types.ExportIamPolicyAnalysisRequest.Options

output_config

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

Type

google.cloud.asset_v1p4beta1.types.IamPolicyAnalysisOutputConfig

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

Bases: proto.message.Message

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, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

google.cloud.asset_v1p4beta1.types.IamPolicyAnalysisOutputConfig

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

Bases: proto.message.Message

Output configuration for export IAM policy analysis destination.

gcs_destination

Destination on Cloud Storage.

This field is a member of oneof destination.

Type

google.cloud.asset_v1p4beta1.types.IamPolicyAnalysisOutputConfig.GcsDestination

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

Bases: proto.message.Message

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.IamPolicyAnalysisQuery(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

google.cloud.asset_v1p4beta1.types.IamPolicyAnalysisQuery.ResourceSelector

identity_selector

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

Type

google.cloud.asset_v1p4beta1.types.IamPolicyAnalysisQuery.IdentitySelector

access_selector

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

Type

google.cloud.asset_v1p4beta1.types.IamPolicyAnalysisQuery.AccessSelector

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

Bases: proto.message.Message

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, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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.IamPolicyAnalysisResult(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

google.iam.v1.policy_pb2.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[google.cloud.asset_v1p4beta1.types.IamPolicyAnalysisResult.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

google.cloud.asset_v1p4beta1.types.IamPolicyAnalysisResult.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, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

role

The role.

This field is a member of oneof oneof_access.

Type

str

permission

The permission.

This field is a member of oneof oneof_access.

Type

str

analysis_state

The analysis state of this access node.

Type

google.cloud.asset_v1p4beta1.types.IamPolicyAnalysisResult.AnalysisState

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

Bases: proto.message.Message

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[google.cloud.asset_v1p4beta1.types.IamPolicyAnalysisResult.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[google.cloud.asset_v1p4beta1.types.IamPolicyAnalysisResult.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[google.cloud.asset_v1p4beta1.types.IamPolicyAnalysisResult.Edge]

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

Bases: proto.message.Message

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

google.rpc.code_pb2.Code

cause

The human-readable description of the cause of failure.

Type

str

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

Bases: proto.message.Message

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, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

google.cloud.asset_v1p4beta1.types.IamPolicyAnalysisResult.AnalysisState

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

Bases: proto.message.Message

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[google.cloud.asset_v1p4beta1.types.IamPolicyAnalysisResult.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[google.cloud.asset_v1p4beta1.types.IamPolicyAnalysisResult.Edge]

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

Bases: proto.message.Message

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

google.cloud.asset_v1p4beta1.types.IamPolicyAnalysisResult.AnalysisState