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

namespace Google\Cloud\NetworkConnectivity\V1\ServiceConnectionPolicy;

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

/**
 * Information about a specific Private Service Connect connection.
 *
 * Generated from protobuf message <code>google.cloud.networkconnectivity.v1.ServiceConnectionPolicy.PscConnection</code>
 */
class PscConnection extends \Google\Protobuf\Internal\Message
{
    /**
     * State of the PSC Connection
     *
     * Generated from protobuf field <code>.google.cloud.networkconnectivity.v1.ServiceConnectionPolicy.State state = 1;</code>
     */
    protected $state = 0;
    /**
     * The resource reference of the PSC Forwarding Rule within the consumer
     * VPC.
     *
     * Generated from protobuf field <code>string consumer_forwarding_rule = 2;</code>
     */
    protected $consumer_forwarding_rule = '';
    /**
     * The resource reference of the consumer address.
     *
     * Generated from protobuf field <code>string consumer_address = 3;</code>
     */
    protected $consumer_address = '';
    /**
     * The error type indicates whether the error is consumer facing, producer
     * facing or system internal.
     *
     * Generated from protobuf field <code>.google.cloud.networkconnectivity.v1.ConnectionErrorType error_type = 4 [deprecated = true];</code>
     * @deprecated
     */
    protected $error_type = 0;
    /**
     * The most recent error during operating this connection.
     * Deprecated, please use error_info instead.
     *
     * Generated from protobuf field <code>.google.rpc.Status error = 5 [deprecated = true];</code>
     * @deprecated
     */
    protected $error = null;
    /**
     * The last Compute Engine operation to setup PSC connection.
     *
     * Generated from protobuf field <code>string gce_operation = 6;</code>
     */
    protected $gce_operation = '';
    /**
     * The project where the PSC connection is created.
     *
     * Generated from protobuf field <code>string consumer_target_project = 7;</code>
     */
    protected $consumer_target_project = '';
    /**
     * The PSC connection id of the PSC forwarding rule.
     *
     * Generated from protobuf field <code>string psc_connection_id = 8;</code>
     */
    protected $psc_connection_id = '';
    /**
     * Output only. The error info for the latest error during operating this
     * connection.
     *
     * Generated from protobuf field <code>.google.rpc.ErrorInfo error_info = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $error_info = null;
    /**
     * Output only. The URI of the subnetwork selected to allocate IP address
     * for this connection.
     *
     * Generated from protobuf field <code>string selected_subnetwork = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $selected_subnetwork = '';
    /**
     * Immutable. Deprecated. Use producer_instance_metadata instead.
     * An immutable identifier for the producer instance.
     *
     * Generated from protobuf field <code>string producer_instance_id = 11 [deprecated = true, (.google.api.field_behavior) = IMMUTABLE];</code>
     * @deprecated
     */
    protected $producer_instance_id = '';
    /**
     * Immutable. An immutable map for the producer instance metadata.
     *
     * Generated from protobuf field <code>map<string, string> producer_instance_metadata = 12 [(.google.api.field_behavior) = IMMUTABLE];</code>
     */
    private $producer_instance_metadata;
    /**
     * Output only. [Output only] The service class associated with this PSC
     * Connection. The value is derived from the SCPolicy and matches the
     * service class name provided by the customer.
     *
     * Generated from protobuf field <code>string service_class = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $service_class = '';
    /**
     * The requested IP version for the PSC connection.
     *
     * Generated from protobuf field <code>optional .google.cloud.networkconnectivity.v1.IPVersion ip_version = 14;</code>
     */
    protected $ip_version = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $state
     *           State of the PSC Connection
     *     @type string $consumer_forwarding_rule
     *           The resource reference of the PSC Forwarding Rule within the consumer
     *           VPC.
     *     @type string $consumer_address
     *           The resource reference of the consumer address.
     *     @type int $error_type
     *           The error type indicates whether the error is consumer facing, producer
     *           facing or system internal.
     *     @type \Google\Rpc\Status $error
     *           The most recent error during operating this connection.
     *           Deprecated, please use error_info instead.
     *     @type string $gce_operation
     *           The last Compute Engine operation to setup PSC connection.
     *     @type string $consumer_target_project
     *           The project where the PSC connection is created.
     *     @type string $psc_connection_id
     *           The PSC connection id of the PSC forwarding rule.
     *     @type \Google\Rpc\ErrorInfo $error_info
     *           Output only. The error info for the latest error during operating this
     *           connection.
     *     @type string $selected_subnetwork
     *           Output only. The URI of the subnetwork selected to allocate IP address
     *           for this connection.
     *     @type string $producer_instance_id
     *           Immutable. Deprecated. Use producer_instance_metadata instead.
     *           An immutable identifier for the producer instance.
     *     @type array|\Google\Protobuf\Internal\MapField $producer_instance_metadata
     *           Immutable. An immutable map for the producer instance metadata.
     *     @type string $service_class
     *           Output only. [Output only] The service class associated with this PSC
     *           Connection. The value is derived from the SCPolicy and matches the
     *           service class name provided by the customer.
     *     @type int $ip_version
     *           The requested IP version for the PSC connection.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Networkconnectivity\V1\CrossNetworkAutomation::initOnce();
        parent::__construct($data);
    }

    /**
     * State of the PSC Connection
     *
     * Generated from protobuf field <code>.google.cloud.networkconnectivity.v1.ServiceConnectionPolicy.State state = 1;</code>
     * @return int
     */
    public function getState()
    {
        return $this->state;
    }

    /**
     * State of the PSC Connection
     *
     * Generated from protobuf field <code>.google.cloud.networkconnectivity.v1.ServiceConnectionPolicy.State state = 1;</code>
     * @param int $var
     * @return $this
     */
    public function setState($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\NetworkConnectivity\V1\ServiceConnectionPolicy\State::class);
        $this->state = $var;

        return $this;
    }

    /**
     * The resource reference of the PSC Forwarding Rule within the consumer
     * VPC.
     *
     * Generated from protobuf field <code>string consumer_forwarding_rule = 2;</code>
     * @return string
     */
    public function getConsumerForwardingRule()
    {
        return $this->consumer_forwarding_rule;
    }

    /**
     * The resource reference of the PSC Forwarding Rule within the consumer
     * VPC.
     *
     * Generated from protobuf field <code>string consumer_forwarding_rule = 2;</code>
     * @param string $var
     * @return $this
     */
    public function setConsumerForwardingRule($var)
    {
        GPBUtil::checkString($var, True);
        $this->consumer_forwarding_rule = $var;

        return $this;
    }

    /**
     * The resource reference of the consumer address.
     *
     * Generated from protobuf field <code>string consumer_address = 3;</code>
     * @return string
     */
    public function getConsumerAddress()
    {
        return $this->consumer_address;
    }

    /**
     * The resource reference of the consumer address.
     *
     * Generated from protobuf field <code>string consumer_address = 3;</code>
     * @param string $var
     * @return $this
     */
    public function setConsumerAddress($var)
    {
        GPBUtil::checkString($var, True);
        $this->consumer_address = $var;

        return $this;
    }

    /**
     * The error type indicates whether the error is consumer facing, producer
     * facing or system internal.
     *
     * Generated from protobuf field <code>.google.cloud.networkconnectivity.v1.ConnectionErrorType error_type = 4 [deprecated = true];</code>
     * @return int
     * @deprecated
     */
    public function getErrorType()
    {
        if ($this->error_type !== 0) {
            @trigger_error('error_type is deprecated.', E_USER_DEPRECATED);
        }
        return $this->error_type;
    }

    /**
     * The error type indicates whether the error is consumer facing, producer
     * facing or system internal.
     *
     * Generated from protobuf field <code>.google.cloud.networkconnectivity.v1.ConnectionErrorType error_type = 4 [deprecated = true];</code>
     * @param int $var
     * @return $this
     * @deprecated
     */
    public function setErrorType($var)
    {
        @trigger_error('error_type is deprecated.', E_USER_DEPRECATED);
        GPBUtil::checkEnum($var, \Google\Cloud\NetworkConnectivity\V1\ConnectionErrorType::class);
        $this->error_type = $var;

        return $this;
    }

    /**
     * The most recent error during operating this connection.
     * Deprecated, please use error_info instead.
     *
     * Generated from protobuf field <code>.google.rpc.Status error = 5 [deprecated = true];</code>
     * @return \Google\Rpc\Status|null
     * @deprecated
     */
    public function getError()
    {
        if (isset($this->error)) {
            @trigger_error('error is deprecated.', E_USER_DEPRECATED);
        }
        return $this->error;
    }

    public function hasError()
    {
        if (isset($this->error)) {
            @trigger_error('error is deprecated.', E_USER_DEPRECATED);
        }
        return isset($this->error);
    }

    public function clearError()
    {
        @trigger_error('error is deprecated.', E_USER_DEPRECATED);
        unset($this->error);
    }

    /**
     * The most recent error during operating this connection.
     * Deprecated, please use error_info instead.
     *
     * Generated from protobuf field <code>.google.rpc.Status error = 5 [deprecated = true];</code>
     * @param \Google\Rpc\Status $var
     * @return $this
     * @deprecated
     */
    public function setError($var)
    {
        @trigger_error('error is deprecated.', E_USER_DEPRECATED);
        GPBUtil::checkMessage($var, \Google\Rpc\Status::class);
        $this->error = $var;

        return $this;
    }

    /**
     * The last Compute Engine operation to setup PSC connection.
     *
     * Generated from protobuf field <code>string gce_operation = 6;</code>
     * @return string
     */
    public function getGceOperation()
    {
        return $this->gce_operation;
    }

    /**
     * The last Compute Engine operation to setup PSC connection.
     *
     * Generated from protobuf field <code>string gce_operation = 6;</code>
     * @param string $var
     * @return $this
     */
    public function setGceOperation($var)
    {
        GPBUtil::checkString($var, True);
        $this->gce_operation = $var;

        return $this;
    }

    /**
     * The project where the PSC connection is created.
     *
     * Generated from protobuf field <code>string consumer_target_project = 7;</code>
     * @return string
     */
    public function getConsumerTargetProject()
    {
        return $this->consumer_target_project;
    }

    /**
     * The project where the PSC connection is created.
     *
     * Generated from protobuf field <code>string consumer_target_project = 7;</code>
     * @param string $var
     * @return $this
     */
    public function setConsumerTargetProject($var)
    {
        GPBUtil::checkString($var, True);
        $this->consumer_target_project = $var;

        return $this;
    }

    /**
     * The PSC connection id of the PSC forwarding rule.
     *
     * Generated from protobuf field <code>string psc_connection_id = 8;</code>
     * @return string
     */
    public function getPscConnectionId()
    {
        return $this->psc_connection_id;
    }

    /**
     * The PSC connection id of the PSC forwarding rule.
     *
     * Generated from protobuf field <code>string psc_connection_id = 8;</code>
     * @param string $var
     * @return $this
     */
    public function setPscConnectionId($var)
    {
        GPBUtil::checkString($var, True);
        $this->psc_connection_id = $var;

        return $this;
    }

    /**
     * Output only. The error info for the latest error during operating this
     * connection.
     *
     * Generated from protobuf field <code>.google.rpc.ErrorInfo error_info = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Rpc\ErrorInfo|null
     */
    public function getErrorInfo()
    {
        return $this->error_info;
    }

    public function hasErrorInfo()
    {
        return isset($this->error_info);
    }

    public function clearErrorInfo()
    {
        unset($this->error_info);
    }

    /**
     * Output only. The error info for the latest error during operating this
     * connection.
     *
     * Generated from protobuf field <code>.google.rpc.ErrorInfo error_info = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Rpc\ErrorInfo $var
     * @return $this
     */
    public function setErrorInfo($var)
    {
        GPBUtil::checkMessage($var, \Google\Rpc\ErrorInfo::class);
        $this->error_info = $var;

        return $this;
    }

    /**
     * Output only. The URI of the subnetwork selected to allocate IP address
     * for this connection.
     *
     * Generated from protobuf field <code>string selected_subnetwork = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getSelectedSubnetwork()
    {
        return $this->selected_subnetwork;
    }

    /**
     * Output only. The URI of the subnetwork selected to allocate IP address
     * for this connection.
     *
     * Generated from protobuf field <code>string selected_subnetwork = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setSelectedSubnetwork($var)
    {
        GPBUtil::checkString($var, True);
        $this->selected_subnetwork = $var;

        return $this;
    }

    /**
     * Immutable. Deprecated. Use producer_instance_metadata instead.
     * An immutable identifier for the producer instance.
     *
     * Generated from protobuf field <code>string producer_instance_id = 11 [deprecated = true, (.google.api.field_behavior) = IMMUTABLE];</code>
     * @return string
     * @deprecated
     */
    public function getProducerInstanceId()
    {
        if ($this->producer_instance_id !== '') {
            @trigger_error('producer_instance_id is deprecated.', E_USER_DEPRECATED);
        }
        return $this->producer_instance_id;
    }

    /**
     * Immutable. Deprecated. Use producer_instance_metadata instead.
     * An immutable identifier for the producer instance.
     *
     * Generated from protobuf field <code>string producer_instance_id = 11 [deprecated = true, (.google.api.field_behavior) = IMMUTABLE];</code>
     * @param string $var
     * @return $this
     * @deprecated
     */
    public function setProducerInstanceId($var)
    {
        @trigger_error('producer_instance_id is deprecated.', E_USER_DEPRECATED);
        GPBUtil::checkString($var, True);
        $this->producer_instance_id = $var;

        return $this;
    }

    /**
     * Immutable. An immutable map for the producer instance metadata.
     *
     * Generated from protobuf field <code>map<string, string> producer_instance_metadata = 12 [(.google.api.field_behavior) = IMMUTABLE];</code>
     * @return \Google\Protobuf\Internal\MapField
     */
    public function getProducerInstanceMetadata()
    {
        return $this->producer_instance_metadata;
    }

    /**
     * Immutable. An immutable map for the producer instance metadata.
     *
     * Generated from protobuf field <code>map<string, string> producer_instance_metadata = 12 [(.google.api.field_behavior) = IMMUTABLE];</code>
     * @param array|\Google\Protobuf\Internal\MapField $var
     * @return $this
     */
    public function setProducerInstanceMetadata($var)
    {
        $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
        $this->producer_instance_metadata = $arr;

        return $this;
    }

    /**
     * Output only. [Output only] The service class associated with this PSC
     * Connection. The value is derived from the SCPolicy and matches the
     * service class name provided by the customer.
     *
     * Generated from protobuf field <code>string service_class = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getServiceClass()
    {
        return $this->service_class;
    }

    /**
     * Output only. [Output only] The service class associated with this PSC
     * Connection. The value is derived from the SCPolicy and matches the
     * service class name provided by the customer.
     *
     * Generated from protobuf field <code>string service_class = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setServiceClass($var)
    {
        GPBUtil::checkString($var, True);
        $this->service_class = $var;

        return $this;
    }

    /**
     * The requested IP version for the PSC connection.
     *
     * Generated from protobuf field <code>optional .google.cloud.networkconnectivity.v1.IPVersion ip_version = 14;</code>
     * @return int
     */
    public function getIpVersion()
    {
        return isset($this->ip_version) ? $this->ip_version : 0;
    }

    public function hasIpVersion()
    {
        return isset($this->ip_version);
    }

    public function clearIpVersion()
    {
        unset($this->ip_version);
    }

    /**
     * The requested IP version for the PSC connection.
     *
     * Generated from protobuf field <code>optional .google.cloud.networkconnectivity.v1.IPVersion ip_version = 14;</code>
     * @param int $var
     * @return $this
     */
    public function setIpVersion($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\NetworkConnectivity\V1\IPVersion::class);
        $this->ip_version = $var;

        return $this;
    }

}


