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

namespace Google\Cloud\AlloyDb\V1\SslConfig;

use UnexpectedValueException;

/**
 * SSL mode options.
 *
 * Protobuf type <code>google.cloud.alloydb.v1.SslConfig.SslMode</code>
 */
class SslMode
{
    /**
     * SSL mode is not specified. Defaults to ENCRYPTED_ONLY.
     *
     * Generated from protobuf enum <code>SSL_MODE_UNSPECIFIED = 0;</code>
     */
    const SSL_MODE_UNSPECIFIED = 0;
    /**
     * SSL connections are optional. CA verification not enforced.
     *
     * Generated from protobuf enum <code>SSL_MODE_ALLOW = 1 [deprecated = true];</code>
     */
    const SSL_MODE_ALLOW = 1;
    /**
     * SSL connections are required. CA verification not enforced.
     * Clients may use locally self-signed certificates (default psql client
     * behavior).
     *
     * Generated from protobuf enum <code>SSL_MODE_REQUIRE = 2 [deprecated = true];</code>
     */
    const SSL_MODE_REQUIRE = 2;
    /**
     * SSL connections are required. CA verification enforced.
     * Clients must have certificates signed by a Cluster CA, for example, using
     * GenerateClientCertificate.
     *
     * Generated from protobuf enum <code>SSL_MODE_VERIFY_CA = 3 [deprecated = true];</code>
     */
    const SSL_MODE_VERIFY_CA = 3;
    /**
     * SSL connections are optional. CA verification not enforced.
     *
     * Generated from protobuf enum <code>ALLOW_UNENCRYPTED_AND_ENCRYPTED = 4;</code>
     */
    const ALLOW_UNENCRYPTED_AND_ENCRYPTED = 4;
    /**
     * SSL connections are required. CA verification not enforced.
     *
     * Generated from protobuf enum <code>ENCRYPTED_ONLY = 5;</code>
     */
    const ENCRYPTED_ONLY = 5;

    private static $valueToName = [
        self::SSL_MODE_UNSPECIFIED => 'SSL_MODE_UNSPECIFIED',
        self::SSL_MODE_ALLOW => 'SSL_MODE_ALLOW',
        self::SSL_MODE_REQUIRE => 'SSL_MODE_REQUIRE',
        self::SSL_MODE_VERIFY_CA => 'SSL_MODE_VERIFY_CA',
        self::ALLOW_UNENCRYPTED_AND_ENCRYPTED => 'ALLOW_UNENCRYPTED_AND_ENCRYPTED',
        self::ENCRYPTED_ONLY => 'ENCRYPTED_ONLY',
    ];

    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);
    }
}


