<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/osconfig/v1/os_policy_assignment_reports.proto

namespace Google\Cloud\OsConfig\V1\OSPolicyAssignmentReport;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * Compliance data for an OS policy
 *
 * Generated from protobuf message <code>google.cloud.osconfig.v1.OSPolicyAssignmentReport.OSPolicyCompliance</code>
 */
class OSPolicyCompliance extends \Google\Protobuf\Internal\Message
{
    /**
     * The OS policy id
     *
     * Generated from protobuf field <code>string os_policy_id = 1;</code>
     */
    private $os_policy_id = '';
    /**
     * The compliance state of the OS policy.
     *
     * Generated from protobuf field <code>.google.cloud.osconfig.v1.OSPolicyAssignmentReport.OSPolicyCompliance.ComplianceState compliance_state = 2;</code>
     */
    private $compliance_state = 0;
    /**
     * 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.
     *
     * Generated from protobuf field <code>string compliance_state_reason = 3;</code>
     */
    private $compliance_state_reason = '';
    /**
     * Compliance data for each resource within the policy that is applied to
     * the VM.
     *
     * Generated from protobuf field <code>repeated .google.cloud.osconfig.v1.OSPolicyAssignmentReport.OSPolicyCompliance.OSPolicyResourceCompliance os_policy_resource_compliances = 4;</code>
     */
    private $os_policy_resource_compliances;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $os_policy_id
     *           The OS policy id
     *     @type int $compliance_state
     *           The compliance state of the OS policy.
     *     @type string $compliance_state_reason
     *           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.
     *     @type array<\Google\Cloud\OsConfig\V1\OSPolicyAssignmentReport\OSPolicyCompliance\OSPolicyResourceCompliance>|\Google\Protobuf\Internal\RepeatedField $os_policy_resource_compliances
     *           Compliance data for each resource within the policy that is applied to
     *           the VM.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Osconfig\V1\OsPolicyAssignmentReports::initOnce();
        parent::__construct($data);
    }

    /**
     * The OS policy id
     *
     * Generated from protobuf field <code>string os_policy_id = 1;</code>
     * @return string
     */
    public function getOsPolicyId()
    {
        return $this->os_policy_id;
    }

    /**
     * The OS policy id
     *
     * Generated from protobuf field <code>string os_policy_id = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setOsPolicyId($var)
    {
        GPBUtil::checkString($var, True);
        $this->os_policy_id = $var;

        return $this;
    }

    /**
     * The compliance state of the OS policy.
     *
     * Generated from protobuf field <code>.google.cloud.osconfig.v1.OSPolicyAssignmentReport.OSPolicyCompliance.ComplianceState compliance_state = 2;</code>
     * @return int
     */
    public function getComplianceState()
    {
        return $this->compliance_state;
    }

    /**
     * The compliance state of the OS policy.
     *
     * Generated from protobuf field <code>.google.cloud.osconfig.v1.OSPolicyAssignmentReport.OSPolicyCompliance.ComplianceState compliance_state = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setComplianceState($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\OsConfig\V1\OSPolicyAssignmentReport\OSPolicyCompliance\ComplianceState::class);
        $this->compliance_state = $var;

        return $this;
    }

    /**
     * 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.
     *
     * Generated from protobuf field <code>string compliance_state_reason = 3;</code>
     * @return string
     */
    public function getComplianceStateReason()
    {
        return $this->compliance_state_reason;
    }

    /**
     * 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.
     *
     * Generated from protobuf field <code>string compliance_state_reason = 3;</code>
     * @param string $var
     * @return $this
     */
    public function setComplianceStateReason($var)
    {
        GPBUtil::checkString($var, True);
        $this->compliance_state_reason = $var;

        return $this;
    }

    /**
     * Compliance data for each resource within the policy that is applied to
     * the VM.
     *
     * Generated from protobuf field <code>repeated .google.cloud.osconfig.v1.OSPolicyAssignmentReport.OSPolicyCompliance.OSPolicyResourceCompliance os_policy_resource_compliances = 4;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getOsPolicyResourceCompliances()
    {
        return $this->os_policy_resource_compliances;
    }

    /**
     * Compliance data for each resource within the policy that is applied to
     * the VM.
     *
     * Generated from protobuf field <code>repeated .google.cloud.osconfig.v1.OSPolicyAssignmentReport.OSPolicyCompliance.OSPolicyResourceCompliance os_policy_resource_compliances = 4;</code>
     * @param array<\Google\Cloud\OsConfig\V1\OSPolicyAssignmentReport\OSPolicyCompliance\OSPolicyResourceCompliance>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setOsPolicyResourceCompliances($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\OsConfig\V1\OSPolicyAssignmentReport\OSPolicyCompliance\OSPolicyResourceCompliance::class);
        $this->os_policy_resource_compliances = $arr;

        return $this;
    }

}


