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

namespace Google\Cloud\OsConfig\V1\OSPolicy\Resource;

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

/**
 * A resource that manages the state of a file.
 *
 * Generated from protobuf message <code>google.cloud.osconfig.v1.OSPolicy.Resource.FileResource</code>
 */
class FileResource extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The absolute path of the file within the VM.
     *
     * Generated from protobuf field <code>string path = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $path = '';
    /**
     * Required. Desired state of the file.
     *
     * Generated from protobuf field <code>.google.cloud.osconfig.v1.OSPolicy.Resource.FileResource.DesiredState state = 4 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $state = 0;
    /**
     * Consists of three octal digits which represent, in
     * order, the permissions of the owner, group, and other users for the
     * file (similarly to the numeric mode used in the linux chmod
     * utility). Each digit represents a three bit number with the 4 bit
     * corresponding to the read permissions, the 2 bit corresponds to the
     * write bit, and the one bit corresponds to the execute permission.
     * Default behavior is 755.
     * Below are some examples of permissions and their associated values:
     * read, write, and execute: 7
     * read and execute: 5
     * read and write: 6
     * read only: 4
     *
     * Generated from protobuf field <code>string permissions = 5;</code>
     */
    private $permissions = '';
    protected $source;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\OsConfig\V1\OSPolicy\Resource\File $file
     *           A remote or local source.
     *     @type string $content
     *           A a file with this content.
     *           The size of the content is limited to 1024 characters.
     *     @type string $path
     *           Required. The absolute path of the file within the VM.
     *     @type int $state
     *           Required. Desired state of the file.
     *     @type string $permissions
     *           Consists of three octal digits which represent, in
     *           order, the permissions of the owner, group, and other users for the
     *           file (similarly to the numeric mode used in the linux chmod
     *           utility). Each digit represents a three bit number with the 4 bit
     *           corresponding to the read permissions, the 2 bit corresponds to the
     *           write bit, and the one bit corresponds to the execute permission.
     *           Default behavior is 755.
     *           Below are some examples of permissions and their associated values:
     *           read, write, and execute: 7
     *           read and execute: 5
     *           read and write: 6
     *           read only: 4
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Osconfig\V1\OsPolicy::initOnce();
        parent::__construct($data);
    }

    /**
     * A remote or local source.
     *
     * Generated from protobuf field <code>.google.cloud.osconfig.v1.OSPolicy.Resource.File file = 1;</code>
     * @return \Google\Cloud\OsConfig\V1\OSPolicy\Resource\File|null
     */
    public function getFile()
    {
        return $this->readOneof(1);
    }

    public function hasFile()
    {
        return $this->hasOneof(1);
    }

    /**
     * A remote or local source.
     *
     * Generated from protobuf field <code>.google.cloud.osconfig.v1.OSPolicy.Resource.File file = 1;</code>
     * @param \Google\Cloud\OsConfig\V1\OSPolicy\Resource\File $var
     * @return $this
     */
    public function setFile($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\OsConfig\V1\OSPolicy\Resource\File::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * A a file with this content.
     * The size of the content is limited to 1024 characters.
     *
     * Generated from protobuf field <code>string content = 2;</code>
     * @return string
     */
    public function getContent()
    {
        return $this->readOneof(2);
    }

    public function hasContent()
    {
        return $this->hasOneof(2);
    }

    /**
     * A a file with this content.
     * The size of the content is limited to 1024 characters.
     *
     * Generated from protobuf field <code>string content = 2;</code>
     * @param string $var
     * @return $this
     */
    public function setContent($var)
    {
        GPBUtil::checkString($var, True);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * Required. The absolute path of the file within the VM.
     *
     * Generated from protobuf field <code>string path = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getPath()
    {
        return $this->path;
    }

    /**
     * Required. The absolute path of the file within the VM.
     *
     * Generated from protobuf field <code>string path = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setPath($var)
    {
        GPBUtil::checkString($var, True);
        $this->path = $var;

        return $this;
    }

    /**
     * Required. Desired state of the file.
     *
     * Generated from protobuf field <code>.google.cloud.osconfig.v1.OSPolicy.Resource.FileResource.DesiredState state = 4 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return int
     */
    public function getState()
    {
        return $this->state;
    }

    /**
     * Required. Desired state of the file.
     *
     * Generated from protobuf field <code>.google.cloud.osconfig.v1.OSPolicy.Resource.FileResource.DesiredState state = 4 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param int $var
     * @return $this
     */
    public function setState($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\OsConfig\V1\OSPolicy\Resource\FileResource\DesiredState::class);
        $this->state = $var;

        return $this;
    }

    /**
     * Consists of three octal digits which represent, in
     * order, the permissions of the owner, group, and other users for the
     * file (similarly to the numeric mode used in the linux chmod
     * utility). Each digit represents a three bit number with the 4 bit
     * corresponding to the read permissions, the 2 bit corresponds to the
     * write bit, and the one bit corresponds to the execute permission.
     * Default behavior is 755.
     * Below are some examples of permissions and their associated values:
     * read, write, and execute: 7
     * read and execute: 5
     * read and write: 6
     * read only: 4
     *
     * Generated from protobuf field <code>string permissions = 5;</code>
     * @return string
     */
    public function getPermissions()
    {
        return $this->permissions;
    }

    /**
     * Consists of three octal digits which represent, in
     * order, the permissions of the owner, group, and other users for the
     * file (similarly to the numeric mode used in the linux chmod
     * utility). Each digit represents a three bit number with the 4 bit
     * corresponding to the read permissions, the 2 bit corresponds to the
     * write bit, and the one bit corresponds to the execute permission.
     * Default behavior is 755.
     * Below are some examples of permissions and their associated values:
     * read, write, and execute: 7
     * read and execute: 5
     * read and write: 6
     * read only: 4
     *
     * Generated from protobuf field <code>string permissions = 5;</code>
     * @param string $var
     * @return $this
     */
    public function setPermissions($var)
    {
        GPBUtil::checkString($var, True);
        $this->permissions = $var;

        return $this;
    }

    /**
     * @return string
     */
    public function getSource()
    {
        return $this->whichOneof("source");
    }

}


