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

namespace Google\Cloud\NetworkServices\V1\HttpRoute\FaultInjectionPolicy;

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

/**
 * Specification of how client requests are delayed as part of fault
 * injection before being sent to a destination.
 *
 * Generated from protobuf message <code>google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy.Delay</code>
 */
class Delay extends \Google\Protobuf\Internal\Message
{
    /**
     * Specify a fixed delay before forwarding the request.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration fixed_delay = 1;</code>
     */
    protected $fixed_delay = null;
    /**
     * The percentage of traffic on which delay will be injected.
     * The value must be between [0, 100]
     *
     * Generated from protobuf field <code>int32 percentage = 2;</code>
     */
    protected $percentage = 0;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Protobuf\Duration $fixed_delay
     *           Specify a fixed delay before forwarding the request.
     *     @type int $percentage
     *           The percentage of traffic on which delay will be injected.
     *           The value must be between [0, 100]
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce();
        parent::__construct($data);
    }

    /**
     * Specify a fixed delay before forwarding the request.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration fixed_delay = 1;</code>
     * @return \Google\Protobuf\Duration|null
     */
    public function getFixedDelay()
    {
        return $this->fixed_delay;
    }

    public function hasFixedDelay()
    {
        return isset($this->fixed_delay);
    }

    public function clearFixedDelay()
    {
        unset($this->fixed_delay);
    }

    /**
     * Specify a fixed delay before forwarding the request.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration fixed_delay = 1;</code>
     * @param \Google\Protobuf\Duration $var
     * @return $this
     */
    public function setFixedDelay($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class);
        $this->fixed_delay = $var;

        return $this;
    }

    /**
     * The percentage of traffic on which delay will be injected.
     * The value must be between [0, 100]
     *
     * Generated from protobuf field <code>int32 percentage = 2;</code>
     * @return int
     */
    public function getPercentage()
    {
        return $this->percentage;
    }

    /**
     * The percentage of traffic on which delay will be injected.
     * The value must be between [0, 100]
     *
     * Generated from protobuf field <code>int32 percentage = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setPercentage($var)
    {
        GPBUtil::checkInt32($var);
        $this->percentage = $var;

        return $this;
    }

}


