Reference documentation and code samples for the Cloud OS Config V1 API class Google::Cloud::OsConfig::V1::OSPolicy.
An OS policy defines the desired state configuration for a VM.
Inherits
Object
Extended By
Google::Protobuf::MessageExts::ClassMethods
Includes
Google::Protobuf::MessageExts
Methods
#allow_no_resource_group_match
defallow_no_resource_group_match()->::Boolean
Returns
(::Boolean) — This flag determines the OS policy compliance status when none of the
resource groups within the policy are applicable for a VM. Set this value
to true if the policy needs to be reported as compliant even if the
policy has nothing to validate or enforce.
value (::Boolean) — This flag determines the OS policy compliance status when none of the
resource groups within the policy are applicable for a VM. Set this value
to true if the policy needs to be reported as compliant even if the
policy has nothing to validate or enforce.
Returns
(::Boolean) — This flag determines the OS policy compliance status when none of the
resource groups within the policy are applicable for a VM. Set this value
to true if the policy needs to be reported as compliant even if the
policy has nothing to validate or enforce.
#description
defdescription()->::String
Returns
(::String) — Policy description.
Length of the description is limited to 1024 characters.
#description=
defdescription=(value)->::String
Parameter
value (::String) — Policy description.
Length of the description is limited to 1024 characters.
Returns
(::String) — Policy description.
Length of the description is limited to 1024 characters.
#id
defid()->::String
Returns
(::String) —
Required. The id of the OS policy 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 assignment.
#id=
defid=(value)->::String
Parameter
value (::String) —
Required. The id of the OS policy 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 assignment.
Returns
(::String) —
Required. The id of the OS policy with the following restrictions:
Must contain only lowercase letters, numbers, and hyphens.
(::Array<::Google::Cloud::OsConfig::V1::OSPolicy::ResourceGroup>) — Required. List of resource groups for the policy.
For a particular VM, resource groups are evaluated in the order specified
and the first resource group that is applicable is selected and the rest
are ignored.
If none of the resource groups are applicable for a VM, the VM is
considered to be non-compliant w.r.t this policy. This behavior can be
toggled by the flag allow_no_resource_group_match
value (::Array<::Google::Cloud::OsConfig::V1::OSPolicy::ResourceGroup>) — Required. List of resource groups for the policy.
For a particular VM, resource groups are evaluated in the order specified
and the first resource group that is applicable is selected and the rest
are ignored.
If none of the resource groups are applicable for a VM, the VM is
considered to be non-compliant w.r.t this policy. This behavior can be
toggled by the flag allow_no_resource_group_match
Returns
(::Array<::Google::Cloud::OsConfig::V1::OSPolicy::ResourceGroup>) — Required. List of resource groups for the policy.
For a particular VM, resource groups are evaluated in the order specified
and the first resource group that is applicable is selected and the rest
are ignored.
If none of the resource groups are applicable for a VM, the VM is
considered to be non-compliant w.r.t this policy. This behavior can be
toggled by the flag allow_no_resource_group_match
[[["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::OSPolicy (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-OSPolicy)\n- [1.3.0](/ruby/docs/reference/google-cloud-os_config-v1/1.3.0/Google-Cloud-OsConfig-V1-OSPolicy)\n- [1.2.1](/ruby/docs/reference/google-cloud-os_config-v1/1.2.1/Google-Cloud-OsConfig-V1-OSPolicy)\n- [1.1.0](/ruby/docs/reference/google-cloud-os_config-v1/1.1.0/Google-Cloud-OsConfig-V1-OSPolicy)\n- [1.0.1](/ruby/docs/reference/google-cloud-os_config-v1/1.0.1/Google-Cloud-OsConfig-V1-OSPolicy)\n- [0.16.0](/ruby/docs/reference/google-cloud-os_config-v1/0.16.0/Google-Cloud-OsConfig-V1-OSPolicy)\n- [0.15.2](/ruby/docs/reference/google-cloud-os_config-v1/0.15.2/Google-Cloud-OsConfig-V1-OSPolicy)\n- [0.14.0](/ruby/docs/reference/google-cloud-os_config-v1/0.14.0/Google-Cloud-OsConfig-V1-OSPolicy)\n- [0.13.0](/ruby/docs/reference/google-cloud-os_config-v1/0.13.0/Google-Cloud-OsConfig-V1-OSPolicy)\n- [0.12.0](/ruby/docs/reference/google-cloud-os_config-v1/0.12.0/Google-Cloud-OsConfig-V1-OSPolicy)\n- [0.11.0](/ruby/docs/reference/google-cloud-os_config-v1/0.11.0/Google-Cloud-OsConfig-V1-OSPolicy)\n- [0.10.0](/ruby/docs/reference/google-cloud-os_config-v1/0.10.0/Google-Cloud-OsConfig-V1-OSPolicy)\n- [0.9.1](/ruby/docs/reference/google-cloud-os_config-v1/0.9.1/Google-Cloud-OsConfig-V1-OSPolicy) \nReference documentation and code samples for the Cloud OS Config V1 API class Google::Cloud::OsConfig::V1::OSPolicy.\n\nAn OS policy defines the desired state configuration for a VM. \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### #allow_no_resource_group_match\n\n def allow_no_resource_group_match() -\u003e ::Boolean\n\n**Returns**\n\n- (::Boolean) --- This flag determines the OS policy compliance status when none of the resource groups within the policy are applicable for a VM. Set this value to `true` if the policy needs to be reported as compliant even if the policy has nothing to validate or enforce.\n\n### #allow_no_resource_group_match=\n\n def allow_no_resource_group_match=(value) -\u003e ::Boolean\n\n**Parameter**\n\n- **value** (::Boolean) --- This flag determines the OS policy compliance status when none of the resource groups within the policy are applicable for a VM. Set this value to `true` if the policy needs to be reported as compliant even if the policy has nothing to validate or enforce. \n**Returns**\n\n- (::Boolean) --- This flag determines the OS policy compliance status when none of the resource groups within the policy are applicable for a VM. Set this value to `true` if the policy needs to be reported as compliant even if the policy has nothing to validate or enforce.\n\n### #description\n\n def description() -\u003e ::String\n\n**Returns**\n\n- (::String) --- Policy 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) --- Policy description. Length of the description is limited to 1024 characters. \n**Returns**\n\n- (::String) --- Policy description. Length of the description is limited to 1024 characters.\n\n### #id\n\n def id() -\u003e ::String\n\n**Returns**\n\n- (::String) --- Required. The id of the OS policy with the following restrictions:\n\n - Must contain only lowercase letters, numbers, and hyphens.\n - Must start with a letter.\n - Must be between 1-63 characters.\n - Must end with a number or a letter.\n - Must be unique within the assignment.\n\n### #id=\n\n def id=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) ---\n\n Required. The id of the OS policy with the following restrictions:\n - Must contain only lowercase letters, numbers, and hyphens.\n - Must start with a letter.\n - Must be between 1-63 characters.\n - Must end with a number or a letter.\n- Must be unique within the assignment. \n**Returns**\n\n- (::String) --- Required. The id of the OS policy with the following restrictions:\n\n - Must contain only lowercase letters, numbers, and hyphens.\n - Must start with a letter.\n - Must be between 1-63 characters.\n - Must end with a number or a letter.\n - Must be unique within the assignment.\n\n### #mode\n\n def mode() -\u003e ::Google::Cloud::OsConfig::V1::OSPolicy::Mode\n\n**Returns**\n\n- ([::Google::Cloud::OsConfig::V1::OSPolicy::Mode](./Google-Cloud-OsConfig-V1-OSPolicy-Mode)) --- Required. Policy mode\n\n### #mode=\n\n def mode=(value) -\u003e ::Google::Cloud::OsConfig::V1::OSPolicy::Mode\n\n**Parameter**\n\n- **value** ([::Google::Cloud::OsConfig::V1::OSPolicy::Mode](./Google-Cloud-OsConfig-V1-OSPolicy-Mode)) --- Required. Policy mode \n**Returns**\n\n- ([::Google::Cloud::OsConfig::V1::OSPolicy::Mode](./Google-Cloud-OsConfig-V1-OSPolicy-Mode)) --- Required. Policy mode\n\n### #resource_groups\n\n def resource_groups() -\u003e ::Array\u003c::Google::Cloud::OsConfig::V1::OSPolicy::ResourceGroup\u003e\n\n**Returns**\n\n- (::Array\\\u003c[::Google::Cloud::OsConfig::V1::OSPolicy::ResourceGroup](./Google-Cloud-OsConfig-V1-OSPolicy-ResourceGroup)\\\u003e) --- Required. List of resource groups for the policy. For a particular VM, resource groups are evaluated in the order specified and the first resource group that is applicable is selected and the rest are ignored.\n\n\n If none of the resource groups are applicable for a VM, the VM is\n considered to be non-compliant w.r.t this policy. This behavior can be\n toggled by the flag `allow_no_resource_group_match`\n\n### #resource_groups=\n\n def resource_groups=(value) -\u003e ::Array\u003c::Google::Cloud::OsConfig::V1::OSPolicy::ResourceGroup\u003e\n\n**Parameter**\n\n- **value** (::Array\\\u003c[::Google::Cloud::OsConfig::V1::OSPolicy::ResourceGroup](./Google-Cloud-OsConfig-V1-OSPolicy-ResourceGroup)\\\u003e) --- Required. List of resource groups for the policy. For a particular VM, resource groups are evaluated in the order specified and the first resource group that is applicable is selected and the rest are ignored.\n\n\n If none of the resource groups are applicable for a VM, the VM is\n considered to be non-compliant w.r.t this policy. This behavior can be\ntoggled by the flag `allow_no_resource_group_match` \n**Returns**\n\n- (::Array\\\u003c[::Google::Cloud::OsConfig::V1::OSPolicy::ResourceGroup](./Google-Cloud-OsConfig-V1-OSPolicy-ResourceGroup)\\\u003e) --- Required. List of resource groups for the policy. For a particular VM, resource groups are evaluated in the order specified and the first resource group that is applicable is selected and the rest are ignored.\n\n\n If none of the resource groups are applicable for a VM, the VM is\n considered to be non-compliant w.r.t this policy. This behavior can be\n toggled by the flag `allow_no_resource_group_match`"]]