# Class OSPolicyAssignment (1.25.0)

1.25.0 (latest) 1.24.0 1.23.0 1.22.0 1.21.0 1.20.2 1.19.0 1.18.1 1.17.5 1.16.0 1.15.3 1.14.1 1.13.0 1.12.4 1.11.2 1.10.0 1.9.0 1.8.0 1.7.1 1.6.0 1.5.2 1.4.0 1.3.2 1.2.0 1.1.0 1.0.0 0.1.2

    OSPolicyAssignment(mapping=None, *, ignore_unknown_fields=False, **kwargs)

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, see `OS policy and OS policy
assignment <https://cloud.google.com/compute/docs/os-configuration-management/working-with-os-policies>`__.

| ## Attributes ||
|---|---|
| **Name** | **Description** |
| `name` | `str` Resource name. Format: `projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id}` This field is ignored when you create an OS policy assignment. |
| `description` | `str` OS policy assignment description. Length of the description is limited to 1024 characters. |
| `os_policies` | `MutableSequence[google.cloud.osconfig_v1.types.OSPolicy]` Required. List of OS policies to be applied to the VMs. |
| `instance_filter` | `https://docs.cloud.google.com/python/docs/reference/osconfig/latest/google.cloud.osconfig_v1.types.OSPolicyAssignment.InstanceFilter` Required. Filter to select VMs. |
| `rollout` | `https://docs.cloud.google.com/python/docs/reference/osconfig/latest/google.cloud.osconfig_v1.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: - instance_filter - os_policies 3) OSPolicyAssignment is deleted. |
| `revision_id` | `str` Output only. The assignment revision ID A new revision is committed whenever a rollout is triggered for a OS policy assignment |
| `revision_create_time` | `google.protobuf.timestamp_pb2.Timestamp` Output only. The timestamp that the revision was created. |
| `etag` | `str` The etag for this OS policy assignment. If this is provided on update, it must match the server's etag. |
| `rollout_state` | `https://docs.cloud.google.com/python/docs/reference/osconfig/latest/google.cloud.osconfig_v1.types.OSPolicyAssignment.RolloutState` Output only. OS policy assignment rollout state |
| `baseline` | `bool` 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` | `bool` Output only. Indicates that this revision deletes the OS policy assignment. |
| `reconciling` | `bool` Output only. Indicates that reconciliation is in progress for the revision. This value is `true` when the `rollout_state` is one of: - IN_PROGRESS - CANCELLING |
| `uid` | `str` Output only. Server generated unique id for the OS policy assignment resource. |

## Classes

### InstanceFilter

    InstanceFilter(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Filters to select target VMs for an assignment.

If more than one filter criteria is specified below, a VM will
be selected if and only if it satisfies all of them.

### LabelSet

    LabelSet(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Message representing label set.

- A label is a key value pair set for a VM.
- A LabelSet is a set of labels.
- Labels within a LabelSet are ANDed. In other words, a LabelSet is applicable for a VM only if it matches all the labels in the LabelSet.
- Example: A LabelSet with 2 labels: `env=prod` and `type=webserver` will only be applicable for those VMs with both labels present.

### Rollout

    Rollout(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Message to configure the rollout at the zonal level for the
OS policy assignment.

### RolloutState

    RolloutState(value)

OS policy assignment rollout state