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

/**
 * Protobuf type <code>google.cloud.sql.v1beta4.SqlIpAddressType</code>
 */
class SqlIpAddressType
{
    /**
     * This is an unknown IP address type.
     *
     * Generated from protobuf enum <code>SQL_IP_ADDRESS_TYPE_UNSPECIFIED = 0;</code>
     */
    const SQL_IP_ADDRESS_TYPE_UNSPECIFIED = 0;
    /**
     * IP address the customer is supposed to connect to. Usually this is the
     * load balancer's IP address
     *
     * Generated from protobuf enum <code>PRIMARY = 1;</code>
     */
    const PRIMARY = 1;
    /**
     * Source IP address of the connection a read replica establishes to its
     * external primary instance. This IP address can be allowlisted by the
     * customer in case it has a firewall that filters incoming connection to its
     * on premises primary instance.
     *
     * Generated from protobuf enum <code>OUTGOING = 2;</code>
     */
    const OUTGOING = 2;
    /**
     * Private IP used when using private IPs and network peering.
     *
     * Generated from protobuf enum <code>PRIVATE = 3;</code>
     */
    const PBPRIVATE = 3;
    /**
     * V1 IP of a migrated instance. We want the user to
     * decommission this IP as soon as the migration is complete.
     * Note: V1 instances with V1 ip addresses will be counted as PRIMARY.
     *
     * Generated from protobuf enum <code>MIGRATED_1ST_GEN = 4;</code>
     */
    const MIGRATED_1ST_GEN = 4;

    private static $valueToName = [
        self::SQL_IP_ADDRESS_TYPE_UNSPECIFIED => 'SQL_IP_ADDRESS_TYPE_UNSPECIFIED',
        self::PRIMARY => 'PRIMARY',
        self::OUTGOING => 'OUTGOING',
        self::PBPRIVATE => 'PBPRIVATE',
        self::MIGRATED_1ST_GEN => 'MIGRATED_1ST_GEN',
    ];

    public static function name($value)
    {
        if (!isset(self::$valueToName[$value])) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no name defined for value %s', __CLASS__, $value));
        }
        return self::$valueToName[$value];
    }


    public static function value($name)
    {
        $const = __CLASS__ . '::' . strtoupper($name);
        if (!defined($const)) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }
}

