# Google Cloud Iam V2 Client - Class Policy (1.3.0)

1.3.0 (latest) 1.2.2 1.1.1 1.0.3 0.5.5 0.4.2 0.3.1 0.2.0 0.1.7 Reference documentation and code samples for the Google Cloud Iam V2 Client class Policy.

Data for an IAM policy.

Generated from protobuf message `google.iam.v2.Policy`

## Namespace

Google \\ Cloud \\ Iam \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Immutable. The resource name of the `Policy`, which must be unique. Format: `policies/{attachment_point}/denypolicies/{policy_id}` The attachment point is identified by its URL-encoded full resource name, which means that the forward-slash character, `/`, must be written as `%2F`. For example, `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-deny-policy`. For organizations and folders, use the numeric ID in the full resource name. For projects, requests can use the alphanumeric or the numeric ID. Responses always contain the numeric ID. |
| `↳ uid` | `string` Immutable. The globally unique ID of the `Policy`. Assigned automatically when the `Policy` is created. |
| `↳ kind` | `string` Output only. The kind of the `Policy`. Always contains the value `DenyPolicy`. |
| `↳ display_name` | `string` A user-specified description of the `Policy`. This value can be up to 63 characters. |
| `↳ annotations` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` A key-value map to store arbitrary metadata for the `Policy`. Keys can be up to 63 characters. Values can be up to 255 characters. |
| `↳ etag` | `string` An opaque tag that identifies the current version of the `Policy`. IAM uses this value to help manage concurrent updates, so they do not cause one update to be overwritten by another. If this field is present in a CreatePolicy request, the value is ignored. |
| `↳ create_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. The time when the `Policy` was created. |
| `↳ update_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. The time when the `Policy` was last updated. |
| `↳ delete_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. The time when the `Policy` was deleted. Empty if the policy is not deleted. |
| `↳ rules` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-iam/latest/V2.PolicyRule>` A list of rules that specify the behavior of the `Policy`. All of the rules should be of the `kind` specified in the `Policy`. |
| `↳ managing_authority` | `string` Immutable. Specifies that this policy is managed by an authority and can only be modified by that authority. Usage is restricted. |

### getName

Immutable. The resource name of the `Policy`, which must be unique. Format:
`policies/{attachment_point}/denypolicies/{policy_id}`
The attachment point is identified by its URL-encoded full resource name,
which means that the forward-slash character, `/`, must be written as
`%2F`. For example,
`policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-deny-policy`.

For organizations and folders, use the numeric ID in the full resource
name. For projects, requests can use the alphanumeric or the numeric ID.
Responses always contain the numeric ID.

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

### setName

Immutable. The resource name of the `Policy`, which must be unique. Format:
`policies/{attachment_point}/denypolicies/{policy_id}`
The attachment point is identified by its URL-encoded full resource name,
which means that the forward-slash character, `/`, must be written as
`%2F`. For example,
`policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-deny-policy`.

For organizations and folders, use the numeric ID in the full resource
name. For projects, requests can use the alphanumeric or the numeric ID.
Responses always contain the numeric ID.

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

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

### getUid

Immutable. The globally unique ID of the `Policy`. Assigned automatically when the
`Policy` is created.

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

### setUid

Immutable. The globally unique ID of the `Policy`. Assigned automatically when the
`Policy` is created.

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

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

### getKind

Output only. The kind of the `Policy`. Always contains the value `DenyPolicy`.

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

### setKind

Output only. The kind of the `Policy`. Always contains the value `DenyPolicy`.

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

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

### getDisplayName

A user-specified description of the `Policy`. This value can be up to 63
characters.

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

### setDisplayName

A user-specified description of the `Policy`. This value can be up to 63
characters.

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

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

### getAnnotations

A key-value map to store arbitrary metadata for the `Policy`. Keys
can be up to 63 characters. Values can be up to 255 characters.

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

### setAnnotations

A key-value map to store arbitrary metadata for the `Policy`. Keys
can be up to 63 characters. Values can be up to 255 characters.

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

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

### getEtag

An opaque tag that identifies the current version of the `Policy`. IAM uses
this value to help manage concurrent updates, so they do not cause one
update to be overwritten by another.

If this field is present in a CreatePolicy request, the value is
ignored.

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

### setEtag

An opaque tag that identifies the current version of the `Policy`. IAM uses
this value to help manage concurrent updates, so they do not cause one
update to be overwritten by another.

If this field is present in a CreatePolicy request, the value is
ignored.

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

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

### getCreateTime

Output only. The time when the `Policy` was created.

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

### hasCreateTime

### clearCreateTime

### setCreateTime

Output only. The time when the `Policy` was created.

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

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

### getUpdateTime

Output only. The time when the `Policy` was last updated.

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

### hasUpdateTime

### clearUpdateTime

### setUpdateTime

Output only. The time when the `Policy` was last updated.

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

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

### getDeleteTime

Output only. The time when the `Policy` was deleted. Empty if the policy is not deleted.

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

### hasDeleteTime

### clearDeleteTime

### setDeleteTime

Output only. The time when the `Policy` was deleted. Empty if the policy is not deleted.

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

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

### getRules

A list of rules that specify the behavior of the `Policy`. All of the rules
should be of the `kind` specified in the `Policy`.

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

### setRules

A list of rules that specify the behavior of the `Policy`. All of the rules
should be of the `kind` specified in the `Policy`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-iam/latest/V2.PolicyRule>` |

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

### getManagingAuthority

Immutable. Specifies that this policy is managed by an authority and can only be
modified by that authority. Usage is restricted.

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

### setManagingAuthority

Immutable. Specifies that this policy is managed by an authority and can only be
modified by that authority. Usage is restricted.

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

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