# Google Cloud Org Policy V2 Client - Class CreatePolicyRequest (1.3.3)

1.3.3 (latest) 1.3.2 1.2.2 1.1.3 1.0.0 0.7.0 0.6.5 0.5.3 0.4.2 0.3.7 Reference documentation and code samples for the Google Cloud Org Policy V2 Client class CreatePolicyRequest.

The request sent to the [CreatePolicyRequest](https://docs.cloud.google.com/php/docs/reference/cloud-org-policy/latest/V2.Client.OrgPolicyClient#_Google_Cloud_OrgPolicy_V2_Client_OrgPolicyClient__createPolicy__) method.

Generated from protobuf message `google.cloud.orgpolicy.v2.CreatePolicyRequest`

## Namespace

Google \\ Cloud \\ OrgPolicy \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ parent` | `string` Required. The Google Cloud resource that will parent the new policy. Must be in one of the following forms: \* \* `projects/{project_number}` \* \* `projects/{project_id}` \* \* `folders/{folder_id}` \* \* `organizations/{organization_id}` |
| `↳ policy` | `https://docs.cloud.google.com/php/docs/reference/cloud-org-policy/latest/V2.Policy` Required. Policy to create. |

### getParent

Required. The Google Cloud resource that will parent the new policy. Must
be in one of the following forms:

- `projects/{project_number}`
- `projects/{project_id}`
- `folders/{folder_id}`
- `organizations/{organization_id}`

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

### setParent

Required. The Google Cloud resource that will parent the new policy. Must
be in one of the following forms:

- `projects/{project_number}`
- `projects/{project_id}`
- `folders/{folder_id}`
- `organizations/{organization_id}`

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

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

### getPolicy

Required. Policy to create.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-org-policy/latest/V2.Policy|null` |   |

### hasPolicy

### clearPolicy

### setPolicy

Required. Policy to create.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-org-policy/latest/V2.Policy` |

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

### static::build

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `parent` | `string` Required. The Google Cloud resource that will parent the new policy. Must be in one of the following forms: - - `projects/{project_number}` - - `projects/{project_id}` - - `folders/{folder_id}` - - `organizations/{organization_id}` Please see OrgPolicyClient::projectName() for help formatting this field. |
| `policy` | `https://docs.cloud.google.com/php/docs/reference/cloud-org-policy/latest/V2.Policy` Required. Policy to create. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-org-policy/latest/V2.CreatePolicyRequest` |   |