Method: batchGetAssetsHistory

Batch gets the update history of assets that overlap a time window. For RESOURCE content, this API outputs history with asset in both non-delete or deleted status. 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. If a specified asset does not exist, this API returns an INVALID_ARGUMENT error.

HTTP request

GET https://cloudasset.googleapis.com/v1/{parent=*/*}:batchGetAssetsHistory

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
parent

string

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").

Authorization requires one or more of the following Google IAM permissions on the specified resource parent:

  • cloudasset.assets.exportResource
  • cloudasset.assets.exportIamPolicy

Query parameters

Parameters
assetNames

string

A list of the full names of the assets. For example: //compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1. See Resource Names and Resource name Format for more info.

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

enum(ContentType)

Required. The content type.

readTimeWindow

object(TimeWindow)

Optional. The time window for the asset history. Both startTime and endTime are optional and if set, it must be after 2018-10-02 UTC. If endTime is not set, it is default to current timestamp. If startTime is not set, the snapshot of the assets at endTime will be returned. The returned results contain all temporal assets whose time window overlap with readTimeWindow.

Request body

The request body must be empty.

Response body

If successful, the response body contains data with the following structure:

Batch get assets history response.

JSON representation
{
  "assets": [
    {
      object(TemporalAsset)
    }
  ]
}
Fields
assets[]

object(TemporalAsset)

A list of assets with valid time windows.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

TimeWindow

A time window of (startTime, endTime].

JSON representation
{
  "startTime": string,
  "endTime": string
}
Fields
startTime

string (Timestamp format)

Start time of the time window (exclusive).

A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".

endTime

string (Timestamp format)

End time of the time window (inclusive). Current timestamp if not specified.

A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".

TemporalAsset

Temporal asset. In addition to the asset, the temporal asset includes the status of the asset and valid from and to time of it.

JSON representation
{
  "window": {
    object(TimeWindow)
  },
  "deleted": boolean,
  "asset": {
    object(Asset)
  }
}
Fields
window

object(TimeWindow)

The time window when the asset data and state was observed.

deleted

boolean

If the asset is deleted or not.

asset

object(Asset)

Asset.

Asset

Cloud asset. This includes all Google Cloud Platform resources, Cloud IAM policies, and other non-GCP assets.

JSON representation
{
  "name": string,
  "assetType": string,
  "resource": {
    object(Resource)
  },
  "iamPolicy": {
    object(Policy)
  }
}
Fields
name

string

The full name of the asset. For example: //compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1. See Resource Names for more information.

assetType

string

type of the asset. Example: "compute.googleapis.com/Disk".

resource

object(Resource)

Representation of the resource.

iamPolicy

object(Policy)

Representation of the actual Cloud IAM policy set on a cloud resource. For each resource, there must be at most one Cloud IAM policy set on it.

Resource

Representation of a cloud resource.

JSON representation
{
  "version": string,
  "discoveryDocumentUri": string,
  "discoveryName": string,
  "resourceUrl": string,
  "parent": string,
  "data": {
    object
  }
}
Fields
version

string

The API version. Example: "v1".

discoveryDocumentUri

string

The URL of the discovery document containing the resource's JSON schema. For example: "https://www.googleapis.com/discovery/v1/apis/compute/v1/rest". It will be left unspecified for resources without a discovery-based API, such as Cloud Bigtable.

discoveryName

string

The JSON schema name listed in the discovery document. Example: "Project". It will be left unspecified for resources (such as Cloud Bigtable) without a discovery-based API.

resourceUrl

string

The REST URL for accessing the resource. An HTTP GET operation using this URL returns the resource itself. Example: https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123. It will be left unspecified for resources without a REST API.

parent

string

The full name of the immediate parent of this resource. See Resource Names for more information.

For GCP assets, it is the parent resource defined in the Cloud IAM policy hierarchy. For example: "//cloudresourcemanager.googleapis.com/projects/my_project_123".

For third-party assets, it is up to the users to define.

data

object (Struct format)

The content of the resource, in which some sensitive fields are scrubbed away and may not be present.

Try it!

Kunde den här sidan hjälpa dig? Berätta:

Skicka feedback om ...

Resource Manager