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

namespace Google\Cloud\Memorystore\V1;

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

/**
 * User created Psc connection configuration.
 *
 * Generated from protobuf message <code>google.cloud.memorystore.v1.PscConnection</code>
 */
class PscConnection extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The PSC connection id of the forwarding rule connected to the
     * service attachment.
     *
     * Generated from protobuf field <code>string psc_connection_id = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $psc_connection_id = '';
    /**
     * Required. The IP allocated on the consumer network for the PSC forwarding
     * rule.
     *
     * Generated from protobuf field <code>string ip_address = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_info) = {</code>
     */
    protected $ip_address = '';
    /**
     * Required. The URI of the consumer side forwarding rule.
     * Format:
     * projects/{project}/regions/{region}/forwardingRules/{forwarding_rule}
     *
     * Generated from protobuf field <code>string forwarding_rule = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     */
    protected $forwarding_rule = '';
    /**
     * Output only. The consumer project_id where the forwarding rule is created
     * from.
     *
     * Generated from protobuf field <code>string project_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $project_id = '';
    /**
     * Required. The consumer network where the IP address resides, in the form of
     * projects/{project_id}/global/networks/{network_id}.
     *
     * Generated from protobuf field <code>string network = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     */
    protected $network = '';
    /**
     * Required. The service attachment which is the target of the PSC connection,
     * in the form of
     * projects/{project-id}/regions/{region}/serviceAttachments/{service-attachment-id}.
     *
     * Generated from protobuf field <code>string service_attachment = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     */
    protected $service_attachment = '';
    /**
     * Output only. The status of the PSC connection: whether a connection exists
     * and ACTIVE or it no longer exists. Please note that this value is updated
     * periodically. Please use Private Service Connect APIs for the latest
     * status.
     *
     * Generated from protobuf field <code>.google.cloud.memorystore.v1.PscConnectionStatus psc_connection_status = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $psc_connection_status = 0;
    /**
     * Output only. Type of the PSC connection.
     *
     * Generated from protobuf field <code>.google.cloud.memorystore.v1.ConnectionType connection_type = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $connection_type = 0;
    protected $ports;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $port
     *           Optional. port will only be set for Primary/Reader or Discovery endpoint.
     *     @type string $psc_connection_id
     *           Required. The PSC connection id of the forwarding rule connected to the
     *           service attachment.
     *     @type string $ip_address
     *           Required. The IP allocated on the consumer network for the PSC forwarding
     *           rule.
     *     @type string $forwarding_rule
     *           Required. The URI of the consumer side forwarding rule.
     *           Format:
     *           projects/{project}/regions/{region}/forwardingRules/{forwarding_rule}
     *     @type string $project_id
     *           Output only. The consumer project_id where the forwarding rule is created
     *           from.
     *     @type string $network
     *           Required. The consumer network where the IP address resides, in the form of
     *           projects/{project_id}/global/networks/{network_id}.
     *     @type string $service_attachment
     *           Required. The service attachment which is the target of the PSC connection,
     *           in the form of
     *           projects/{project-id}/regions/{region}/serviceAttachments/{service-attachment-id}.
     *     @type int $psc_connection_status
     *           Output only. The status of the PSC connection: whether a connection exists
     *           and ACTIVE or it no longer exists. Please note that this value is updated
     *           periodically. Please use Private Service Connect APIs for the latest
     *           status.
     *     @type int $connection_type
     *           Output only. Type of the PSC connection.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Memorystore\V1\Memorystore::initOnce();
        parent::__construct($data);
    }

    /**
     * Optional. port will only be set for Primary/Reader or Discovery endpoint.
     *
     * Generated from protobuf field <code>int32 port = 9 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return int
     */
    public function getPort()
    {
        return $this->readOneof(9);
    }

    public function hasPort()
    {
        return $this->hasOneof(9);
    }

    /**
     * Optional. port will only be set for Primary/Reader or Discovery endpoint.
     *
     * Generated from protobuf field <code>int32 port = 9 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param int $var
     * @return $this
     */
    public function setPort($var)
    {
        GPBUtil::checkInt32($var);
        $this->writeOneof(9, $var);

        return $this;
    }

    /**
     * Required. The PSC connection id of the forwarding rule connected to the
     * service attachment.
     *
     * Generated from protobuf field <code>string psc_connection_id = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getPscConnectionId()
    {
        return $this->psc_connection_id;
    }

    /**
     * Required. The PSC connection id of the forwarding rule connected to the
     * service attachment.
     *
     * Generated from protobuf field <code>string psc_connection_id = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setPscConnectionId($var)
    {
        GPBUtil::checkString($var, True);
        $this->psc_connection_id = $var;

        return $this;
    }

    /**
     * Required. The IP allocated on the consumer network for the PSC forwarding
     * rule.
     *
     * Generated from protobuf field <code>string ip_address = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_info) = {</code>
     * @return string
     */
    public function getIpAddress()
    {
        return $this->ip_address;
    }

    /**
     * Required. The IP allocated on the consumer network for the PSC forwarding
     * rule.
     *
     * Generated from protobuf field <code>string ip_address = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_info) = {</code>
     * @param string $var
     * @return $this
     */
    public function setIpAddress($var)
    {
        GPBUtil::checkString($var, True);
        $this->ip_address = $var;

        return $this;
    }

    /**
     * Required. The URI of the consumer side forwarding rule.
     * Format:
     * projects/{project}/regions/{region}/forwardingRules/{forwarding_rule}
     *
     * Generated from protobuf field <code>string forwarding_rule = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @return string
     */
    public function getForwardingRule()
    {
        return $this->forwarding_rule;
    }

    /**
     * Required. The URI of the consumer side forwarding rule.
     * Format:
     * projects/{project}/regions/{region}/forwardingRules/{forwarding_rule}
     *
     * Generated from protobuf field <code>string forwarding_rule = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @param string $var
     * @return $this
     */
    public function setForwardingRule($var)
    {
        GPBUtil::checkString($var, True);
        $this->forwarding_rule = $var;

        return $this;
    }

    /**
     * Output only. The consumer project_id where the forwarding rule is created
     * from.
     *
     * Generated from protobuf field <code>string project_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getProjectId()
    {
        return $this->project_id;
    }

    /**
     * Output only. The consumer project_id where the forwarding rule is created
     * from.
     *
     * Generated from protobuf field <code>string project_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setProjectId($var)
    {
        GPBUtil::checkString($var, True);
        $this->project_id = $var;

        return $this;
    }

    /**
     * Required. The consumer network where the IP address resides, in the form of
     * projects/{project_id}/global/networks/{network_id}.
     *
     * Generated from protobuf field <code>string network = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @return string
     */
    public function getNetwork()
    {
        return $this->network;
    }

    /**
     * Required. The consumer network where the IP address resides, in the form of
     * projects/{project_id}/global/networks/{network_id}.
     *
     * Generated from protobuf field <code>string network = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @param string $var
     * @return $this
     */
    public function setNetwork($var)
    {
        GPBUtil::checkString($var, True);
        $this->network = $var;

        return $this;
    }

    /**
     * Required. The service attachment which is the target of the PSC connection,
     * in the form of
     * projects/{project-id}/regions/{region}/serviceAttachments/{service-attachment-id}.
     *
     * Generated from protobuf field <code>string service_attachment = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @return string
     */
    public function getServiceAttachment()
    {
        return $this->service_attachment;
    }

    /**
     * Required. The service attachment which is the target of the PSC connection,
     * in the form of
     * projects/{project-id}/regions/{region}/serviceAttachments/{service-attachment-id}.
     *
     * Generated from protobuf field <code>string service_attachment = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @param string $var
     * @return $this
     */
    public function setServiceAttachment($var)
    {
        GPBUtil::checkString($var, True);
        $this->service_attachment = $var;

        return $this;
    }

    /**
     * Output only. The status of the PSC connection: whether a connection exists
     * and ACTIVE or it no longer exists. Please note that this value is updated
     * periodically. Please use Private Service Connect APIs for the latest
     * status.
     *
     * Generated from protobuf field <code>.google.cloud.memorystore.v1.PscConnectionStatus psc_connection_status = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return int
     */
    public function getPscConnectionStatus()
    {
        return $this->psc_connection_status;
    }

    /**
     * Output only. The status of the PSC connection: whether a connection exists
     * and ACTIVE or it no longer exists. Please note that this value is updated
     * periodically. Please use Private Service Connect APIs for the latest
     * status.
     *
     * Generated from protobuf field <code>.google.cloud.memorystore.v1.PscConnectionStatus psc_connection_status = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param int $var
     * @return $this
     */
    public function setPscConnectionStatus($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Memorystore\V1\PscConnectionStatus::class);
        $this->psc_connection_status = $var;

        return $this;
    }

    /**
     * Output only. Type of the PSC connection.
     *
     * Generated from protobuf field <code>.google.cloud.memorystore.v1.ConnectionType connection_type = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return int
     */
    public function getConnectionType()
    {
        return $this->connection_type;
    }

    /**
     * Output only. Type of the PSC connection.
     *
     * Generated from protobuf field <code>.google.cloud.memorystore.v1.ConnectionType connection_type = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param int $var
     * @return $this
     */
    public function setConnectionType($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Memorystore\V1\ConnectionType::class);
        $this->connection_type = $var;

        return $this;
    }

    /**
     * @return string
     */
    public function getPorts()
    {
        return $this->whichOneof("ports");
    }

}

