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

/**
 *
 * Generated from protobuf message <code>google.cloud.compute.v1.GRPCHealthCheck</code>
 */
class GRPCHealthCheck extends \Google\Protobuf\Internal\Message
{
    /**
     * The gRPC service name for the health check. This field is optional. The value of grpc_service_name has the following meanings by convention:
     * - Empty service_name means the overall status of all services at the backend.
     * - Non-empty service_name means the health of that gRPC service, as defined by the owner of the service.
     * The grpc_service_name can only be ASCII.
     *
     * Generated from protobuf field <code>string grpc_service_name = 136533078;</code>
     */
    private $grpc_service_name = null;
    /**
     * The port number for the health check request. Must be specified if port_name and port_specification are not set or if port_specification is USE_FIXED_PORT. Valid values are 1 through 65535.
     *
     * Generated from protobuf field <code>int32 port = 3446913;</code>
     */
    private $port = null;
    /**
     * Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence. The port_name should conform to RFC1035.
     *
     * Generated from protobuf field <code>string port_name = 41534345;</code>
     */
    private $port_name = null;
    /**
     * Specifies how port is selected for health checking, can be one of following values:
     * USE_FIXED_PORT: The port number in port is used for health checking.
     * USE_NAMED_PORT: The portName is used for health checking.
     * USE_SERVING_PORT: For NetworkEndpointGroup, the port specified for each network endpoint is used for health checking. For other backends, the port or named port specified in the Backend Service is used for health checking.
     * If not specified, gRPC health check follows behavior specified in port and portName fields.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.GRPCHealthCheck.PortSpecification port_specification = 51590597;</code>
     */
    private $port_specification = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $grpc_service_name
     *           The gRPC service name for the health check. This field is optional. The value of grpc_service_name has the following meanings by convention:
     *           - Empty service_name means the overall status of all services at the backend.
     *           - Non-empty service_name means the health of that gRPC service, as defined by the owner of the service.
     *           The grpc_service_name can only be ASCII.
     *     @type int $port
     *           The port number for the health check request. Must be specified if port_name and port_specification are not set or if port_specification is USE_FIXED_PORT. Valid values are 1 through 65535.
     *     @type string $port_name
     *           Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence. The port_name should conform to RFC1035.
     *     @type int $port_specification
     *           Specifies how port is selected for health checking, can be one of following values:
     *           USE_FIXED_PORT: The port number in port is used for health checking.
     *           USE_NAMED_PORT: The portName is used for health checking.
     *           USE_SERVING_PORT: For NetworkEndpointGroup, the port specified for each network endpoint is used for health checking. For other backends, the port or named port specified in the Backend Service is used for health checking.
     *           If not specified, gRPC health check follows behavior specified in port and portName fields.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce();
        parent::__construct($data);
    }

    /**
     * The gRPC service name for the health check. This field is optional. The value of grpc_service_name has the following meanings by convention:
     * - Empty service_name means the overall status of all services at the backend.
     * - Non-empty service_name means the health of that gRPC service, as defined by the owner of the service.
     * The grpc_service_name can only be ASCII.
     *
     * Generated from protobuf field <code>string grpc_service_name = 136533078;</code>
     * @return string
     */
    public function getGrpcServiceName()
    {
        return isset($this->grpc_service_name) ? $this->grpc_service_name : '';
    }

    public function hasGrpcServiceName()
    {
        return isset($this->grpc_service_name);
    }

    public function clearGrpcServiceName()
    {
        unset($this->grpc_service_name);
    }

    /**
     * The gRPC service name for the health check. This field is optional. The value of grpc_service_name has the following meanings by convention:
     * - Empty service_name means the overall status of all services at the backend.
     * - Non-empty service_name means the health of that gRPC service, as defined by the owner of the service.
     * The grpc_service_name can only be ASCII.
     *
     * Generated from protobuf field <code>string grpc_service_name = 136533078;</code>
     * @param string $var
     * @return $this
     */
    public function setGrpcServiceName($var)
    {
        GPBUtil::checkString($var, True);
        $this->grpc_service_name = $var;

        return $this;
    }

    /**
     * The port number for the health check request. Must be specified if port_name and port_specification are not set or if port_specification is USE_FIXED_PORT. Valid values are 1 through 65535.
     *
     * Generated from protobuf field <code>int32 port = 3446913;</code>
     * @return int
     */
    public function getPort()
    {
        return isset($this->port) ? $this->port : 0;
    }

    public function hasPort()
    {
        return isset($this->port);
    }

    public function clearPort()
    {
        unset($this->port);
    }

    /**
     * The port number for the health check request. Must be specified if port_name and port_specification are not set or if port_specification is USE_FIXED_PORT. Valid values are 1 through 65535.
     *
     * Generated from protobuf field <code>int32 port = 3446913;</code>
     * @param int $var
     * @return $this
     */
    public function setPort($var)
    {
        GPBUtil::checkInt32($var);
        $this->port = $var;

        return $this;
    }

    /**
     * Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence. The port_name should conform to RFC1035.
     *
     * Generated from protobuf field <code>string port_name = 41534345;</code>
     * @return string
     */
    public function getPortName()
    {
        return isset($this->port_name) ? $this->port_name : '';
    }

    public function hasPortName()
    {
        return isset($this->port_name);
    }

    public function clearPortName()
    {
        unset($this->port_name);
    }

    /**
     * Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence. The port_name should conform to RFC1035.
     *
     * Generated from protobuf field <code>string port_name = 41534345;</code>
     * @param string $var
     * @return $this
     */
    public function setPortName($var)
    {
        GPBUtil::checkString($var, True);
        $this->port_name = $var;

        return $this;
    }

    /**
     * Specifies how port is selected for health checking, can be one of following values:
     * USE_FIXED_PORT: The port number in port is used for health checking.
     * USE_NAMED_PORT: The portName is used for health checking.
     * USE_SERVING_PORT: For NetworkEndpointGroup, the port specified for each network endpoint is used for health checking. For other backends, the port or named port specified in the Backend Service is used for health checking.
     * If not specified, gRPC health check follows behavior specified in port and portName fields.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.GRPCHealthCheck.PortSpecification port_specification = 51590597;</code>
     * @return int
     */
    public function getPortSpecification()
    {
        return isset($this->port_specification) ? $this->port_specification : 0;
    }

    public function hasPortSpecification()
    {
        return isset($this->port_specification);
    }

    public function clearPortSpecification()
    {
        unset($this->port_specification);
    }

    /**
     * Specifies how port is selected for health checking, can be one of following values:
     * USE_FIXED_PORT: The port number in port is used for health checking.
     * USE_NAMED_PORT: The portName is used for health checking.
     * USE_SERVING_PORT: For NetworkEndpointGroup, the port specified for each network endpoint is used for health checking. For other backends, the port or named port specified in the Backend Service is used for health checking.
     * If not specified, gRPC health check follows behavior specified in port and portName fields.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.GRPCHealthCheck.PortSpecification port_specification = 51590597;</code>
     * @param int $var
     * @return $this
     */
    public function setPortSpecification($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Compute\V1\GRPCHealthCheck\PortSpecification::class);
        $this->port_specification = $var;

        return $this;
    }

}

