Reference documentation and code samples for the Cloud OS Config V1 API class Google::Cloud::OsConfig::V1::OSPolicyAssignmentReport::OSPolicyCompliance.
The reason for the OS policy to be in an unknown compliance state.
This field is always populated when compliance_state is UNKNOWN.
If populated, the field can contain one of the following values:
vm-not-running: The VM was not running.
os-policies-not-supported-by-agent: The version of the OS Config
agent running on the VM does not support running OS policies.
no-agent-detected: The OS Config agent is not detected for the VM.
resource-execution-errors: The OS Config agent encountered errors
while executing one or more resources in the policy. See
os_policy_resource_compliances for details.
task-timeout: The task sent to the agent to apply the policy timed
out.
unexpected-agent-state: The OS Config agent did not report the final
status of the task that attempted to apply the policy. Instead, the agent
unexpectedly started working on a different task. This mostly happens
when the agent or VM unexpectedly restarts while applying OS policies.
internal-service-errors: Internal service errors were encountered
while attempting to apply the policy.
#compliance_state_reason=
defcompliance_state_reason=(value)->::String
Parameter
value (::String) —
The reason for the OS policy to be in an unknown compliance state.
This field is always populated when compliance_state is UNKNOWN.
If populated, the field can contain one of the following values:
vm-not-running: The VM was not running.
os-policies-not-supported-by-agent: The version of the OS Config
agent running on the VM does not support running OS policies.
no-agent-detected: The OS Config agent is not detected for the VM.
resource-execution-errors: The OS Config agent encountered errors
while executing one or more resources in the policy. See
os_policy_resource_compliances for details.
task-timeout: The task sent to the agent to apply the policy timed
out.
unexpected-agent-state: The OS Config agent did not report the final
status of the task that attempted to apply the policy. Instead, the agent
unexpectedly started working on a different task. This mostly happens
when the agent or VM unexpectedly restarts while applying OS policies.
internal-service-errors: Internal service errors were encountered
while attempting to apply the policy.
Returns
(::String) —
The reason for the OS policy to be in an unknown compliance state.
This field is always populated when compliance_state is UNKNOWN.
If populated, the field can contain one of the following values:
vm-not-running: The VM was not running.
os-policies-not-supported-by-agent: The version of the OS Config
agent running on the VM does not support running OS policies.
no-agent-detected: The OS Config agent is not detected for the VM.
resource-execution-errors: The OS Config agent encountered errors
while executing one or more resources in the policy. See
os_policy_resource_compliances for details.
task-timeout: The task sent to the agent to apply the policy timed
out.
unexpected-agent-state: The OS Config agent did not report the final
status of the task that attempted to apply the policy. Instead, the agent
unexpectedly started working on a different task. This mostly happens
when the agent or VM unexpectedly restarts while applying OS policies.
internal-service-errors: Internal service errors were encountered
while attempting to apply the policy.
[[["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::OSPolicyAssignmentReport::OSPolicyCompliance (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-OSPolicyAssignmentReport-OSPolicyCompliance)\n- [1.3.0](/ruby/docs/reference/google-cloud-os_config-v1/1.3.0/Google-Cloud-OsConfig-V1-OSPolicyAssignmentReport-OSPolicyCompliance)\n- [1.2.1](/ruby/docs/reference/google-cloud-os_config-v1/1.2.1/Google-Cloud-OsConfig-V1-OSPolicyAssignmentReport-OSPolicyCompliance)\n- [1.1.0](/ruby/docs/reference/google-cloud-os_config-v1/1.1.0/Google-Cloud-OsConfig-V1-OSPolicyAssignmentReport-OSPolicyCompliance)\n- [1.0.1](/ruby/docs/reference/google-cloud-os_config-v1/1.0.1/Google-Cloud-OsConfig-V1-OSPolicyAssignmentReport-OSPolicyCompliance)\n- [0.16.0](/ruby/docs/reference/google-cloud-os_config-v1/0.16.0/Google-Cloud-OsConfig-V1-OSPolicyAssignmentReport-OSPolicyCompliance)\n- [0.15.2](/ruby/docs/reference/google-cloud-os_config-v1/0.15.2/Google-Cloud-OsConfig-V1-OSPolicyAssignmentReport-OSPolicyCompliance)\n- [0.14.0](/ruby/docs/reference/google-cloud-os_config-v1/0.14.0/Google-Cloud-OsConfig-V1-OSPolicyAssignmentReport-OSPolicyCompliance)\n- [0.13.0](/ruby/docs/reference/google-cloud-os_config-v1/0.13.0/Google-Cloud-OsConfig-V1-OSPolicyAssignmentReport-OSPolicyCompliance)\n- [0.12.0](/ruby/docs/reference/google-cloud-os_config-v1/0.12.0/Google-Cloud-OsConfig-V1-OSPolicyAssignmentReport-OSPolicyCompliance)\n- [0.11.0](/ruby/docs/reference/google-cloud-os_config-v1/0.11.0/Google-Cloud-OsConfig-V1-OSPolicyAssignmentReport-OSPolicyCompliance)\n- [0.10.0](/ruby/docs/reference/google-cloud-os_config-v1/0.10.0/Google-Cloud-OsConfig-V1-OSPolicyAssignmentReport-OSPolicyCompliance)\n- [0.9.1](/ruby/docs/reference/google-cloud-os_config-v1/0.9.1/Google-Cloud-OsConfig-V1-OSPolicyAssignmentReport-OSPolicyCompliance) \nReference documentation and code samples for the Cloud OS Config V1 API class Google::Cloud::OsConfig::V1::OSPolicyAssignmentReport::OSPolicyCompliance.\n\nCompliance data for an OS policy \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### #compliance_state\n\n def compliance_state() -\u003e ::Google::Cloud::OsConfig::V1::OSPolicyAssignmentReport::OSPolicyCompliance::ComplianceState\n\n**Returns**\n\n- ([::Google::Cloud::OsConfig::V1::OSPolicyAssignmentReport::OSPolicyCompliance::ComplianceState](./Google-Cloud-OsConfig-V1-OSPolicyAssignmentReport-OSPolicyCompliance-ComplianceState)) --- The compliance state of the OS policy.\n\n### #compliance_state=\n\n def compliance_state=(value) -\u003e ::Google::Cloud::OsConfig::V1::OSPolicyAssignmentReport::OSPolicyCompliance::ComplianceState\n\n**Parameter**\n\n- **value** ([::Google::Cloud::OsConfig::V1::OSPolicyAssignmentReport::OSPolicyCompliance::ComplianceState](./Google-Cloud-OsConfig-V1-OSPolicyAssignmentReport-OSPolicyCompliance-ComplianceState)) --- The compliance state of the OS policy. \n**Returns**\n\n- ([::Google::Cloud::OsConfig::V1::OSPolicyAssignmentReport::OSPolicyCompliance::ComplianceState](./Google-Cloud-OsConfig-V1-OSPolicyAssignmentReport-OSPolicyCompliance-ComplianceState)) --- The compliance state of the OS policy.\n\n### #compliance_state_reason\n\n def compliance_state_reason() -\u003e ::String\n\n**Returns**\n\n- (::String) --- The reason for the OS policy to be in an unknown compliance state.\n This field is always populated when `compliance_state` is `UNKNOWN`.\n\n If populated, the field can contain one of the following values:\n - `vm-not-running`: The VM was not running.\n - `os-policies-not-supported-by-agent`: The version of the OS Config agent running on the VM does not support running OS policies.\n - `no-agent-detected`: The OS Config agent is not detected for the VM.\n - `resource-execution-errors`: The OS Config agent encountered errors while executing one or more resources in the policy. See `os_policy_resource_compliances` for details.\n - `task-timeout`: The task sent to the agent to apply the policy timed out.\n - `unexpected-agent-state`: The OS Config agent did not report the final status of the task that attempted to apply the policy. Instead, the agent unexpectedly started working on a different task. This mostly happens when the agent or VM unexpectedly restarts while applying OS policies.\n - `internal-service-errors`: Internal service errors were encountered while attempting to apply the policy.\n\n### #compliance_state_reason=\n\n def compliance_state_reason=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) ---\n\n The reason for the OS policy to be in an unknown compliance state.\n This field is always populated when `compliance_state` is `UNKNOWN`.\n\n If populated, the field can contain one of the following values:\n - `vm-not-running`: The VM was not running.\n - `os-policies-not-supported-by-agent`: The version of the OS Config agent running on the VM does not support running OS policies.\n - `no-agent-detected`: The OS Config agent is not detected for the VM.\n - `resource-execution-errors`: The OS Config agent encountered errors while executing one or more resources in the policy. See `os_policy_resource_compliances` for details.\n - `task-timeout`: The task sent to the agent to apply the policy timed out.\n - `unexpected-agent-state`: The OS Config agent did not report the final status of the task that attempted to apply the policy. Instead, the agent unexpectedly started working on a different task. This mostly happens when the agent or VM unexpectedly restarts while applying OS policies.\n- `internal-service-errors`: Internal service errors were encountered while attempting to apply the policy. \n**Returns**\n\n- (::String) --- The reason for the OS policy to be in an unknown compliance state.\n This field is always populated when `compliance_state` is `UNKNOWN`.\n\n If populated, the field can contain one of the following values:\n - `vm-not-running`: The VM was not running.\n - `os-policies-not-supported-by-agent`: The version of the OS Config agent running on the VM does not support running OS policies.\n - `no-agent-detected`: The OS Config agent is not detected for the VM.\n - `resource-execution-errors`: The OS Config agent encountered errors while executing one or more resources in the policy. See `os_policy_resource_compliances` for details.\n - `task-timeout`: The task sent to the agent to apply the policy timed out.\n - `unexpected-agent-state`: The OS Config agent did not report the final status of the task that attempted to apply the policy. Instead, the agent unexpectedly started working on a different task. This mostly happens when the agent or VM unexpectedly restarts while applying OS policies.\n - `internal-service-errors`: Internal service errors were encountered while attempting to apply the policy.\n\n### #os_policy_id\n\n def os_policy_id() -\u003e ::String\n\n**Returns**\n\n- (::String) --- The OS policy id\n\n### #os_policy_id=\n\n def os_policy_id=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- The OS policy id \n**Returns**\n\n- (::String) --- The OS policy id\n\n### #os_policy_resource_compliances\n\n def os_policy_resource_compliances() -\u003e ::Array\u003c::Google::Cloud::OsConfig::V1::OSPolicyAssignmentReport::OSPolicyCompliance::OSPolicyResourceCompliance\u003e\n\n**Returns**\n\n- (::Array\\\u003c[::Google::Cloud::OsConfig::V1::OSPolicyAssignmentReport::OSPolicyCompliance::OSPolicyResourceCompliance](./Google-Cloud-OsConfig-V1-OSPolicyAssignmentReport-OSPolicyCompliance-OSPolicyResourceCompliance)\\\u003e) --- Compliance data for each resource within the policy that is applied to the VM.\n\n### #os_policy_resource_compliances=\n\n def os_policy_resource_compliances=(value) -\u003e ::Array\u003c::Google::Cloud::OsConfig::V1::OSPolicyAssignmentReport::OSPolicyCompliance::OSPolicyResourceCompliance\u003e\n\n**Parameter**\n\n- **value** (::Array\\\u003c[::Google::Cloud::OsConfig::V1::OSPolicyAssignmentReport::OSPolicyCompliance::OSPolicyResourceCompliance](./Google-Cloud-OsConfig-V1-OSPolicyAssignmentReport-OSPolicyCompliance-OSPolicyResourceCompliance)\\\u003e) --- Compliance data for each resource within the policy that is applied to the VM. \n**Returns**\n\n- (::Array\\\u003c[::Google::Cloud::OsConfig::V1::OSPolicyAssignmentReport::OSPolicyCompliance::OSPolicyResourceCompliance](./Google-Cloud-OsConfig-V1-OSPolicyAssignmentReport-OSPolicyCompliance-OSPolicyResourceCompliance)\\\u003e) --- Compliance data for each resource within the policy that is applied to the VM."]]