# REST Resource: projects.locations.osPolicyAssignments

- [Resource: OSPolicyAssignment](https://docs.cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments#OSPolicyAssignment)
  - [JSON representation](https://docs.cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments#OSPolicyAssignment.SCHEMA_REPRESENTATION)
- [Methods](https://docs.cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments#METHODS_SUMMARY)

## Resource: OSPolicyAssignment

OS policy assignment is an API resource that is used to apply a set of OS policies to a dynamically targeted group of Compute Engine VM instances.

An OS policy is used to define the desired state configuration for a Compute Engine VM instance through a set of configuration resources that provide capabilities such as installing or removing software packages, or executing a script.

For more information about the OS policy resource definitions and examples, see [OS policy and OS policy assignment](https://cloud.google.com/compute/docs/os-configuration-management/working-with-os-policies).

| JSON representation |
|---|
| ``` { "name": string, "description": string, "osPolicies": [ { object (`https://docs.cloud.google.com/compute/docs/osconfig/rest/Shared.Types/OSPolicy`) } ], "instanceFilter": { object (`https://docs.cloud.google.com/compute/docs/osconfig/rest/Shared.Types/OSPolicyAssignment#InstanceFilter`) }, "rollout": { object (`https://docs.cloud.google.com/compute/docs/osconfig/rest/Shared.Types/OSPolicyAssignment#Rollout`) }, "revisionId": string, "revisionCreateTime": string, "etag": string, "rolloutState": enum (`https://docs.cloud.google.com/compute/docs/osconfig/rest/Shared.Types/RolloutState`), "baseline": boolean, "deleted": boolean, "reconciling": boolean, "uid": string } ``` |

| Fields ||
|---|---|
| `name` | `string` Resource name. Format: `projects/{project_number}/locations/{location}/osPolicyAssignments/{osPolicyAssignmentId}` This field is ignored when you create an OS policy assignment. |
| `description` | `string` OS policy assignment description. Length of the description is limited to 1024 characters. |
| `osPolicies[]` | ``object (`https://docs.cloud.google.com/compute/docs/osconfig/rest/Shared.Types/OSPolicy`)`` Required. List of OS policies to be applied to the VMs. |
| `instanceFilter` | ``object (`https://docs.cloud.google.com/compute/docs/osconfig/rest/Shared.Types/OSPolicyAssignment#InstanceFilter`)`` Required. Filter to select VMs. |
| `rollout` | ``object (`https://docs.cloud.google.com/compute/docs/osconfig/rest/Shared.Types/OSPolicyAssignment#Rollout`)`` Required. Rollout to deploy the OS policy assignment. A rollout is triggered in the following situations: 1) OSPolicyAssignment is created. 2) OSPolicyAssignment is updated and the update contains changes to one of the following fields: - instanceFilter - osPolicies 3) OSPolicyAssignment is deleted. |
| `revisionId` | `string` Output only. The assignment revision ID A new revision is committed whenever a rollout is triggered for a OS policy assignment |
| `revisionCreateTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. The timestamp that the revision was created. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `etag` | `string` The etag for this OS policy assignment. If this is provided on update, it must match the server's etag. |
| `rolloutState` | ``enum (`https://docs.cloud.google.com/compute/docs/osconfig/rest/Shared.Types/RolloutState`)`` Output only. OS policy assignment rollout state |
| `baseline` | `boolean` Output only. Indicates that this revision has been successfully rolled out in this zone and new VMs will be assigned OS policies from this revision. For a given OS policy assignment, there is only one revision with a value of `true` for this field. |
| `deleted` | `boolean` Output only. Indicates that this revision deletes the OS policy assignment. |
| `reconciling` | `boolean` Output only. Indicates that reconciliation is in progress for the revision. This value is `true` when the `rolloutState` is one of: \* IN_PROGRESS \* CANCELLING |
| `uid` | `string` Output only. Server generated unique id for the OS policy assignment resource. |

| ## Methods ||
|---|---|
| ### `https://docs.cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments/create` | Create an OS policy assignment. |
| ### `https://docs.cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments/delete` | Delete the OS policy assignment. |
| ### `https://docs.cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments/get` | Retrieve an existing OS policy assignment. |
| ### `https://docs.cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments/list` | List the OS policy assignments under the parent resource. |
| ### `https://docs.cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments/listRevisions` | List the OS policy assignment revisions for a given OS policy assignment. |
| ### `https://docs.cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments/patch` | Update an existing OS policy assignment. |