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

namespace Google\Cloud\NetworkServices\V1;

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

/**
 * `LbTrafficExtension` is a resource that lets the extension service modify the
 * headers and payloads of both requests and responses without impacting the
 * choice of backend services or any other security policies associated with the
 * backend service.
 *
 * Generated from protobuf message <code>google.cloud.networkservices.v1.LbTrafficExtension</code>
 */
class LbTrafficExtension extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. Identifier. Name of the `LbTrafficExtension` resource in the
     * following format:
     * `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER];</code>
     */
    protected $name = '';
    /**
     * Output only. The timestamp when the resource was created.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $create_time = null;
    /**
     * Output only. The timestamp when the resource was updated.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $update_time = null;
    /**
     * Optional. A human-readable description of the resource.
     *
     * Generated from protobuf field <code>string description = 9 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $description = '';
    /**
     * Optional. Set of labels associated with the `LbTrafficExtension` resource.
     * The format must comply with [the requirements for
     * labels](https://cloud.google.com/compute/docs/labeling-resources#requirements)
     * for Google Cloud resources.
     *
     * Generated from protobuf field <code>map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $labels;
    /**
     * Optional. A list of references to the forwarding rules to which this
     * service extension is attached. At least one forwarding rule is required.
     * Only one `LbTrafficExtension` resource can be associated with a forwarding
     * rule.
     *
     * Generated from protobuf field <code>repeated string forwarding_rules = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $forwarding_rules;
    /**
     * Required. A set of ordered extension chains that contain the match
     * conditions and extensions to execute. Match conditions for each extension
     * chain are evaluated in sequence for a given request. The first extension
     * chain that has a condition that matches the request is executed.
     * Any subsequent extension chains do not execute.
     * Limited to 5 extension chains per resource.
     *
     * Generated from protobuf field <code>repeated .google.cloud.networkservices.v1.ExtensionChain extension_chains = 7 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $extension_chains;
    /**
     * Required. All backend services and forwarding rules referenced by this
     * extension must share the same load balancing scheme. Supported values:
     * `INTERNAL_MANAGED` and `EXTERNAL_MANAGED`. For more information, refer to
     * [Backend services
     * overview](https://cloud.google.com/load-balancing/docs/backend-service).
     *
     * Generated from protobuf field <code>.google.cloud.networkservices.v1.LoadBalancingScheme load_balancing_scheme = 8 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $load_balancing_scheme = 0;
    /**
     * Optional. The metadata provided here is included as part of the
     * `metadata_context` (of type `google.protobuf.Struct`) in the
     * `ProcessingRequest` message sent to the extension server.
     * The metadata applies to all extensions in all extensions chains in this
     * resource.
     * The metadata is available under the key
     * `com.google.lb_traffic_extension.<resource_name>`.
     * The following variables are supported in the metadata:
     * `{forwarding_rule_id}` - substituted with the forwarding rule's fully
     *   qualified resource name.
     * This field must not be set if at least one of the extension chains
     * contains plugin extensions. Setting it results in a validation error.
     * You can set metadata at either the resource level or the extension level.
     * The extension level metadata is recommended because you can pass a
     * different set of metadata through each extension to the backend.
     *
     * Generated from protobuf field <code>.google.protobuf.Struct metadata = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $metadata = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           Required. Identifier. Name of the `LbTrafficExtension` resource in the
     *           following format:
     *           `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`.
     *     @type \Google\Protobuf\Timestamp $create_time
     *           Output only. The timestamp when the resource was created.
     *     @type \Google\Protobuf\Timestamp $update_time
     *           Output only. The timestamp when the resource was updated.
     *     @type string $description
     *           Optional. A human-readable description of the resource.
     *     @type array|\Google\Protobuf\Internal\MapField $labels
     *           Optional. Set of labels associated with the `LbTrafficExtension` resource.
     *           The format must comply with [the requirements for
     *           labels](https://cloud.google.com/compute/docs/labeling-resources#requirements)
     *           for Google Cloud resources.
     *     @type array<string>|\Google\Protobuf\Internal\RepeatedField $forwarding_rules
     *           Optional. A list of references to the forwarding rules to which this
     *           service extension is attached. At least one forwarding rule is required.
     *           Only one `LbTrafficExtension` resource can be associated with a forwarding
     *           rule.
     *     @type array<\Google\Cloud\NetworkServices\V1\ExtensionChain>|\Google\Protobuf\Internal\RepeatedField $extension_chains
     *           Required. A set of ordered extension chains that contain the match
     *           conditions and extensions to execute. Match conditions for each extension
     *           chain are evaluated in sequence for a given request. The first extension
     *           chain that has a condition that matches the request is executed.
     *           Any subsequent extension chains do not execute.
     *           Limited to 5 extension chains per resource.
     *     @type int $load_balancing_scheme
     *           Required. All backend services and forwarding rules referenced by this
     *           extension must share the same load balancing scheme. Supported values:
     *           `INTERNAL_MANAGED` and `EXTERNAL_MANAGED`. For more information, refer to
     *           [Backend services
     *           overview](https://cloud.google.com/load-balancing/docs/backend-service).
     *     @type \Google\Protobuf\Struct $metadata
     *           Optional. The metadata provided here is included as part of the
     *           `metadata_context` (of type `google.protobuf.Struct`) in the
     *           `ProcessingRequest` message sent to the extension server.
     *           The metadata applies to all extensions in all extensions chains in this
     *           resource.
     *           The metadata is available under the key
     *           `com.google.lb_traffic_extension.<resource_name>`.
     *           The following variables are supported in the metadata:
     *           `{forwarding_rule_id}` - substituted with the forwarding rule's fully
     *             qualified resource name.
     *           This field must not be set if at least one of the extension chains
     *           contains plugin extensions. Setting it results in a validation error.
     *           You can set metadata at either the resource level or the extension level.
     *           The extension level metadata is recommended because you can pass a
     *           different set of metadata through each extension to the backend.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Networkservices\V1\Dep::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. Identifier. Name of the `LbTrafficExtension` resource in the
     * following format:
     * `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER];</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Required. Identifier. Name of the `LbTrafficExtension` resource in the
     * following format:
     * `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER];</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * Output only. The timestamp when the resource was created.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getCreateTime()
    {
        return $this->create_time;
    }

    public function hasCreateTime()
    {
        return isset($this->create_time);
    }

    public function clearCreateTime()
    {
        unset($this->create_time);
    }

    /**
     * Output only. The timestamp when the resource was created.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setCreateTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->create_time = $var;

        return $this;
    }

    /**
     * Output only. The timestamp when the resource was updated.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getUpdateTime()
    {
        return $this->update_time;
    }

    public function hasUpdateTime()
    {
        return isset($this->update_time);
    }

    public function clearUpdateTime()
    {
        unset($this->update_time);
    }

    /**
     * Output only. The timestamp when the resource was updated.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setUpdateTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->update_time = $var;

        return $this;
    }

    /**
     * Optional. A human-readable description of the resource.
     *
     * Generated from protobuf field <code>string description = 9 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * Optional. A human-readable description of the resource.
     *
     * Generated from protobuf field <code>string description = 9 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setDescription($var)
    {
        GPBUtil::checkString($var, True);
        $this->description = $var;

        return $this;
    }

    /**
     * Optional. Set of labels associated with the `LbTrafficExtension` resource.
     * The format must comply with [the requirements for
     * labels](https://cloud.google.com/compute/docs/labeling-resources#requirements)
     * for Google Cloud resources.
     *
     * Generated from protobuf field <code>map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Protobuf\Internal\MapField
     */
    public function getLabels()
    {
        return $this->labels;
    }

    /**
     * Optional. Set of labels associated with the `LbTrafficExtension` resource.
     * The format must comply with [the requirements for
     * labels](https://cloud.google.com/compute/docs/labeling-resources#requirements)
     * for Google Cloud resources.
     *
     * Generated from protobuf field <code>map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param array|\Google\Protobuf\Internal\MapField $var
     * @return $this
     */
    public function setLabels($var)
    {
        $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
        $this->labels = $arr;

        return $this;
    }

    /**
     * Optional. A list of references to the forwarding rules to which this
     * service extension is attached. At least one forwarding rule is required.
     * Only one `LbTrafficExtension` resource can be associated with a forwarding
     * rule.
     *
     * Generated from protobuf field <code>repeated string forwarding_rules = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getForwardingRules()
    {
        return $this->forwarding_rules;
    }

    /**
     * Optional. A list of references to the forwarding rules to which this
     * service extension is attached. At least one forwarding rule is required.
     * Only one `LbTrafficExtension` resource can be associated with a forwarding
     * rule.
     *
     * Generated from protobuf field <code>repeated string forwarding_rules = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param array<string>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setForwardingRules($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
        $this->forwarding_rules = $arr;

        return $this;
    }

    /**
     * Required. A set of ordered extension chains that contain the match
     * conditions and extensions to execute. Match conditions for each extension
     * chain are evaluated in sequence for a given request. The first extension
     * chain that has a condition that matches the request is executed.
     * Any subsequent extension chains do not execute.
     * Limited to 5 extension chains per resource.
     *
     * Generated from protobuf field <code>repeated .google.cloud.networkservices.v1.ExtensionChain extension_chains = 7 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getExtensionChains()
    {
        return $this->extension_chains;
    }

    /**
     * Required. A set of ordered extension chains that contain the match
     * conditions and extensions to execute. Match conditions for each extension
     * chain are evaluated in sequence for a given request. The first extension
     * chain that has a condition that matches the request is executed.
     * Any subsequent extension chains do not execute.
     * Limited to 5 extension chains per resource.
     *
     * Generated from protobuf field <code>repeated .google.cloud.networkservices.v1.ExtensionChain extension_chains = 7 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param array<\Google\Cloud\NetworkServices\V1\ExtensionChain>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setExtensionChains($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\ExtensionChain::class);
        $this->extension_chains = $arr;

        return $this;
    }

    /**
     * Required. All backend services and forwarding rules referenced by this
     * extension must share the same load balancing scheme. Supported values:
     * `INTERNAL_MANAGED` and `EXTERNAL_MANAGED`. For more information, refer to
     * [Backend services
     * overview](https://cloud.google.com/load-balancing/docs/backend-service).
     *
     * Generated from protobuf field <code>.google.cloud.networkservices.v1.LoadBalancingScheme load_balancing_scheme = 8 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return int
     */
    public function getLoadBalancingScheme()
    {
        return $this->load_balancing_scheme;
    }

    /**
     * Required. All backend services and forwarding rules referenced by this
     * extension must share the same load balancing scheme. Supported values:
     * `INTERNAL_MANAGED` and `EXTERNAL_MANAGED`. For more information, refer to
     * [Backend services
     * overview](https://cloud.google.com/load-balancing/docs/backend-service).
     *
     * Generated from protobuf field <code>.google.cloud.networkservices.v1.LoadBalancingScheme load_balancing_scheme = 8 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param int $var
     * @return $this
     */
    public function setLoadBalancingScheme($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\NetworkServices\V1\LoadBalancingScheme::class);
        $this->load_balancing_scheme = $var;

        return $this;
    }

    /**
     * Optional. The metadata provided here is included as part of the
     * `metadata_context` (of type `google.protobuf.Struct`) in the
     * `ProcessingRequest` message sent to the extension server.
     * The metadata applies to all extensions in all extensions chains in this
     * resource.
     * The metadata is available under the key
     * `com.google.lb_traffic_extension.<resource_name>`.
     * The following variables are supported in the metadata:
     * `{forwarding_rule_id}` - substituted with the forwarding rule's fully
     *   qualified resource name.
     * This field must not be set if at least one of the extension chains
     * contains plugin extensions. Setting it results in a validation error.
     * You can set metadata at either the resource level or the extension level.
     * The extension level metadata is recommended because you can pass a
     * different set of metadata through each extension to the backend.
     *
     * Generated from protobuf field <code>.google.protobuf.Struct metadata = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Protobuf\Struct|null
     */
    public function getMetadata()
    {
        return $this->metadata;
    }

    public function hasMetadata()
    {
        return isset($this->metadata);
    }

    public function clearMetadata()
    {
        unset($this->metadata);
    }

    /**
     * Optional. The metadata provided here is included as part of the
     * `metadata_context` (of type `google.protobuf.Struct`) in the
     * `ProcessingRequest` message sent to the extension server.
     * The metadata applies to all extensions in all extensions chains in this
     * resource.
     * The metadata is available under the key
     * `com.google.lb_traffic_extension.<resource_name>`.
     * The following variables are supported in the metadata:
     * `{forwarding_rule_id}` - substituted with the forwarding rule's fully
     *   qualified resource name.
     * This field must not be set if at least one of the extension chains
     * contains plugin extensions. Setting it results in a validation error.
     * You can set metadata at either the resource level or the extension level.
     * The extension level metadata is recommended because you can pass a
     * different set of metadata through each extension to the backend.
     *
     * Generated from protobuf field <code>.google.protobuf.Struct metadata = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Protobuf\Struct $var
     * @return $this
     */
    public function setMetadata($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class);
        $this->metadata = $var;

        return $this;
    }

}

