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

namespace Google\Cloud\NetworkServices\V1\HttpRoute;

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

/**
 * The specification for fault injection introduced into traffic to test the
 * resiliency of clients to destination service failure. As part of fault
 * injection, when clients send requests to a destination, delays can be
 * introduced by client proxy on a percentage of requests before sending those
 * requests to the destination service. Similarly requests can be aborted by
 * client proxy for a percentage of requests.
 *
 * Generated from protobuf message <code>google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy</code>
 */
class FaultInjectionPolicy extends \Google\Protobuf\Internal\Message
{
    /**
     * The specification for injecting delay to client requests.
     *
     * Generated from protobuf field <code>.google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy.Delay delay = 1;</code>
     */
    protected $delay = null;
    /**
     * The specification for aborting to client requests.
     *
     * Generated from protobuf field <code>.google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy.Abort abort = 2;</code>
     */
    protected $abort = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\NetworkServices\V1\HttpRoute\FaultInjectionPolicy\Delay $delay
     *           The specification for injecting delay to client requests.
     *     @type \Google\Cloud\NetworkServices\V1\HttpRoute\FaultInjectionPolicy\Abort $abort
     *           The specification for aborting to client requests.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Networkservices\V1\HttpRoute::initOnce();
        parent::__construct($data);
    }

    /**
     * The specification for injecting delay to client requests.
     *
     * Generated from protobuf field <code>.google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy.Delay delay = 1;</code>
     * @return \Google\Cloud\NetworkServices\V1\HttpRoute\FaultInjectionPolicy\Delay|null
     */
    public function getDelay()
    {
        return $this->delay;
    }

    public function hasDelay()
    {
        return isset($this->delay);
    }

    public function clearDelay()
    {
        unset($this->delay);
    }

    /**
     * The specification for injecting delay to client requests.
     *
     * Generated from protobuf field <code>.google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy.Delay delay = 1;</code>
     * @param \Google\Cloud\NetworkServices\V1\HttpRoute\FaultInjectionPolicy\Delay $var
     * @return $this
     */
    public function setDelay($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\HttpRoute\FaultInjectionPolicy\Delay::class);
        $this->delay = $var;

        return $this;
    }

    /**
     * The specification for aborting to client requests.
     *
     * Generated from protobuf field <code>.google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy.Abort abort = 2;</code>
     * @return \Google\Cloud\NetworkServices\V1\HttpRoute\FaultInjectionPolicy\Abort|null
     */
    public function getAbort()
    {
        return $this->abort;
    }

    public function hasAbort()
    {
        return isset($this->abort);
    }

    public function clearAbort()
    {
        unset($this->abort);
    }

    /**
     * The specification for aborting to client requests.
     *
     * Generated from protobuf field <code>.google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy.Abort abort = 2;</code>
     * @param \Google\Cloud\NetworkServices\V1\HttpRoute\FaultInjectionPolicy\Abort $var
     * @return $this
     */
    public function setAbort($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\HttpRoute\FaultInjectionPolicy\Abort::class);
        $this->abort = $var;

        return $this;
    }

}


