# Compute V1 Client - Class LicenseCode (2.10.0)

2.10.0 (latest) 2.9.0 2.8.0 2.7.0 2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.1 2.0.0 1.36.0 1.35.0 1.34.0 1.33.0 1.32.0 1.31.0 1.30.0 1.29.0 1.28.0 1.27.0 1.26.0 1.25.0 1.24.0 1.23.0 1.22.1 1.21.0 1.20.0 1.19.0 1.18.1 1.17.0 1.16.2 1.14.0 1.13.0 1.12.1 1.11.1 1.10.1 1.9.1 1.8.3 1.7.1 1.6.1 1.5.0 Reference documentation and code samples for the Compute V1 Client class LicenseCode.

Represents a License Code resource.

A License Code is a unique identifier used to represent alicense
resource.
*Caution* This resource is intended for
use only by third-party partners who are creatingCloud Marketplace
images.

Generated from protobuf message `google.cloud.compute.v1.LicenseCode`

## Namespace

Google \\ Cloud \\ Compute \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ allowed_replacement_licenses` | `string[]` Specifies licenseCodes of licenses that can replace this license. Note: such replacements are allowed even if removable_from_disk is false. |
| `↳ appendable_to_disk` | `bool` If true, this license can be appended to an existing disk's set of licenses. |
| `↳ creation_timestamp` | `string` Output only. \[Output Only\] Creation timestamp inRFC3339 text format. |
| `↳ description` | `string` Output only. \[Output Only\] Description of this License Code. |
| `↳ id` | `int|string` Output only. \[Output Only\] The unique identifier for the resource. This identifier is defined by the server. |
| `↳ incompatible_licenses` | `string[]` Specifies licenseCodes of licenses that are incompatible with this license. If a license is incompatible with this license, it cannot be attached to the same disk or image. |
| `↳ kind` | `string` Output only. \[Output Only\] Type of resource. Always compute#licenseCode for licenses. |
| `↳ license_alias` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.LicenseCodeLicenseAlias>` \[Output Only\] URL and description aliases of Licenses with the same License Code. |
| `↳ minimum_retention` | `https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.Duration` If set, this license will be unable to be removed or replaced once attached to a disk until the minimum_retention period has passed. |
| `↳ multi_tenant_only` | `bool` If true, this license can only be used on VMs on multi tenant nodes. |
| `↳ name` | `string` Output only. \[Output Only\] Name of the resource. The name is 1-20 characters long and must be a valid 64 bit integer. |
| `↳ os_license` | `bool` If true, indicates this is an OS license. Only one OS license can be attached to a disk or image at a time. |
| `↳ removable_from_disk` | `bool` If true, this license can be removed from a disk's set of licenses, with no replacement license needed. |
| `↳ required_coattached_licenses` | `string[]` Specifies the set of permissible coattached licenseCodes of licenses that satisfy the coattachment requirement of this license. At least one license from the set must be attached to the same disk or image as this license. |
| `↳ self_link` | `string` Output only. \[Output Only\] Server-defined URL for the resource. |
| `↳ sole_tenant_only` | `bool` If true, this license can only be used on VMs on sole tenant nodes. |
| `↳ state` | `string` Output only. \[Output Only\] Current state of this License Code. Check the State enum for the list of possible values. |
| `↳ transferable` | `bool` Output only. \[Output Only\] If true, the license will remain attached when creating images or snapshots from disks. Otherwise, the license is not transferred. |
| `↳ update_timestamp` | `string` Output only. \[Output Only\] Last update timestamp inRFC3339 text format. |

### getAllowedReplacementLicenses

Specifies licenseCodes of licenses that can replace this license. Note:
such replacements are allowed even if removable_from_disk is false.

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

### setAllowedReplacementLicenses

Specifies licenseCodes of licenses that can replace this license. Note:
such replacements are allowed even if removable_from_disk is false.

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

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

### getAppendableToDisk

If true, this license can be appended to an existing disk's set of
licenses.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### hasAppendableToDisk

### clearAppendableToDisk

### setAppendableToDisk

If true, this license can be appended to an existing disk's set of
licenses.

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

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

### getCreationTimestamp

Output only. \[Output Only\] Creation timestamp inRFC3339
text format.

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

### hasCreationTimestamp

### clearCreationTimestamp

### setCreationTimestamp

Output only. \[Output Only\] Creation timestamp inRFC3339
text format.

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

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

### getDescription

Output only. \[Output Only\] Description of this License Code.

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

