batchGetAssetsHistory method
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.
Request parameters:
parent
- Required. The relative name of the root asset. It can only be
an organization number (such as "organizations/123"), a project ID (such
as "projects/my-project-id")", or a project number (such as
"projects/12345").
Value must have pattern ^\[^/\]+/\[^/\]+$
.
assetNames
- A list of the full names of the assets. See:
https://cloud.google.com/asset-inventory/docs/resource-name-format
Example:
//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1
.
The request becomes a no-op if the asset name list is empty, and the max
size of the asset name list is 100 in one request.
contentType
- Optional. The content type.
Possible string values are:
- "CONTENT_TYPE_UNSPECIFIED" : Unspecified content type.
- "RESOURCE" : Resource metadata.
- "IAM_POLICY" : The actual IAM policy set on a resource.
- "ORG_POLICY" : The organization policy set on an asset.
- "ACCESS_POLICY" : The Access Context Manager policy set on an asset.
- "OS_INVENTORY" : The runtime OS Inventory information.
- "RELATIONSHIP" : The related resources.
readTimeWindow_endTime
- End time of the time window (inclusive). If not
specified, the current timestamp is used instead.
readTimeWindow_startTime
- Start time of the time window (exclusive).
relationshipTypes
- Optional. A list of relationship types to output,
for example: INSTANCE_TO_INSTANCEGROUP
. This field should only be
specified if content_type=RELATIONSHIP. * If specified: it outputs
specified relationships' history on the [asset_names]. It returns an
error if any of the [relationship_types] doesn't belong to the supported
relationship types of the [asset_names] or if any of the
[asset_names]'s types doesn't belong to the source types of the
[relationship_types]. * Otherwise: it outputs the supported
relationships' history on the [asset_names] or returns an error if any
of the [asset_names]'s types has no relationship support. See
Introduction to Cloud Asset Inventory
for all supported asset types and relationship types.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a BatchGetAssetsHistoryResponse.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<BatchGetAssetsHistoryResponse> batchGetAssetsHistory(
core.String parent, {
core.List<core.String>? assetNames,
core.String? contentType,
core.String? readTimeWindow_endTime,
core.String? readTimeWindow_startTime,
core.List<core.String>? relationshipTypes,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
if (assetNames != null) 'assetNames': assetNames,
if (contentType != null) 'contentType': [contentType],
if (readTimeWindow_endTime != null)
'readTimeWindow.endTime': [readTimeWindow_endTime],
if (readTimeWindow_startTime != null)
'readTimeWindow.startTime': [readTimeWindow_startTime],
if (relationshipTypes != null) 'relationshipTypes': relationshipTypes,
if ($fields != null) 'fields': [$fields],
};
final url_ =
'v1/' + core.Uri.encodeFull('$parent') + ':batchGetAssetsHistory';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return BatchGetAssetsHistoryResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}