Reference documentation and code samples for the Cloud OS Config V1 API class Google::Cloud::OsConfig::V1::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.
(::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
defdeleted()->::Boolean
Returns
(::Boolean) — Output only. Indicates that this revision deletes the OS policy assignment.
#description
defdescription()->::String
Returns
(::String) — OS policy assignment description.
Length of the description is limited to 1024 characters.
#description=
defdescription=(value)->::String
Parameter
value (::String) — OS policy assignment description.
Length of the description is limited to 1024 characters.
Returns
(::String) — OS policy assignment description.
Length of the description is limited to 1024 characters.
#etag
defetag()->::String
Returns
(::String) — The etag for this OS policy assignment.
If this is provided on update, it must match the server's etag.
#etag=
defetag=(value)->::String
Parameter
value (::String) — The etag for this OS policy assignment.
If this is provided on update, it must match the server's etag.
Returns
(::String) — The etag for this OS policy assignment.
If this is provided on update, it must match the server's etag.
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:
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:
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:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-09 UTC."],[],[],null,["# Cloud OS Config V1 API - Class Google::Cloud::OsConfig::V1::OSPolicyAssignment (v1.4.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.4.0 (latest)](/ruby/docs/reference/google-cloud-os_config-v1/latest/Google-Cloud-OsConfig-V1-OSPolicyAssignment)\n- [1.3.0](/ruby/docs/reference/google-cloud-os_config-v1/1.3.0/Google-Cloud-OsConfig-V1-OSPolicyAssignment)\n- [1.2.1](/ruby/docs/reference/google-cloud-os_config-v1/1.2.1/Google-Cloud-OsConfig-V1-OSPolicyAssignment)\n- [1.1.0](/ruby/docs/reference/google-cloud-os_config-v1/1.1.0/Google-Cloud-OsConfig-V1-OSPolicyAssignment)\n- [1.0.1](/ruby/docs/reference/google-cloud-os_config-v1/1.0.1/Google-Cloud-OsConfig-V1-OSPolicyAssignment)\n- [0.16.0](/ruby/docs/reference/google-cloud-os_config-v1/0.16.0/Google-Cloud-OsConfig-V1-OSPolicyAssignment)\n- [0.15.2](/ruby/docs/reference/google-cloud-os_config-v1/0.15.2/Google-Cloud-OsConfig-V1-OSPolicyAssignment)\n- [0.14.0](/ruby/docs/reference/google-cloud-os_config-v1/0.14.0/Google-Cloud-OsConfig-V1-OSPolicyAssignment)\n- [0.13.0](/ruby/docs/reference/google-cloud-os_config-v1/0.13.0/Google-Cloud-OsConfig-V1-OSPolicyAssignment)\n- [0.12.0](/ruby/docs/reference/google-cloud-os_config-v1/0.12.0/Google-Cloud-OsConfig-V1-OSPolicyAssignment)\n- [0.11.0](/ruby/docs/reference/google-cloud-os_config-v1/0.11.0/Google-Cloud-OsConfig-V1-OSPolicyAssignment)\n- [0.10.0](/ruby/docs/reference/google-cloud-os_config-v1/0.10.0/Google-Cloud-OsConfig-V1-OSPolicyAssignment)\n- [0.9.1](/ruby/docs/reference/google-cloud-os_config-v1/0.9.1/Google-Cloud-OsConfig-V1-OSPolicyAssignment) \nReference documentation and code samples for the Cloud OS Config V1 API class Google::Cloud::OsConfig::V1::OSPolicyAssignment.\n\nOS policy assignment is an API resource that is used to\napply a set of OS policies to a dynamically targeted group of Compute Engine\nVM instances.\n\n\nAn OS policy is used to define the desired state configuration for a\nCompute Engine VM instance through a set of configuration resources that\nprovide capabilities such as installing or removing software packages, or\nexecuting a script.\n\n\u003cbr /\u003e\n\nFor more information, see [OS policy and OS policy\nassignment](https://cloud.google.com/compute/docs/os-configuration-management/working-with-os-policies). \n\nInherits\n--------\n\n- Object \n\nExtended By\n-----------\n\n- Google::Protobuf::MessageExts::ClassMethods \n\nIncludes\n--------\n\n- Google::Protobuf::MessageExts\n\nMethods\n-------\n\n### #baseline\n\n def baseline() -\u003e ::Boolean\n\n**Returns**\n\n- (::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.\n\n For a given OS policy assignment, there is only one revision with a value\n of `true` for this field.\n\n### #deleted\n\n def deleted() -\u003e ::Boolean\n\n**Returns**\n\n- (::Boolean) --- Output only. Indicates that this revision deletes the OS policy assignment.\n\n### #description\n\n def description() -\u003e ::String\n\n**Returns**\n\n- (::String) --- OS policy assignment description. Length of the description is limited to 1024 characters.\n\n### #description=\n\n def description=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- OS policy assignment description. Length of the description is limited to 1024 characters. \n**Returns**\n\n- (::String) --- OS policy assignment description. Length of the description is limited to 1024 characters.\n\n### #etag\n\n def etag() -\u003e ::String\n\n**Returns**\n\n- (::String) --- The etag for this OS policy assignment. If this is provided on update, it must match the server's etag.\n\n### #etag=\n\n def etag=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- The etag for this OS policy assignment. If this is provided on update, it must match the server's etag. \n**Returns**\n\n- (::String) --- The etag for this OS policy assignment. If this is provided on update, it must match the server's etag.\n\n### #instance_filter\n\n def instance_filter() -\u003e ::Google::Cloud::OsConfig::V1::OSPolicyAssignment::InstanceFilter\n\n**Returns**\n\n- ([::Google::Cloud::OsConfig::V1::OSPolicyAssignment::InstanceFilter](./Google-Cloud-OsConfig-V1-OSPolicyAssignment-InstanceFilter)) --- Required. Filter to select VMs.\n\n### #instance_filter=\n\n def instance_filter=(value) -\u003e ::Google::Cloud::OsConfig::V1::OSPolicyAssignment::InstanceFilter\n\n**Parameter**\n\n- **value** ([::Google::Cloud::OsConfig::V1::OSPolicyAssignment::InstanceFilter](./Google-Cloud-OsConfig-V1-OSPolicyAssignment-InstanceFilter)) --- Required. Filter to select VMs. \n**Returns**\n\n- ([::Google::Cloud::OsConfig::V1::OSPolicyAssignment::InstanceFilter](./Google-Cloud-OsConfig-V1-OSPolicyAssignment-InstanceFilter)) --- Required. Filter to select VMs.\n\n### #name\n\n def name() -\u003e ::String\n\n**Returns**\n\n- (::String) --- Resource name.\n\n Format:\n `projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id}`\n\n This field is ignored when you create an OS policy assignment.\n\n### #name=\n\n def name=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- Resource name.\n\n\n Format:\n `projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id}`\n\nThis field is ignored when you create an OS policy assignment. \n**Returns**\n\n- (::String) --- Resource name.\n\n Format:\n `projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id}`\n\n This field is ignored when you create an OS policy assignment.\n\n### #os_policies\n\n def os_policies() -\u003e ::Array\u003c::Google::Cloud::OsConfig::V1::OSPolicy\u003e\n\n**Returns**\n\n- (::Array\\\u003c[::Google::Cloud::OsConfig::V1::OSPolicy](./Google-Cloud-OsConfig-V1-OSPolicy)\\\u003e) --- Required. List of OS policies to be applied to the VMs.\n\n### #os_policies=\n\n def os_policies=(value) -\u003e ::Array\u003c::Google::Cloud::OsConfig::V1::OSPolicy\u003e\n\n**Parameter**\n\n- **value** (::Array\\\u003c[::Google::Cloud::OsConfig::V1::OSPolicy](./Google-Cloud-OsConfig-V1-OSPolicy)\\\u003e) --- Required. List of OS policies to be applied to the VMs. \n**Returns**\n\n- (::Array\\\u003c[::Google::Cloud::OsConfig::V1::OSPolicy](./Google-Cloud-OsConfig-V1-OSPolicy)\\\u003e) --- Required. List of OS policies to be applied to the VMs.\n\n### #reconciling\n\n def reconciling() -\u003e ::Boolean\n\n**Returns**\n\n- (::Boolean) --- Output only. Indicates that reconciliation is in progress for the revision.\n This value is `true` when the `rollout_state` is one of:\n\n - IN_PROGRESS\n - CANCELLING\n\n### #revision_create_time\n\n def revision_create_time() -\u003e ::Google::Protobuf::Timestamp\n\n**Returns**\n\n- ([::Google::Protobuf::Timestamp](./Google-Protobuf-Timestamp)) --- Output only. The timestamp that the revision was created.\n\n### #revision_id\n\n def revision_id() -\u003e ::String\n\n**Returns**\n\n- (::String) --- Output only. The assignment revision ID A new revision is committed whenever a rollout is triggered for a OS policy assignment\n\n### #rollout\n\n def rollout() -\u003e ::Google::Cloud::OsConfig::V1::OSPolicyAssignment::Rollout\n\n**Returns**\n\n- ([::Google::Cloud::OsConfig::V1::OSPolicyAssignment::Rollout](./Google-Cloud-OsConfig-V1-OSPolicyAssignment-Rollout)) ---\n\n Required. Rollout to deploy the OS policy assignment.\n A rollout is triggered in the following situations:\n 1) OSPolicyAssignment is created.\n 2) OSPolicyAssignment is updated and the update contains changes to one of\n the following fields:\n - instance_filter\n - os_policies 3) OSPolicyAssignment is deleted.\n\n### #rollout=\n\n def rollout=(value) -\u003e ::Google::Cloud::OsConfig::V1::OSPolicyAssignment::Rollout\n\n**Parameter**\n\n- **value** ([::Google::Cloud::OsConfig::V1::OSPolicyAssignment::Rollout](./Google-Cloud-OsConfig-V1-OSPolicyAssignment-Rollout)) ---\n\n Required. Rollout to deploy the OS policy assignment.\n A rollout is triggered in the following situations:\n 1) OSPolicyAssignment is created.\n 2) OSPolicyAssignment is updated and the update contains changes to one of\n the following fields:\n - instance_filter\n- os_policies 3) OSPolicyAssignment is deleted. \n**Returns**\n\n- ([::Google::Cloud::OsConfig::V1::OSPolicyAssignment::Rollout](./Google-Cloud-OsConfig-V1-OSPolicyAssignment-Rollout)) ---\n\n Required. Rollout to deploy the OS policy assignment.\n A rollout is triggered in the following situations:\n 1) OSPolicyAssignment is created.\n 2) OSPolicyAssignment is updated and the update contains changes to one of\n the following fields:\n - instance_filter\n - os_policies 3) OSPolicyAssignment is deleted.\n\n### #rollout_state\n\n def rollout_state() -\u003e ::Google::Cloud::OsConfig::V1::OSPolicyAssignment::RolloutState\n\n**Returns**\n\n- ([::Google::Cloud::OsConfig::V1::OSPolicyAssignment::RolloutState](./Google-Cloud-OsConfig-V1-OSPolicyAssignment-RolloutState)) --- Output only. OS policy assignment rollout state\n\n### #uid\n\n def uid() -\u003e ::String\n\n**Returns**\n\n- (::String) --- Output only. Server generated unique id for the OS policy assignment resource."]]