# Google Cloud Asset V1 Client - Class RelatedAsset (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 RelatedAsset.

An asset identifier in Google Cloud which contains its name, type and
ancestors. 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).

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.RelatedAsset`

## Namespace

Google \\ Cloud \\ Asset \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ asset` | `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. |
| `↳ ancestors` | `string[]` The ancestors 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. Example: `["projects/123456789", "folders/5432", "organizations/1234"]` |
| `↳ relationship_type` | `string` The unique identifier of the relationship type. Example: `INSTANCE_TO_INSTANCEGROUP` |

### getAsset

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` |   |

### setAsset

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` |   |

### getAncestors

The ancestors 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.

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

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

### setAncestors

The ancestors 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.

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

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

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

### getRelationshipType

The unique identifier of the relationship type. Example:
`INSTANCE_TO_INSTANCEGROUP`

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

### setRelationshipType

The unique identifier of the relationship type. Example:
`INSTANCE_TO_INSTANCEGROUP`

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

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