# Google Cloud Asset V1 Client - Class Asset (2.3.3)

2.3.3 (latest) 2.3.2 2.2.3 2.1.3 2.0.1 1.16.4 1.14.1 1.13.2 1.12.2 1.11.3 1.10.2 1.9.2 Reference documentation and code samples for the Google Cloud Asset V1 Client class Asset.

An asset in Google Cloud. An asset can be any resource in the Google Cloud
[resource
hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy),
a resource outside the Google Cloud resource hierarchy (such as Google
Kubernetes Engine clusters and objects), or a policy (e.g. IAM policy),
or a relationship (e.g. an INSTANCE_TO_INSTANCEGROUP relationship).

See [Supported asset
types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
for more information.

Generated from protobuf message `google.cloud.asset.v1.Asset`

## Namespace

Google \\ Cloud \\ Asset \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ update_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` The last update timestamp of an asset. update_time is updated when create/update/delete operation is performed. |
| `↳ name` | `string` The full name of the asset. Example: `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1` See [Resource names](https://cloud.google.com/apis/design/resource_names#full_resource_name) for more information. |
| `↳ asset_type` | `string` The type of the asset. Example: `compute.googleapis.com/Disk` See [Supported asset types](https://cloud.google.com/asset-inventory/docs/supported-asset-types) for more information. |
| `↳ resource` | `https://docs.cloud.google.com/php/docs/reference/cloud-asset/latest/V1.Resource` A representation of the resource. |
| `↳ iam_policy` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Cloud.Iam.V1.Policy.html` A representation of the IAM policy set on a Google Cloud resource. There can be a maximum of one IAM policy set on any given resource. In addition, IAM policies inherit their granted access scope from any policies set on parent resources in the resource hierarchy. Therefore, the effectively policy is the union of both the policy set on this resource and each policy set on all of the resource's ancestry resource levels in the hierarchy. See [this topic](https://cloud.google.com/iam/help/allow-policies/inheritance) for more information. |
| `↳ org_policy` | `array<Google\Cloud\OrgPolicy\V1\Policy>` A representation of an [organization policy](https://cloud.google.com/resource-manager/docs/organization-policy/overview#organization_policy). There can be more than one organization policy with different constraints set on a given resource. |
| `↳ access_policy` | `https://docs.cloud.google.com/php/docs/reference/access-context-manager/latest/V1.AccessPolicy.html` Also refer to the [access policy user guide](https://cloud.google.com/access-context-manager/docs/overview#access-policies). |
| `↳ access_level` | `https://docs.cloud.google.com/php/docs/reference/access-context-manager/latest/V1.AccessLevel.html` Also refer to the [access level user guide](https://cloud.google.com/access-context-manager/docs/overview#access-levels). |
| `↳ service_perimeter` | `https://docs.cloud.google.com/php/docs/reference/access-context-manager/latest/V1.ServicePerimeter.html` Also refer to the [service perimeter user guide](https://cloud.google.com/vpc-service-controls/docs/overview). |
| `↳ os_inventory` | `https://docs.cloud.google.com/php/docs/reference/cloud-osconfig/latest/V1.Inventory.html` A representation of runtime OS Inventory information. See [this topic](https://cloud.google.com/compute/docs/instances/os-inventory-management) for more information. |
| `↳ related_assets` | `RelatedAssets` DEPRECATED. This field only presents for the purpose of backward-compatibility. The server will never generate responses with this field. The related assets of the asset of one relationship type. One asset only represents one type of relationship. |
| `↳ related_asset` | `https://docs.cloud.google.com/php/docs/reference/cloud-asset/latest/V1.RelatedAsset` One related asset of the current asset. |
| `↳ ancestors` | `string[]` The ancestry path of an asset in Google Cloud [resource hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy), represented as a list of relative resource names. An ancestry path starts with the closest ancestor in the hierarchy and ends at root. If the asset is a project, folder, or organization, the ancestry path starts from the asset itself. Example: `["projects/123456789", "folders/5432", "organizations/1234"]` |

### getUpdateTime

The last update timestamp of an asset. update_time is updated when
create/update/delete operation is performed.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasUpdateTime

### clearUpdateTime

### setUpdateTime

The last update timestamp of an asset. update_time is updated when
create/update/delete operation is performed.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getName

The full name of the asset. Example:
`//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`
See [Resource
names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
for more information.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

The full name of the asset. Example:
`//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`
See [Resource
names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
for more information.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAssetType

The type of the asset. Example: `compute.googleapis.com/Disk`
See [Supported asset
types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
for more information.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setAssetType

The type of the asset. Example: `compute.googleapis.com/Disk`
See [Supported asset
types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
for more information.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getResource

A representation of the resource.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-asset/latest/V1.Resource|null` |   |

### hasResource

### clearResource

### setResource

A representation of the resource.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-asset/latest/V1.Resource` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getIamPolicy

A representation of the IAM policy set on a Google Cloud resource.

There can be a maximum of one IAM policy set on any given resource.
In addition, IAM policies inherit their granted access scope from any
policies set on parent resources in the resource hierarchy. Therefore, the
effectively policy is the union of both the policy set on this resource
and each policy set on all of the resource's ancestry resource levels in
the hierarchy. See
[this topic](https://cloud.google.com/iam/help/allow-policies/inheritance)
for more information.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Cloud.Iam.V1.Policy.html|null` |   |

### hasIamPolicy

### clearIamPolicy

### setIamPolicy

A representation of the IAM policy set on a Google Cloud resource.

There can be a maximum of one IAM policy set on any given resource.
In addition, IAM policies inherit their granted access scope from any
policies set on parent resources in the resource hierarchy. Therefore, the
effectively policy is the union of both the policy set on this resource
and each policy set on all of the resource's ancestry resource levels in
the hierarchy. See
[this topic](https://cloud.google.com/iam/help/allow-policies/inheritance)
for more information.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Cloud.Iam.V1.Policy.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getOrgPolicy

A representation of an [organization
policy](https://cloud.google.com/resource-manager/docs/organization-policy/overview#organization_policy).

There can be more than one organization policy with different constraints
set on a given resource.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<Google\Cloud\OrgPolicy\V1\Policy>` |   |

### setOrgPolicy

A representation of an [organization
policy](https://cloud.google.com/resource-manager/docs/organization-policy/overview#organization_policy).

There can be more than one organization policy with different constraints
set on a given resource.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<Google\Cloud\OrgPolicy\V1\Policy>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAccessPolicy

Also refer to the [access policy user
guide](https://cloud.google.com/access-context-manager/docs/overview#access-policies).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/access-context-manager/latest/V1.AccessPolicy.html|null` |   |

### hasAccessPolicy

### setAccessPolicy

Also refer to the [access policy user
guide](https://cloud.google.com/access-context-manager/docs/overview#access-policies).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/access-context-manager/latest/V1.AccessPolicy.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAccessLevel

Also refer to the [access level user
guide](https://cloud.google.com/access-context-manager/docs/overview#access-levels).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/access-context-manager/latest/V1.AccessLevel.html|null` |   |

### hasAccessLevel

### setAccessLevel

Also refer to the [access level user
guide](https://cloud.google.com/access-context-manager/docs/overview#access-levels).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/access-context-manager/latest/V1.AccessLevel.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getServicePerimeter

Also refer to the [service perimeter user
guide](https://cloud.google.com/vpc-service-controls/docs/overview).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/access-context-manager/latest/V1.ServicePerimeter.html|null` |   |

### hasServicePerimeter

### setServicePerimeter

Also refer to the [service perimeter user
guide](https://cloud.google.com/vpc-service-controls/docs/overview).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/access-context-manager/latest/V1.ServicePerimeter.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getOsInventory

A representation of runtime OS Inventory information. See [this
topic](https://cloud.google.com/compute/docs/instances/os-inventory-management)
for more information.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-osconfig/latest/V1.Inventory.html|null` |   |

### hasOsInventory

### clearOsInventory

### setOsInventory

A representation of runtime OS Inventory information. See [this
topic](https://cloud.google.com/compute/docs/instances/os-inventory-management)
for more information.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-osconfig/latest/V1.Inventory.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRelatedAssets

DEPRECATED. This field only presents for the purpose of
backward-compatibility. The server will never generate responses with this
field.

The related assets of the asset of one relationship type. One asset
only represents one type of relationship.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `RelatedAssets|null` |   |

### hasRelatedAssets

### clearRelatedAssets

### setRelatedAssets

DEPRECATED. This field only presents for the purpose of
backward-compatibility. The server will never generate responses with this
field.

The related assets of the asset of one relationship type. One asset
only represents one type of relationship.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `RelatedAssets` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRelatedAsset

One related asset of the current asset.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-asset/latest/V1.RelatedAsset|null` |   |

### hasRelatedAsset

### clearRelatedAsset

### setRelatedAsset

One related asset of the current asset.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-asset/latest/V1.RelatedAsset` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAncestors

The ancestry path of an asset in Google Cloud [resource
hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy),
represented as a list of relative resource names. An ancestry path starts
with the closest ancestor in the hierarchy and ends at root. If the asset
is a project, folder, or organization, the ancestry path starts from the
asset itself.

Example: `["projects/123456789", "folders/5432", "organizations/1234"]`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setAncestors

The ancestry path of an asset in Google Cloud [resource
hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy),
represented as a list of relative resource names. An ancestry path starts
with the closest ancestor in the hierarchy and ends at root. If the asset
is a project, folder, or organization, the ancestry path starts from the
asset itself.

Example: `["projects/123456789", "folders/5432", "organizations/1234"]`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAccessContextPolicy

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |