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

/**
 * Specification for how requests are aborted as part of fault injection.
 *
 * Generated from protobuf message <code>google.cloud.compute.v1.HttpFaultAbort</code>
 */
class HttpFaultAbort extends \Google\Protobuf\Internal\Message
{
    /**
     * The HTTP status code used to abort the request. The value must be from 200 to 599 inclusive. For gRPC protocol, the gRPC status code is mapped to HTTP status code according to this mapping table. HTTP status 200 is mapped to gRPC status UNKNOWN. Injecting an OK status is currently not supported by Traffic Director.
     *
     * Generated from protobuf field <code>optional uint32 http_status = 468949897;</code>
     */
    private $http_status = null;
    /**
     * The percentage of traffic for connections, operations, or requests that is aborted as part of fault injection. The value must be from 0.0 to 100.0 inclusive.
     *
     * Generated from protobuf field <code>optional double percentage = 151909018;</code>
     */
    private $percentage = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $http_status
     *           The HTTP status code used to abort the request. The value must be from 200 to 599 inclusive. For gRPC protocol, the gRPC status code is mapped to HTTP status code according to this mapping table. HTTP status 200 is mapped to gRPC status UNKNOWN. Injecting an OK status is currently not supported by Traffic Director.
     *     @type float $percentage
     *           The percentage of traffic for connections, operations, or requests that is aborted as part of fault injection. The value must be from 0.0 to 100.0 inclusive.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce();
        parent::__construct($data);
    }

    /**
     * The HTTP status code used to abort the request. The value must be from 200 to 599 inclusive. For gRPC protocol, the gRPC status code is mapped to HTTP status code according to this mapping table. HTTP status 200 is mapped to gRPC status UNKNOWN. Injecting an OK status is currently not supported by Traffic Director.
     *
     * Generated from protobuf field <code>optional uint32 http_status = 468949897;</code>
     * @return int
     */
    public function getHttpStatus()
    {
        return isset($this->http_status) ? $this->http_status : 0;
    }

    public function hasHttpStatus()
    {
        return isset($this->http_status);
    }

    public function clearHttpStatus()
    {
        unset($this->http_status);
    }

    /**
     * The HTTP status code used to abort the request. The value must be from 200 to 599 inclusive. For gRPC protocol, the gRPC status code is mapped to HTTP status code according to this mapping table. HTTP status 200 is mapped to gRPC status UNKNOWN. Injecting an OK status is currently not supported by Traffic Director.
     *
     * Generated from protobuf field <code>optional uint32 http_status = 468949897;</code>
     * @param int $var
     * @return $this
     */
    public function setHttpStatus($var)
    {
        GPBUtil::checkUint32($var);
        $this->http_status = $var;

        return $this;
    }

    /**
     * The percentage of traffic for connections, operations, or requests that is aborted as part of fault injection. The value must be from 0.0 to 100.0 inclusive.
     *
     * Generated from protobuf field <code>optional double percentage = 151909018;</code>
     * @return float
     */
    public function getPercentage()
    {
        return isset($this->percentage) ? $this->percentage : 0.0;
    }

    public function hasPercentage()
    {
        return isset($this->percentage);
    }

    public function clearPercentage()
    {
        unset($this->percentage);
    }

    /**
     * The percentage of traffic for connections, operations, or requests that is aborted as part of fault injection. The value must be from 0.0 to 100.0 inclusive.
     *
     * Generated from protobuf field <code>optional double percentage = 151909018;</code>
     * @param float $var
     * @return $this
     */
    public function setPercentage($var)
    {
        GPBUtil::checkDouble($var);
        $this->percentage = $var;

        return $this;
    }

}

