Class AssetServiceClient (2.15.1)

Asset service definition.

Equality

Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection> objects compare equal. Objects that compare equal share the same underlying resources.

Performance

Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.

Thread Safety

Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.

Constructors

AssetServiceClient(AssetServiceClient const &)

Copy and move support

Parameter
Name Description
AssetServiceClient const &

AssetServiceClient(AssetServiceClient &&)

Copy and move support

Parameter
Name Description
AssetServiceClient &&

AssetServiceClient(std::shared_ptr< AssetServiceConnection >, Options)

Parameters
Name Description
connection std::shared_ptr< AssetServiceConnection >
opts Options

Operators

operator=(AssetServiceClient const &)

Copy and move support

Parameter
Name Description
AssetServiceClient const &
Returns
Type Description
AssetServiceClient &

operator=(AssetServiceClient &&)

Copy and move support

Parameter
Name Description
AssetServiceClient &&
Returns
Type Description
AssetServiceClient &

Functions

ExportAssets(google::cloud::asset::v1::ExportAssetsRequest const &, Options)

Exports assets with time and resource types to a given Cloud Storage location/BigQuery table.

For Cloud Storage location destinations, the output format is newline-delimited JSON. Each line represents a google.cloud.asset.v1.Asset in the JSON format; for BigQuery table destinations, the output table stores the fields in asset Protobuf as columns. This API implements the google.longrunning.Operation API, which allows you to keep track of the export. We recommend intervals of at least 2 seconds with exponential retry to poll the export operation result. For regular-size resource parent, the export operation usually finishes within 5 minutes.

Parameters
Name Description
request google::cloud::asset::v1::ExportAssetsRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.ExportAssetsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
future< StatusOr< google::cloud::asset::v1::ExportAssetsResponse > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.asset.v1.ExportAssetsResponse proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

ListAssets(std::string const &, Options)

Lists assets with time and resource types and returns paged results in response.

Parameters
Name Description
parent std::string const &

Required. Name of the organization, folder, or project the assets belong to. Format: "organizations/[organization-number]" (such as "organizations/123"), "projects/[project-id]" (such as "projects/my-project-id"), "projects/[project-number]" (such as "projects/12345"), or "folders/[folder-number]" (such as "folders/12345").

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::asset::v1::Asset >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.asset.v1.Asset, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListAssets(google::cloud::asset::v1::ListAssetsRequest, Options)

Lists assets with time and resource types and returns paged results in response.

Parameters
Name Description
request google::cloud::asset::v1::ListAssetsRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.ListAssetsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::asset::v1::Asset >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.asset.v1.Asset, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

BatchGetAssetsHistory(google::cloud::asset::v1::BatchGetAssetsHistoryRequest const &, Options)

Batch gets the update history of assets that overlap a time window.

For IAM_POLICY content, this API outputs history when the asset and its attached IAM POLICY both exist. This can create gaps in the output history. Otherwise, this API outputs history with asset in both non-delete or deleted status. If a specified asset does not exist, this API returns an INVALID_ARGUMENT error.

Parameters
Name Description
request google::cloud::asset::v1::BatchGetAssetsHistoryRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.BatchGetAssetsHistoryRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::asset::v1::BatchGetAssetsHistoryResponse >

