# Google Cloud OsConfig V1 Client - Class CreateOSPolicyAssignmentRequest (2.2.3)

2.2.3 (latest) 2.2.2 2.1.0 2.0.5 1.3.5 1.2.2 1.1.1 1.0.5 Reference documentation and code samples for the Google Cloud OsConfig V1 Client class CreateOSPolicyAssignmentRequest.

A request message to create an OS policy assignment

Generated from protobuf message `google.cloud.osconfig.v1.CreateOSPolicyAssignmentRequest`

## Namespace

Google \\ Cloud \\ OsConfig \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ parent` | `string` Required. The parent resource name in the form: projects/{project}/locations/{location} |
| `↳ os_policy_assignment` | `https://docs.cloud.google.com/php/docs/reference/cloud-osconfig/latest/V1.OSPolicyAssignment` Required. The OS policy assignment to be created. |
| `↳ os_policy_assignment_id` | `string` Required. The logical name of the OS policy assignment in the project with the following restrictions: \* \* Must contain only lowercase letters, numbers, and hyphens. \* \* Must start with a letter. \* \* Must be between 1-63 characters. \* \* Must end with a number or a letter. \* \* Must be unique within the project. |

### getParent

Required. The parent resource name in the form:
projects/{project}/locations/{location}

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

### setParent

Required. The parent resource name in the form:
projects/{project}/locations/{location}

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

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

### getOsPolicyAssignment

Required. The OS policy assignment to be created.

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

### hasOsPolicyAssignment

### clearOsPolicyAssignment

### setOsPolicyAssignment

Required. The OS policy assignment to be created.

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

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

### getOsPolicyAssignmentId

Required. The logical name of the OS policy assignment in the project
with the following restrictions:

- Must contain only lowercase letters, numbers, and hyphens.

- Must start with a letter.

- Must be between 1-63 characters.
- Must end with a number or a letter.
- Must be unique within the project.

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

### setOsPolicyAssignmentId

Required. The logical name of the OS policy assignment in the project
with the following restrictions:

- Must contain only lowercase letters, numbers, and hyphens.

- Must start with a letter.

- Must be between 1-63 characters.
- Must end with a number or a letter.
- Must be unique within the project.

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

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

### static::build

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `parent` | `string` Required. The parent resource name in the form: projects/{project}/locations/{location} Please see OsConfigZonalServiceClient::locationName() for help formatting this field. |
| `osPolicyAssignment` | `https://docs.cloud.google.com/php/docs/reference/cloud-osconfig/latest/V1.OSPolicyAssignment` Required. The OS policy assignment to be created. |
| `osPolicyAssignmentId` | `string` Required. The logical name of the OS policy assignment in the project with the following restrictions: - - Must contain only lowercase letters, numbers, and hyphens. - - Must start with a letter. - - Must be between 1-63 characters. - - Must end with a number or a letter. - - Must be unique within the project. |

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