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

namespace Google\Cloud\Sql\V1beta4;

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

/**
 * Database instance IP Mapping.
 *
 * Generated from protobuf message <code>google.cloud.sql.v1beta4.IpMapping</code>
 */
class IpMapping extends \Google\Protobuf\Internal\Message
{
    /**
     * The type of this IP address. A `PRIMARY` address is a public address that
     * can accept incoming connections. A `PRIVATE` address is a private address
     * that can accept incoming connections. An `OUTGOING` address is the source
     * address of connections originating from the instance, if supported.
     *
     * Generated from protobuf field <code>.google.cloud.sql.v1beta4.SqlIpAddressType type = 1;</code>
     */
    private $type = 0;
    /**
     * The IP address assigned.
     *
     * Generated from protobuf field <code>string ip_address = 2;</code>
     */
    private $ip_address = '';
    /**
     * The due time for this IP to be retired in
     * [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example
     * `2012-11-15T16:19:00.094Z`. This field is only available when
     * the IP is scheduled to be retired.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp time_to_retire = 3;</code>
     */
    private $time_to_retire = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $type
     *           The type of this IP address. A `PRIMARY` address is a public address that
     *           can accept incoming connections. A `PRIVATE` address is a private address
     *           that can accept incoming connections. An `OUTGOING` address is the source
     *           address of connections originating from the instance, if supported.
     *     @type string $ip_address
     *           The IP address assigned.
     *     @type \Google\Protobuf\Timestamp $time_to_retire
     *           The due time for this IP to be retired in
     *           [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example
     *           `2012-11-15T16:19:00.094Z`. This field is only available when
     *           the IP is scheduled to be retired.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Sql\V1Beta4\CloudSqlResources::initOnce();
        parent::__construct($data);
    }

    /**
     * The type of this IP address. A `PRIMARY` address is a public address that
     * can accept incoming connections. A `PRIVATE` address is a private address
     * that can accept incoming connections. An `OUTGOING` address is the source
     * address of connections originating from the instance, if supported.
     *
     * Generated from protobuf field <code>.google.cloud.sql.v1beta4.SqlIpAddressType type = 1;</code>
     * @return int
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * The type of this IP address. A `PRIMARY` address is a public address that
     * can accept incoming connections. A `PRIVATE` address is a private address
     * that can accept incoming connections. An `OUTGOING` address is the source
     * address of connections originating from the instance, if supported.
     *
     * Generated from protobuf field <code>.google.cloud.sql.v1beta4.SqlIpAddressType type = 1;</code>
     * @param int $var
     * @return $this
     */
    public function setType($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Sql\V1beta4\SqlIpAddressType::class);
        $this->type = $var;

        return $this;
    }

    /**
     * The IP address assigned.
     *
     * Generated from protobuf field <code>string ip_address = 2;</code>
     * @return string
     */
    public function getIpAddress()
    {
        return $this->ip_address;
    }

    /**
     * The IP address assigned.
     *
     * Generated from protobuf field <code>string ip_address = 2;</code>
     * @param string $var
     * @return $this
     */
    public function setIpAddress($var)
    {
        GPBUtil::checkString($var, True);
        $this->ip_address = $var;

        return $this;
    }

    /**
     * The due time for this IP to be retired in
     * [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example
     * `2012-11-15T16:19:00.094Z`. This field is only available when
     * the IP is scheduled to be retired.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp time_to_retire = 3;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getTimeToRetire()
    {
        return $this->time_to_retire;
    }

    public function hasTimeToRetire()
    {
        return isset($this->time_to_retire);
    }

    public function clearTimeToRetire()
    {
        unset($this->time_to_retire);
    }

    /**
     * The due time for this IP to be retired in
     * [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example
     * `2012-11-15T16:19:00.094Z`. This field is only available when
     * the IP is scheduled to be retired.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp time_to_retire = 3;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setTimeToRetire($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->time_to_retire = $var;

        return $this;
    }

}

