Reference documentation and code samples for the Cloud OS Config V1alpha API class Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance.
This API resource represents the OS policies compliance data for a Compute
Engine virtual machine (VM) instance at a given point in time.
A Compute Engine VM can have multiple OS policy assignments, and each
assignment can have multiple OS policies. As a result, multiple OS policies
could be applied to a single VM.
You can use this API resource to determine both the compliance state of your
VM as well as the compliance state of an individual OS policy.
(::String) — Output only. Unique identifier for the last compliance run.
This id will be logged by the OS config agent during a compliance run and
can be used for debugging and tracing purpose.
#name
defname()->::String
Returns
(::String) — Output only. The InstanceOSPoliciesCompliance API resource name.
[[["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-08-28 UTC."],[],[],null,["# Cloud OS Config V1alpha API - Class Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance (v0.12.0)\n\nVersion latestkeyboard_arrow_down\n\n- [0.12.0 (latest)](/ruby/docs/reference/google-cloud-os_config-v1alpha/latest/Google-Cloud-OsConfig-V1alpha-InstanceOSPoliciesCompliance)\n- [0.11.1](/ruby/docs/reference/google-cloud-os_config-v1alpha/0.11.1/Google-Cloud-OsConfig-V1alpha-InstanceOSPoliciesCompliance)\n- [0.10.0](/ruby/docs/reference/google-cloud-os_config-v1alpha/0.10.0/Google-Cloud-OsConfig-V1alpha-InstanceOSPoliciesCompliance)\n- [0.9.1](/ruby/docs/reference/google-cloud-os_config-v1alpha/0.9.1/Google-Cloud-OsConfig-V1alpha-InstanceOSPoliciesCompliance)\n- [0.8.2](/ruby/docs/reference/google-cloud-os_config-v1alpha/0.8.2/Google-Cloud-OsConfig-V1alpha-InstanceOSPoliciesCompliance)\n- [0.7.0](/ruby/docs/reference/google-cloud-os_config-v1alpha/0.7.0/Google-Cloud-OsConfig-V1alpha-InstanceOSPoliciesCompliance)\n- [0.6.0](/ruby/docs/reference/google-cloud-os_config-v1alpha/0.6.0/Google-Cloud-OsConfig-V1alpha-InstanceOSPoliciesCompliance)\n- [0.5.0](/ruby/docs/reference/google-cloud-os_config-v1alpha/0.5.0/Google-Cloud-OsConfig-V1alpha-InstanceOSPoliciesCompliance)\n- [0.4.0](/ruby/docs/reference/google-cloud-os_config-v1alpha/0.4.0/Google-Cloud-OsConfig-V1alpha-InstanceOSPoliciesCompliance)\n- [0.3.0](/ruby/docs/reference/google-cloud-os_config-v1alpha/0.3.0/Google-Cloud-OsConfig-V1alpha-InstanceOSPoliciesCompliance)\n- [0.2.2](/ruby/docs/reference/google-cloud-os_config-v1alpha/0.2.2/Google-Cloud-OsConfig-V1alpha-InstanceOSPoliciesCompliance) \nReference documentation and code samples for the Cloud OS Config V1alpha API class Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance.\n\nThis API resource represents the OS policies compliance data for a Compute\nEngine virtual machine (VM) instance at a given point in time.\n\n\nA Compute Engine VM can have multiple OS policy assignments, and each\nassignment can have multiple OS policies. As a result, multiple OS policies\ncould be applied to a single VM.\n\nYou can use this API resource to determine both the compliance state of your\nVM as well as the compliance state of an individual OS policy.\n\n\u003cbr /\u003e\n\nFor more information, see [View\ncompliance](https://cloud.google.com/compute/docs/os-configuration-management/view-compliance). \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### #detailed_state\n\n def detailed_state() -\u003e ::String\n\n**Returns**\n\n- (::String) --- Output only. Detailed compliance state of the VM.\n This field is populated only when compliance state is `UNKNOWN`.\n\n It may contain one of the following values:\n - `no-compliance-data`: Compliance data is not available for this VM.\n - `no-agent-detected`: OS Config agent is not detected for this VM.\n - `config-not-supported-by-agent`: The version of the OS Config agent running on this VM does not support configuration management.\n - `inactive`: VM is not running.\n - `internal-service-errors`: There were internal service errors encountered while enforcing compliance.\n - `agent-errors`: OS config agent encountered errors while enforcing compliance.\n\n### #detailed_state_reason\n\n def detailed_state_reason() -\u003e ::String\n\n**Returns**\n\n- (::String) --- Output only. The reason for the `detailed_state` of the VM (if any).\n\n### #instance\n\n def instance() -\u003e ::String\n\n**Returns**\n\n- (::String) --- Output only. The Compute Engine VM instance name.\n\n### #last_compliance_check_time\n\n def last_compliance_check_time() -\u003e ::Google::Protobuf::Timestamp\n\n**Returns**\n\n- ([::Google::Protobuf::Timestamp](./Google-Protobuf-Timestamp)) --- Output only. Timestamp of the last compliance check for the VM.\n\n### #last_compliance_run_id\n\n def last_compliance_run_id() -\u003e ::String\n\n**Returns**\n\n- (::String) --- Output only. Unique identifier for the last compliance run. This id will be logged by the OS config agent during a compliance run and can be used for debugging and tracing purpose.\n\n### #name\n\n def name() -\u003e ::String\n\n**Returns**\n\n- (::String) --- Output only. The `InstanceOSPoliciesCompliance` API resource name.\n\n\n Format:\n `projects/{project_number}/locations/{location}/instanceOSPoliciesCompliances/{instance_id}`\n\n### #os_policy_compliances\n\n def os_policy_compliances() -\u003e ::Array\u003c::Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance::OSPolicyCompliance\u003e\n\n**Returns**\n\n- (::Array\\\u003c[::Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance::OSPolicyCompliance](./Google-Cloud-OsConfig-V1alpha-InstanceOSPoliciesCompliance-OSPolicyCompliance)\\\u003e) --- Output only. Compliance data for each `OSPolicy` that is applied to the VM.\n\n### #state\n\n def state() -\u003e ::Google::Cloud::OsConfig::V1alpha::OSPolicyComplianceState\n\n**Returns**\n\n- ([::Google::Cloud::OsConfig::V1alpha::OSPolicyComplianceState](./Google-Cloud-OsConfig-V1alpha-OSPolicyComplianceState)) --- Output only. Compliance state of the VM."]]