the result of the RPC. The response message type (google.cloud.asset.v1.BatchGetAssetsHistoryResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

CreateFeed(std::string const &, Options)

Creates a feed in a parent project/folder/organization to listen to its asset updates.

Parameters
Name Description
parent std::string const &

Required. The name of the project/folder/organization where this feed should be created in. It can only be an organization number (such as "organizations/123"), a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id"), or a project number (such as "projects/12345").

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::asset::v1::Feed >

the result of the RPC. The response message type (google.cloud.asset.v1.Feed) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

CreateFeed(google::cloud::asset::v1::CreateFeedRequest const &, Options)

Creates a feed in a parent project/folder/organization to listen to its asset updates.

Parameters
Name Description
request google::cloud::asset::v1::CreateFeedRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.CreateFeedRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::asset::v1::Feed >

the result of the RPC. The response message type (google.cloud.asset.v1.Feed) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetFeed(std::string const &, Options)

Gets details about an asset feed.

Parameters
Name Description
name std::string const &

Required. The name of the Feed and it must be in the format of: projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id organizations/organization_number/feeds/feed_id

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::asset::v1::Feed >

the result of the RPC. The response message type (google.cloud.asset.v1.Feed) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetFeed(google::cloud::asset::v1::GetFeedRequest const &, Options)

Gets details about an asset feed.

Parameters
Name Description
request google::cloud::asset::v1::GetFeedRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.GetFeedRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::asset::v1::Feed >

the result of the RPC. The response message type (google.cloud.asset.v1.Feed) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

ListFeeds(std::string const &, Options)

Lists all asset feeds in a parent project/folder/organization.

Parameters
Name Description
parent std::string const &

Required. The parent project/folder/organization whose feeds are to be listed. It can only be using project/folder/organization number (such as "folders/12345"), or a project ID (such as "projects/my-project-id").

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::asset::v1::ListFeedsResponse >

the result of the RPC. The response message type (google.cloud.asset.v1.ListFeedsResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

ListFeeds(google::cloud::asset::v1::ListFeedsRequest const &, Options)

Lists all asset feeds in a parent project/folder/organization.

Parameters
Name Description
request google::cloud::asset::v1::ListFeedsRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.ListFeedsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::asset::v1::ListFeedsResponse >

the result of the RPC. The response message type (google.cloud.asset.v1.ListFeedsResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateFeed(google::cloud::asset::v1::Feed const &, Options)

Updates an asset feed configuration.

Parameters
Name Description
feed google::cloud::asset::v1::Feed const &

Required. The new values of feed details. It must match an existing feed and the field name must be in the format of: projects/project_number/feeds/feed_id or folders/folder_number/feeds/feed_id or organizations/organization_number/feeds/feed_id.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::asset::v1::Feed >

the result of the RPC. The response message type (google.cloud.asset.v1.Feed) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateFeed(google::cloud::asset::v1::UpdateFeedRequest const &, Options)

Updates an asset feed configuration.

Parameters
Name Description
request google::cloud::asset::v1::UpdateFeedRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.UpdateFeedRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::asset::v1::Feed >

the result of the RPC. The response message type (google.cloud.asset.v1.Feed) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

DeleteFeed(std::string const &, Options)

Deletes an asset feed.

Parameters
Name Description
name std::string const &

Required. The name of the feed and it must be in the format of: projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id organizations/organization_number/feeds/feed_id

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

DeleteFeed(google::cloud::asset::v1::DeleteFeedRequest const &, Options)

Deletes an asset feed.

Parameters
Name Description
request google::cloud::asset::v1::DeleteFeedRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.DeleteFeedRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

SearchAllResources(std::string const &, std::string const &, std::vector< std::string > const &, Options)

Searches all Google Cloud resources within the specified scope, such as a project, folder, or organization.

The caller must be granted the cloudasset.assets.searchAllResources permission on the desired scope, otherwise the request will be rejected.

Parameters
Name Description
scope std::string const &

Required. A scope can be a project, a folder, or an organization. The search is limited to the resources within the scope. The caller must be granted the cloudasset.assets.searchAllResources permission on the desired scope.
The allowed values are:

  • projects/{PROJECT_ID} (e.g., "projects/foo-bar")
  • projects/{PROJECT_NUMBER} (e.g., "projects/12345678")
  • folders/{FOLDER_NUMBER} (e.g., "folders/1234567")
  • organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
query std::string const &

Optional. The query statement. See how to construct a query for more information. If not specified or empty, it will search all the resources within the specified scope.
For more information, see SearchAllResourcesRequest.

asset_types std::vector< std::string > const &

Optional. A list of asset types that this request searches for. If empty, it will search all the searchable asset types.
Regular expressions are also supported. For example:

  • "compute.googleapis.com.*" snapshots resources whose asset type starts with "compute.googleapis.com".
  • ".*Instance" snapshots resources whose asset type ends with "Instance".
  • ".Instance." snapshots resources whose asset type contains "Instance".
    See RE2 for all supported regular expression syntax. If the regular expression does not match any supported asset type, an INVALID_ARGUMENT error will be returned.
opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::asset::v1::ResourceSearchResult >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.asset.v1.ResourceSearchResult, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

SearchAllResources(google::cloud::asset::v1::SearchAllResourcesRequest, Options)

Searches all Google Cloud resources within the specified scope, such as a project, folder, or organization.

The caller must be granted the cloudasset.assets.searchAllResources permission on the desired scope, otherwise the request will be rejected.

Parameters
Name Description
request google::cloud::asset::v1::SearchAllResourcesRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.SearchAllResourcesRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::asset::v1::ResourceSearchResult >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.asset.v1.ResourceSearchResult, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

SearchAllIamPolicies(std::string const &, std::string const &, Options)

Searches 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
Name Description
scope std::string const &

Required. A scope can be a project, a folder, or an organization. The search is limited to the IAM policies within the scope. The caller must be granted the cloudasset.assets.searchAllIamPolicies permission on the desired scope.
The allowed values are:

  • projects/{PROJECT_ID} (e.g., "projects/foo-bar")
  • projects/{PROJECT_NUMBER} (e.g., "projects/12345678")
  • folders/{FOLDER_NUMBER} (e.g., "folders/1234567")
  • organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
query std::string const &

Optional. The query statement. See how to construct a query for more information. If not specified or empty, it will search all the IAM policies within the specified scope. Note that the query string is compared against each IAM policy binding, including its principals, roles, and IAM conditions. The returned IAM policies will only contain the bindings that match your query. To learn more about the IAM policy structure, see the IAM policy documentation.
For more information, see SearchAllIamPoliciesRequest.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::asset::v1::IamPolicySearchResult >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.asset.v1.IamPolicySearchResult, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

SearchAllIamPolicies(google::cloud::asset::v1::SearchAllIamPoliciesRequest, Options)

Searches 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
Name Description
request google::cloud::asset::v1::SearchAllIamPoliciesRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.SearchAllIamPoliciesRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::asset::v1::IamPolicySearchResult >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.asset.v1.IamPolicySearchResult, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

AnalyzeIamPolicy(google::cloud::asset::v1::AnalyzeIamPolicyRequest const &, Options)

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

Parameters
Name Description
request google::cloud::asset::v1::AnalyzeIamPolicyRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.AnalyzeIamPolicyRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::asset::v1::AnalyzeIamPolicyResponse >

the result of the RPC. The response message type (google.cloud.asset.v1.AnalyzeIamPolicyResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

AnalyzeIamPolicyLongrunning(google::cloud::asset::v1::AnalyzeIamPolicyLongrunningRequest const &, Options)

Analyzes 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.

Parameters
Name Description
request google::cloud::asset::v1::AnalyzeIamPolicyLongrunningRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.AnalyzeIamPolicyLongrunningRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
future< StatusOr< google::cloud::asset::v1::AnalyzeIamPolicyLongrunningResponse > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.asset.v1.AnalyzeIamPolicyLongrunningResponse proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

AnalyzeMove(google::cloud::asset::v1::AnalyzeMoveRequest const &, Options)

Analyze moving a resource to a specified destination without kicking off the actual move.

The analysis is best effort depending on the user's permissions of viewing different hierarchical policies and configurations. The policies and configuration are subject to change before the actual resource migration takes place.

Parameters
Name Description
request google::cloud::asset::v1::AnalyzeMoveRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.AnalyzeMoveRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::asset::v1::AnalyzeMoveResponse >

the result of the RPC. The response message type (google.cloud.asset.v1.AnalyzeMoveResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

QueryAssets(google::cloud::asset::v1::QueryAssetsRequest const &, Options)

Issue a job that queries assets using a SQL statement compatible with BigQuery Standard SQL.

If the query execution finishes within timeout and there's no pagination, the full query results will be returned in the QueryAssetsResponse.

Otherwise, full query results can be obtained by issuing extra requests with the job_reference from the a previous QueryAssets call.

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.

Parameters
Name Description
request google::cloud::asset::v1::QueryAssetsRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.QueryAssetsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::asset::v1::QueryAssetsResponse >

the result of the RPC. The response message type (google.cloud.asset.v1.QueryAssetsResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

CreateSavedQuery(std::string const &, google::cloud::asset::v1::SavedQuery const &, std::string const &, Options)

Creates a saved query in a parent project/folder/organization.

Parameters
Name Description
parent std::string const &

Required. The name of the project/folder/organization where this saved_query should be created in. It can only be an organization number (such as "organizations/123"), a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id"), or a project number (such as "projects/12345").

saved_query google::cloud::asset::v1::SavedQuery const &

Required. The saved_query details. The name field must be empty as it will be generated based on the parent and saved_query_id.

saved_query_id std::string const &

Required. The ID to use for the saved query, which must be unique in the specified parent. It will become the final component of the saved query's resource name.
This value should be 4-63 characters, and valid characters are [a-z][0-9]-.
Notice that this field is required in the saved query creation, and the name field of the saved_query will be ignored.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::asset::v1::SavedQuery >

the result of the RPC. The response message type (google.cloud.asset.v1.SavedQuery) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

CreateSavedQuery(google::cloud::asset::v1::CreateSavedQueryRequest const &, Options)

Creates a saved query in a parent project/folder/organization.

Parameters
Name Description
request google::cloud::asset::v1::CreateSavedQueryRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.CreateSavedQueryRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::asset::v1::SavedQuery >

the result of the RPC. The response message type (google.cloud.asset.v1.SavedQuery) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetSavedQuery(std::string const &, Options)

Gets details about a saved query.

Parameters
Name Description
name std::string const &

Required. The name of the saved query and it must be in the format of:

  • projects/project_number/savedQueries/saved_query_id
  • folders/folder_number/savedQueries/saved_query_id
  • organizations/organization_number/savedQueries/saved_query_id
opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::asset::v1::SavedQuery >

the result of the RPC. The response message type (google.cloud.asset.v1.SavedQuery) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetSavedQuery(google::cloud::asset::v1::GetSavedQueryRequest const &, Options)

Gets details about a saved query.

Parameters
Name Description
request google::cloud::asset::v1::GetSavedQueryRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.GetSavedQueryRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::asset::v1::SavedQuery >

the result of the RPC. The response message type (google.cloud.asset.v1.SavedQuery) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

ListSavedQueries(std::string const &, Options)

Lists all saved queries in a parent project/folder/organization.

Parameters
Name Description
parent std::string const &

Required. The parent project/folder/organization whose savedQueries are to be listed. It can only be using project/folder/organization number (such as "folders/12345"), or a project ID (such as "projects/my-project-id").

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::asset::v1::SavedQuery >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.asset.v1.SavedQuery, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListSavedQueries(google::cloud::asset::v1::ListSavedQueriesRequest, Options)

Lists all saved queries in a parent project/folder/organization.

Parameters
Name Description
request google::cloud::asset::v1::ListSavedQueriesRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.ListSavedQueriesRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::asset::v1::SavedQuery >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.asset.v1.SavedQuery, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

UpdateSavedQuery(google::cloud::asset::v1::SavedQuery const &, google::protobuf::FieldMask const &, Options)

Updates a saved query.

Parameters
Name Description
saved_query google::cloud::asset::v1::SavedQuery const &

Required. The saved query to update.
The saved query's name field is used to identify the one to update, which has format as below:

  • projects/project_number/savedQueries/saved_query_id
  • folders/folder_number/savedQueries/saved_query_id
  • organizations/organization_number/savedQueries/saved_query_id
update_mask google::protobuf::FieldMask const &

Required. The list of fields to update.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::asset::v1::SavedQuery >

the result of the RPC. The response message type (google.cloud.asset.v1.SavedQuery) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateSavedQuery(google::cloud::asset::v1::UpdateSavedQueryRequest const &, Options)

Updates a saved query.

Parameters
Name Description
request google::cloud::asset::v1::UpdateSavedQueryRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.UpdateSavedQueryRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::asset::v1::SavedQuery >

the result of the RPC. The response message type (google.cloud.asset.v1.SavedQuery) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

DeleteSavedQuery(std::string const &, Options)

Deletes a saved query.

Parameters
Name Description
name std::string const &

Required. The name of the saved query to delete. It must be in the format of:

  • projects/project_number/savedQueries/saved_query_id
  • folders/folder_number/savedQueries/saved_query_id
  • organizations/organization_number/savedQueries/saved_query_id
opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

DeleteSavedQuery(google::cloud::asset::v1::DeleteSavedQueryRequest const &, Options)

Deletes a saved query.

Parameters
Name Description
request google::cloud::asset::v1::DeleteSavedQueryRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.DeleteSavedQueryRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

BatchGetEffectiveIamPolicies(google::cloud::asset::v1::BatchGetEffectiveIamPoliciesRequest const &, Options)

Gets effective IAM policies for a batch of resources.

Parameters
Name Description
request google::cloud::asset::v1::BatchGetEffectiveIamPoliciesRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::asset::v1::BatchGetEffectiveIamPoliciesResponse >

the result of the RPC. The response message type (google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

AnalyzeOrgPolicies(std::string const &, std::string const &, std::string const &, Options)

Analyzes organization policies under a scope.

Parameters
Name Description
scope std::string const &

Required. The organization to scope the request. Only organization policies within the scope will be analyzed.

  • organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
constraint std::string const &

Required. The name of the constraint to analyze organization policies for. The response only contains analyzed organization policies for the provided constraint.

filter std::string const &

The expression to filter [AnalyzeOrgPoliciesResponse.org_policy_results][google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.org_policy_results]. The only supported field is consolidated_policy.attached_resource, and the only supported operator is =.
Example: consolidated_policy.attached_resource="//cloudresourcemanager.googleapis.com/folders/001" will return the org policy results of"folders/001".

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::asset::v1::AnalyzeOrgPoliciesResponse::OrgPolicyResult >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.OrgPolicyResult, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

AnalyzeOrgPolicies(google::cloud::asset::v1::AnalyzeOrgPoliciesRequest, Options)

Analyzes organization policies under a scope.

Parameters
Name Description
request google::cloud::asset::v1::AnalyzeOrgPoliciesRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.AnalyzeOrgPoliciesRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::asset::v1::AnalyzeOrgPoliciesResponse::OrgPolicyResult >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.OrgPolicyResult, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

AnalyzeOrgPolicyGovernedContainers(std::string const &, std::string const &, std::string const &, Options)

Analyzes organization policies governed containers (projects, folders or organization) under a scope.

Parameters
Name Description
scope std::string const &

Required. The organization to scope the request. Only organization policies within the scope will be analyzed. The output containers will also be limited to the ones governed by those in-scope organization policies.

  • organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
constraint std::string const &

Required. The name of the constraint to analyze governed containers for. The analysis only contains organization policies for the provided constraint.

filter std::string const &

The expression to filter the governed containers in result. The only supported field is parent, and the only supported operator is =.
Example: parent="//cloudresourcemanager.googleapis.com/folders/001" will return all containers under "folders/001".

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::asset::v1::AnalyzeOrgPolicyGovernedContainersResponse::GovernedContainer >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

AnalyzeOrgPolicyGovernedContainers(google::cloud::asset::v1::AnalyzeOrgPolicyGovernedContainersRequest, Options)

Analyzes organization policies governed containers (projects, folders or organization) under a scope.

Parameters
Name Description
request google::cloud::asset::v1::AnalyzeOrgPolicyGovernedContainersRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::asset::v1::AnalyzeOrgPolicyGovernedContainersResponse::GovernedContainer >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

AnalyzeOrgPolicyGovernedAssets(std::string const &, std::string const &, std::string const &, Options)

Analyzes organization policies governed assets (Google Cloud resources or policies) under a scope.

This RPC supports custom constraints and the following 10 canned constraints:

  • storage.uniformBucketLevelAccess
  • iam.disableServiceAccountKeyCreation
  • iam.allowedPolicyMemberDomains
  • compute.vmExternalIpAccess
  • appengine.enforceServiceAccountActAsCheck
  • gcp.resourceLocations
  • compute.trustedImageProjects
  • compute.skipDefaultNetworkCreation
  • compute.requireOsLogin
  • compute.disableNestedVirtualization

This RPC only returns either resources of types supported by searchable asset types, or IAM policies.

Parameters
Name Description
scope std::string const &

Required. The organization to scope the request. Only organization policies within the scope will be analyzed. The output assets will also be limited to the ones governed by those in-scope organization policies.

  • organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
constraint std::string const &

Required. The name of the constraint to analyze governed assets for. The analysis only contains analyzed organization policies for the provided constraint.

filter std::string const &

The expression to filter the governed assets in result. The only supported fields for governed resources are governed_resource.project and governed_resource.folders. The only supported fields for governed iam policies are governed_iam_policy.project and governed_iam_policy.folders. The only supported operator is =.
Example 1: governed_resource.project="projects/12345678" filter will return all governed resources under projects/12345678 including the project ifself, if applicable.
Example 2: governed_iam_policy.folders="folders/12345678" filter will return all governed iam policies under folders/12345678, if applicable.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::asset::v1::AnalyzeOrgPolicyGovernedAssetsResponse::GovernedAsset >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

AnalyzeOrgPolicyGovernedAssets(google::cloud::asset::v1::AnalyzeOrgPolicyGovernedAssetsRequest, Options)

Analyzes organization policies governed assets (Google Cloud resources or policies) under a scope.

This RPC supports custom constraints and the following 10 canned constraints:

  • storage.uniformBucketLevelAccess
  • iam.disableServiceAccountKeyCreation
  • iam.allowedPolicyMemberDomains
  • compute.vmExternalIpAccess
  • appengine.enforceServiceAccountActAsCheck
  • gcp.resourceLocations
  • compute.trustedImageProjects
  • compute.skipDefaultNetworkCreation
  • compute.requireOsLogin
  • compute.disableNestedVirtualization

This RPC only returns either resources of types supported by searchable asset types, or IAM policies.

Parameters
Name Description
request google::cloud::asset::v1::AnalyzeOrgPolicyGovernedAssetsRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::asset::v1::AnalyzeOrgPolicyGovernedAssetsResponse::GovernedAsset >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.