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

namespace Google\Cloud\Compute\V1;

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 backend service failure. As part of fault injection, when clients send requests to a backend service, delays can be introduced by Loadbalancer on a percentage of requests before sending those request to the backend service. Similarly requests from clients can be aborted by the Loadbalancer for a percentage of requests.
 *
 * Generated from protobuf message <code>google.cloud.compute.v1.HttpFaultInjection</code>
 */
class HttpFaultInjection extends \Google\Protobuf\Internal\Message
{
    /**
     * The specification for how client requests are aborted as part of fault injection.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.HttpFaultAbort abort = 92611376;</code>
     */
    private $abort = null;
    /**
     * The specification for how client requests are delayed as part of fault injection, before being sent to a backend service.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.HttpFaultDelay delay = 95467907;</code>
     */
    private $delay = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Compute\V1\HttpFaultAbort $abort
     *           The specification for how client requests are aborted as part of fault injection.
     *     @type \Google\Cloud\Compute\V1\HttpFaultDelay $delay
     *           The specification for how client requests are delayed as part of fault injection, before being sent to a backend service.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce();
        parent::__construct($data);
    }

    /**
     * The specification for how client requests are aborted as part of fault injection.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.HttpFaultAbort abort = 92611376;</code>
     * @return \Google\Cloud\Compute\V1\HttpFaultAbort|null
     */
    public function getAbort()
    {
        return isset($this->abort) ? $this->abort : null;
    }

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

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

    /**
     * The specification for how client requests are aborted as part of fault injection.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.HttpFaultAbort abort = 92611376;</code>
     * @param \Google\Cloud\Compute\V1\HttpFaultAbort $var
     * @return $this
     */
    public function setAbort($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\HttpFaultAbort::class);
        $this->abort = $var;

        return $this;
    }

    /**
     * The specification for how client requests are delayed as part of fault injection, before being sent to a backend service.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.HttpFaultDelay delay = 95467907;</code>
     * @return \Google\Cloud\Compute\V1\HttpFaultDelay|null
     */
    public function getDelay()
    {
        return isset($this->delay) ? $this->delay : null;
    }

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

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

    /**
     * The specification for how client requests are delayed as part of fault injection, before being sent to a backend service.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.HttpFaultDelay delay = 95467907;</code>
     * @param \Google\Cloud\Compute\V1\HttpFaultDelay $var
     * @return $this
     */
    public function setDelay($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\HttpFaultDelay::class);
        $this->delay = $var;

        return $this;
    }

}