### hasDescription

### clearDescription

### setDescription

Output only. \[Output Only\] Description of this License Code.

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

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

### getId

Output only. \[Output Only\] The unique identifier for the resource. This identifier is
defined by the server.

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

### hasId

### clearId

### setId

Output only. \[Output Only\] The unique identifier for the resource. This identifier is
defined by the server.

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

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

### getIncompatibleLicenses

Specifies licenseCodes of licenses that are incompatible with this license.

If a license is incompatible with this license, it cannot be attached to
the same disk or image.

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

### setIncompatibleLicenses

Specifies licenseCodes of licenses that are incompatible with this license.

If a license is incompatible with this license, it cannot be attached to
the same disk or image.

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

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

### getKind

Output only. \[Output Only\] Type of resource. Always compute#licenseCode for
licenses.

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

### hasKind

### clearKind

### setKind

Output only. \[Output Only\] Type of resource. Always compute#licenseCode for
licenses.

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

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

### getLicenseAlias

\[Output Only\] URL and description aliases of Licenses with the same
License Code.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.LicenseCodeLicenseAlias>` |   |

### setLicenseAlias

\[Output Only\] URL and description aliases of Licenses with the same
License Code.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.LicenseCodeLicenseAlias>` |

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

### getMinimumRetention

If set, this license will be unable to be removed or replaced once attached
to a disk until the minimum_retention period has passed.

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

### hasMinimumRetention

### clearMinimumRetention

### setMinimumRetention

If set, this license will be unable to be removed or replaced once attached
to a disk until the minimum_retention period has passed.

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

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

### getMultiTenantOnly

If true, this license can only be used on VMs on multi tenant nodes.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### hasMultiTenantOnly

### clearMultiTenantOnly

### setMultiTenantOnly

If true, this license can only be used on VMs on multi tenant nodes.

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

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

### getName

Output only. \[Output Only\] Name of the resource. The name is 1-20 characters long and
must be a valid 64 bit integer.

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

### hasName

### clearName

### setName

Output only. \[Output Only\] Name of the resource. The name is 1-20 characters long and
must be a valid 64 bit integer.

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

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

### getOsLicense

If true, indicates this is an OS license. Only one OS license can be
attached to a disk or image at a time.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### hasOsLicense

### clearOsLicense

### setOsLicense

If true, indicates this is an OS license. Only one OS license can be
attached to a disk or image at a time.

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

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

### getRemovableFromDisk

If true, this license can be removed from a disk's set of licenses, with no
replacement license needed.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### hasRemovableFromDisk

### clearRemovableFromDisk

### setRemovableFromDisk

If true, this license can be removed from a disk's set of licenses, with no
replacement license needed.

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

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

### getRequiredCoattachedLicenses

Specifies the set of permissible coattached licenseCodes of licenses that
satisfy the coattachment requirement of this license. At least one license
from the set must be attached to the same disk or image as this license.

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

### setRequiredCoattachedLicenses

Specifies the set of permissible coattached licenseCodes of licenses that
satisfy the coattachment requirement of this license. At least one license
from the set must be attached to the same disk or image as this license.

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

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

### getSelfLink

Output only. \[Output Only\] Server-defined URL for the resource.

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

### hasSelfLink

### clearSelfLink

### setSelfLink

Output only. \[Output Only\] Server-defined URL for the resource.

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

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

### getSoleTenantOnly

If true, this license can only be used on VMs on sole tenant nodes.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### hasSoleTenantOnly

### clearSoleTenantOnly

### setSoleTenantOnly

If true, this license can only be used on VMs on sole tenant nodes.

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

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

### getState

Output only. \[Output Only\] Current state of this License Code.

Check the State enum for the list of possible values.

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

### hasState

### clearState

### setState

Output only. \[Output Only\] Current state of this License Code.

Check the State enum for the list of possible values.

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

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

### getTransferable

Output only. \[Output Only\] If true, the license will remain attached when creating
images or snapshots from disks. Otherwise, the license is not transferred.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### hasTransferable

### clearTransferable

### setTransferable

Output only. \[Output Only\] If true, the license will remain attached when creating
images or snapshots from disks. Otherwise, the license is not transferred.

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

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

### getUpdateTimestamp

Output only. \[Output Only\] Last update timestamp inRFC3339
text format.

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

### hasUpdateTimestamp

### clearUpdateTimestamp

### setUpdateTimestamp

Output only. \[Output Only\] Last update timestamp inRFC3339
text format.

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

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