<?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 remote or local file.
 *
 * Generated from protobuf message <code>google.cloud.osconfig.v1.OSPolicy.Resource.File</code>
 */
class File extends \Google\Protobuf\Internal\Message
{
    /**
     * Defaults to false. When false, files are subject to validations
     * based on the file type:
     * Remote: A checksum must be specified.
     * Cloud Storage: An object generation number must be specified.
     *
     * Generated from protobuf field <code>bool allow_insecure = 4;</code>
     */
    private $allow_insecure = false;
    protected $type;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\OsConfig\V1\OSPolicy\Resource\File\Remote $remote
     *           A generic remote file.
     *     @type \Google\Cloud\OsConfig\V1\OSPolicy\Resource\File\Gcs $gcs
     *           A Cloud Storage object.
     *     @type string $local_path
     *           A local path within the VM to use.
     *     @type bool $allow_insecure
     *           Defaults to false. When false, files are subject to validations
     *           based on the file type:
     *           Remote: A checksum must be specified.
     *           Cloud Storage: An object generation number must be specified.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Osconfig\V1\OsPolicy::initOnce();
        parent::__construct($data);
    }

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

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

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

        return $this;
    }

    /**
     * A Cloud Storage object.
     *
     * Generated from protobuf field <code>.google.cloud.osconfig.v1.OSPolicy.Resource.File.Gcs gcs = 2;</code>
     * @return \Google\Cloud\OsConfig\V1\OSPolicy\Resource\File\Gcs|null
     */
    public function getGcs()
    {
        return $this->readOneof(2);
    }

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

    /**
     * A Cloud Storage object.
     *
     * Generated from protobuf field <code>.google.cloud.osconfig.v1.OSPolicy.Resource.File.Gcs gcs = 2;</code>
     * @param \Google\Cloud\OsConfig\V1\OSPolicy\Resource\File\Gcs $var
     * @return $this
     */
    public function setGcs($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\OsConfig\V1\OSPolicy\Resource\File\Gcs::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * A local path within the VM to use.
     *
     * Generated from protobuf field <code>string local_path = 3;</code>
     * @return string
     */
    public function getLocalPath()
    {
        return $this->readOneof(3);
    }

    public function hasLocalPath()
    {
        return $this->hasOneof(3);
    }

    /**
     * A local path within the VM to use.
     *
     * Generated from protobuf field <code>string local_path = 3;</code>
     * @param string $var
     * @return $this
     */
    public function setLocalPath($var)
    {
        GPBUtil::checkString($var, True);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * Defaults to false. When false, files are subject to validations
     * based on the file type:
     * Remote: A checksum must be specified.
     * Cloud Storage: An object generation number must be specified.
     *
     * Generated from protobuf field <code>bool allow_insecure = 4;</code>
     * @return bool
     */
    public function getAllowInsecure()
    {
        return $this->allow_insecure;
    }

    /**
     * Defaults to false. When false, files are subject to validations
     * based on the file type:
     * Remote: A checksum must be specified.
     * Cloud Storage: An object generation number must be specified.
     *
     * Generated from protobuf field <code>bool allow_insecure = 4;</code>
     * @param bool $var
     * @return $this
     */
    public function setAllowInsecure($var)
    {
        GPBUtil::checkBool($var);
        $this->allow_insecure = $var;

        return $this;
    }

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

}


