Class OSPolicyAssignment (1.17.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 <>__.


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[]
Required. List of OS policies to be applied to the VMs.
Required. Filter to select VMs.
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.
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.



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(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(mapping=None, *, ignore_unknown_fields=False, **kwargs)

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



OS policy assignment rollout state

Values: ROLLOUT_STATE_UNSPECIFIED (0): Invalid value IN_PROGRESS (1): The rollout is in progress. CANCELLING (2): The rollout is being cancelled. CANCELLED (3): The rollout is cancelled. SUCCEEDED (4): The rollout has completed successfully.