# Cloud OS Config V1alpha API - Class Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance (v0.17.0)

0.17.0 (latest) 0.16.1 0.15.0 0.14.1 0.13.0 0.12.0 0.11.1 0.10.0 0.9.1 0.8.2 0.7.0 0.6.0 0.5.0 0.4.0 0.3.0 0.2.2 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.

<br />

For more information, see [View
compliance](https://cloud.google.com/compute/docs/os-configuration-management/view-compliance).

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #detailed_state

    def detailed_state() -> ::String

**Returns**

- (::String) --- Output only. Detailed compliance state of the VM.
  This field is populated only when compliance state is `UNKNOWN`.

  It may contain one of the following values:
  - `no-compliance-data`: Compliance data is not available for this VM.
  - `no-agent-detected`: OS Config agent is not detected for this VM.
  - `config-not-supported-by-agent`: The version of the OS Config agent running on this VM does not support configuration management.
  - `inactive`: VM is not running.
  - `internal-service-errors`: There were internal service errors encountered while enforcing compliance.
  - `agent-errors`: OS config agent encountered errors while enforcing compliance.

### #detailed_state_reason

    def detailed_state_reason() -> ::String

**Returns**

- (::String) --- Output only. The reason for the `detailed_state` of the VM (if any).

### #instance

    def instance() -> ::String

**Returns**

- (::String) --- Output only. The Compute Engine VM instance name.

### #last_compliance_check_time

    def last_compliance_check_time() -> ::Google::Protobuf::Timestamp

**Returns**

- ([::Google::Protobuf::Timestamp](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-os_config-v1alpha/latest/Google-Protobuf-Timestamp)) --- Output only. Timestamp of the last compliance check for the VM.

### #last_compliance_run_id

    def last_compliance_run_id() -> ::String

**Returns**

- (::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

    def name() -> ::String

**Returns**

- (::String) --- Output only. The `InstanceOSPoliciesCompliance` API resource name.


  Format:
  `projects/{project_number}/locations/{location}/instanceOSPoliciesCompliances/{instance_id}`

### #os_policy_compliances

    def os_policy_compliances() -> ::Array<::Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance::OSPolicyCompliance>

**Returns**

- (::Array\<[::Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance::OSPolicyCompliance](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-os_config-v1alpha/latest/Google-Cloud-OsConfig-V1alpha-InstanceOSPoliciesCompliance-OSPolicyCompliance)\>) --- Output only. Compliance data for each `OSPolicy` that is applied to the VM.

### #state

    def state() -> ::Google::Cloud::OsConfig::V1alpha::OSPolicyComplianceState

**Returns**

- ([::Google::Cloud::OsConfig::V1alpha::OSPolicyComplianceState](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-os_config-v1alpha/latest/Google-Cloud-OsConfig-V1alpha-OSPolicyComplianceState)) --- Output only. Compliance state of the VM.