<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/identity/accesscontextmanager/v1/service_perimeter.proto

namespace Google\Identity\AccessContextManager\V1\ServicePerimeterConfig;

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

/**
 * The source that [IngressPolicy]
 * [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy]
 * authorizes access from.
 *
 * Generated from protobuf message <code>google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressSource</code>
 */
class IngressSource extends \Google\Protobuf\Internal\Message
{
    protected $source;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $access_level
     *           An [AccessLevel]
     *           [google.identity.accesscontextmanager.v1.AccessLevel] resource
     *           name that allow resources within the [ServicePerimeters]
     *           [google.identity.accesscontextmanager.v1.ServicePerimeter] to be
     *           accessed from the internet. [AccessLevels]
     *           [google.identity.accesscontextmanager.v1.AccessLevel] listed must
     *           be in the same policy as this [ServicePerimeter]
     *           [google.identity.accesscontextmanager.v1.ServicePerimeter].
     *           Referencing a nonexistent [AccessLevel]
     *           [google.identity.accesscontextmanager.v1.AccessLevel] will cause
     *           an error. If no [AccessLevel]
     *           [google.identity.accesscontextmanager.v1.AccessLevel] names are
     *           listed, resources within the perimeter can only be accessed via Google
     *           Cloud calls with request origins within the perimeter. Example:
     *           `accessPolicies/MY_POLICY/accessLevels/MY_LEVEL`. If a single `*` is
     *           specified for `access_level`, then all [IngressSources]
     *           [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressSource]
     *           will be allowed.
     *     @type string $resource
     *           A Google Cloud resource that is allowed to ingress the perimeter.
     *           Requests from these resources will be allowed to access perimeter data.
     *           Currently only projects are allowed.
     *           Format: `projects/{project_number}`
     *           The project may be in any Google Cloud organization, not just the
     *           organization that the perimeter is defined in. `*` is not allowed, the
     *           case of allowing all Google Cloud resources only is not supported.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Identity\Accesscontextmanager\V1\ServicePerimeter::initOnce();
        parent::__construct($data);
    }

    /**
     * An [AccessLevel]
     * [google.identity.accesscontextmanager.v1.AccessLevel] resource
     * name that allow resources within the [ServicePerimeters]
     * [google.identity.accesscontextmanager.v1.ServicePerimeter] to be
     * accessed from the internet. [AccessLevels]
     * [google.identity.accesscontextmanager.v1.AccessLevel] listed must
     * be in the same policy as this [ServicePerimeter]
     * [google.identity.accesscontextmanager.v1.ServicePerimeter].
     * Referencing a nonexistent [AccessLevel]
     * [google.identity.accesscontextmanager.v1.AccessLevel] will cause
     * an error. If no [AccessLevel]
     * [google.identity.accesscontextmanager.v1.AccessLevel] names are
     * listed, resources within the perimeter can only be accessed via Google
     * Cloud calls with request origins within the perimeter. Example:
     * `accessPolicies/MY_POLICY/accessLevels/MY_LEVEL`. If a single `*` is
     * specified for `access_level`, then all [IngressSources]
     * [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressSource]
     * will be allowed.
     *
     * Generated from protobuf field <code>string access_level = 1;</code>
     * @return string
     */
    public function getAccessLevel()
    {
        return $this->readOneof(1);
    }

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

    /**
     * An [AccessLevel]
     * [google.identity.accesscontextmanager.v1.AccessLevel] resource
     * name that allow resources within the [ServicePerimeters]
     * [google.identity.accesscontextmanager.v1.ServicePerimeter] to be
     * accessed from the internet. [AccessLevels]
     * [google.identity.accesscontextmanager.v1.AccessLevel] listed must
     * be in the same policy as this [ServicePerimeter]
     * [google.identity.accesscontextmanager.v1.ServicePerimeter].
     * Referencing a nonexistent [AccessLevel]
     * [google.identity.accesscontextmanager.v1.AccessLevel] will cause
     * an error. If no [AccessLevel]
     * [google.identity.accesscontextmanager.v1.AccessLevel] names are
     * listed, resources within the perimeter can only be accessed via Google
     * Cloud calls with request origins within the perimeter. Example:
     * `accessPolicies/MY_POLICY/accessLevels/MY_LEVEL`. If a single `*` is
     * specified for `access_level`, then all [IngressSources]
     * [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressSource]
     * will be allowed.
     *
     * Generated from protobuf field <code>string access_level = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setAccessLevel($var)
    {
        GPBUtil::checkString($var, True);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * A Google Cloud resource that is allowed to ingress the perimeter.
     * Requests from these resources will be allowed to access perimeter data.
     * Currently only projects are allowed.
     * Format: `projects/{project_number}`
     * The project may be in any Google Cloud organization, not just the
     * organization that the perimeter is defined in. `*` is not allowed, the
     * case of allowing all Google Cloud resources only is not supported.
     *
     * Generated from protobuf field <code>string resource = 2;</code>
     * @return string
     */
    public function getResource()
    {
        return $this->readOneof(2);
    }

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

    /**
     * A Google Cloud resource that is allowed to ingress the perimeter.
     * Requests from these resources will be allowed to access perimeter data.
     * Currently only projects are allowed.
     * Format: `projects/{project_number}`
     * The project may be in any Google Cloud organization, not just the
     * organization that the perimeter is defined in. `*` is not allowed, the
     * case of allowing all Google Cloud resources only is not supported.
     *
     * Generated from protobuf field <code>string resource = 2;</code>
     * @param string $var
     * @return $this
     */
    public function setResource($var)
    {
        GPBUtil::checkString($var, True);
        $this->writeOneof(2, $var);

        return $this;
    }

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

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(IngressSource::class, \Google\Identity\AccessContextManager\V1\ServicePerimeterConfig_IngressSource::class);

