<?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;

/**
 * A single extension chain wrapper that contains the match conditions and
 * extensions to execute.
 *
 * Generated from protobuf message <code>google.cloud.networkservices.v1.ExtensionChain</code>
 */
class ExtensionChain extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The name for this extension chain.
     * The name is logged as part of the HTTP request logs.
     * The name must conform with RFC-1034, is restricted to lower-cased letters,
     * numbers and hyphens, and can have a maximum length of 63 characters.
     * Additionally, the first character must be a letter and the last a letter or
     * a number.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $name = '';
    /**
     * Required. Conditions under which this chain is invoked for a request.
     *
     * Generated from protobuf field <code>.google.cloud.networkservices.v1.ExtensionChain.MatchCondition match_condition = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $match_condition = null;
    /**
     * Required. A set of extensions to execute for the matching request.
     * At least one extension is required.
     * Up to 3 extensions can be defined for each extension chain
     * for `LbTrafficExtension` resource.
     * `LbRouteExtension` and `LbEdgeExtension` chains are limited to 1 extension
     * per extension chain.
     *
     * Generated from protobuf field <code>repeated .google.cloud.networkservices.v1.ExtensionChain.Extension extensions = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $extensions;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           Required. The name for this extension chain.
     *           The name is logged as part of the HTTP request logs.
     *           The name must conform with RFC-1034, is restricted to lower-cased letters,
     *           numbers and hyphens, and can have a maximum length of 63 characters.
     *           Additionally, the first character must be a letter and the last a letter or
     *           a number.
     *     @type \Google\Cloud\NetworkServices\V1\ExtensionChain\MatchCondition $match_condition
     *           Required. Conditions under which this chain is invoked for a request.
     *     @type array<\Google\Cloud\NetworkServices\V1\ExtensionChain\Extension>|\Google\Protobuf\Internal\RepeatedField $extensions
     *           Required. A set of extensions to execute for the matching request.
     *           At least one extension is required.
     *           Up to 3 extensions can be defined for each extension chain
     *           for `LbTrafficExtension` resource.
     *           `LbRouteExtension` and `LbEdgeExtension` chains are limited to 1 extension
     *           per extension chain.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Networkservices\V1\Dep::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The name for this extension chain.
     * The name is logged as part of the HTTP request logs.
     * The name must conform with RFC-1034, is restricted to lower-cased letters,
     * numbers and hyphens, and can have a maximum length of 63 characters.
     * Additionally, the first character must be a letter and the last a letter or
     * a number.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Required. The name for this extension chain.
     * The name is logged as part of the HTTP request logs.
     * The name must conform with RFC-1034, is restricted to lower-cased letters,
     * numbers and hyphens, and can have a maximum length of 63 characters.
     * Additionally, the first character must be a letter and the last a letter or
     * a number.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * Required. Conditions under which this chain is invoked for a request.
     *
     * Generated from protobuf field <code>.google.cloud.networkservices.v1.ExtensionChain.MatchCondition match_condition = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Cloud\NetworkServices\V1\ExtensionChain\MatchCondition|null
     */
    public function getMatchCondition()
    {
        return $this->match_condition;
    }

    public function hasMatchCondition()
    {
        return isset($this->match_condition);
    }

    public function clearMatchCondition()
    {
        unset($this->match_condition);
    }

    /**
     * Required. Conditions under which this chain is invoked for a request.
     *
     * Generated from protobuf field <code>.google.cloud.networkservices.v1.ExtensionChain.MatchCondition match_condition = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param \Google\Cloud\NetworkServices\V1\ExtensionChain\MatchCondition $var
     * @return $this
     */
    public function setMatchCondition($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\ExtensionChain\MatchCondition::class);
        $this->match_condition = $var;

        return $this;
    }

    /**
     * Required. A set of extensions to execute for the matching request.
     * At least one extension is required.
     * Up to 3 extensions can be defined for each extension chain
     * for `LbTrafficExtension` resource.
     * `LbRouteExtension` and `LbEdgeExtension` chains are limited to 1 extension
     * per extension chain.
     *
     * Generated from protobuf field <code>repeated .google.cloud.networkservices.v1.ExtensionChain.Extension extensions = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getExtensions()
    {
        return $this->extensions;
    }

    /**
     * Required. A set of extensions to execute for the matching request.
     * At least one extension is required.
     * Up to 3 extensions can be defined for each extension chain
     * for `LbTrafficExtension` resource.
     * `LbRouteExtension` and `LbEdgeExtension` chains are limited to 1 extension
     * per extension chain.
     *
     * Generated from protobuf field <code>repeated .google.cloud.networkservices.v1.ExtensionChain.Extension extensions = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param array<\Google\Cloud\NetworkServices\V1\ExtensionChain\Extension>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setExtensions($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\NetworkServices\V1\ExtensionChain\Extension::class);
        $this->extensions = $arr;

        return $this;
    }

}

