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

namespace Google\Cloud\Config\V1\Deployment;

use UnexpectedValueException;

/**
 * Possible errors that can occur with deployments.
 *
 * Protobuf type <code>google.cloud.config.v1.Deployment.ErrorCode</code>
 */
class ErrorCode
{
    /**
     * No error code was specified.
     *
     * Generated from protobuf enum <code>ERROR_CODE_UNSPECIFIED = 0;</code>
     */
    const ERROR_CODE_UNSPECIFIED = 0;
    /**
     * The revision failed. See Revision for more details.
     *
     * Generated from protobuf enum <code>REVISION_FAILED = 1;</code>
     */
    const REVISION_FAILED = 1;
    /**
     * Cloud Build failed due to a permission issue.
     *
     * Generated from protobuf enum <code>CLOUD_BUILD_PERMISSION_DENIED = 3;</code>
     */
    const CLOUD_BUILD_PERMISSION_DENIED = 3;
    /**
     * Cloud Build job associated with a deployment deletion could not be
     * started.
     *
     * Generated from protobuf enum <code>DELETE_BUILD_API_FAILED = 5;</code>
     */
    const DELETE_BUILD_API_FAILED = 5;
    /**
     * Cloud Build job associated with a deployment deletion was started but
     * failed.
     *
     * Generated from protobuf enum <code>DELETE_BUILD_RUN_FAILED = 6;</code>
     */
    const DELETE_BUILD_RUN_FAILED = 6;
    /**
     * Cloud Storage bucket creation failed due to a permission issue.
     *
     * Generated from protobuf enum <code>BUCKET_CREATION_PERMISSION_DENIED = 7;</code>
     */
    const BUCKET_CREATION_PERMISSION_DENIED = 7;
    /**
     * Cloud Storage bucket creation failed due to an issue unrelated to
     * permissions.
     *
     * Generated from protobuf enum <code>BUCKET_CREATION_FAILED = 8;</code>
     */
    const BUCKET_CREATION_FAILED = 8;
    /**
     * Failed to import values from an external source.
     *
     * Generated from protobuf enum <code>EXTERNAL_VALUE_SOURCE_IMPORT_FAILED = 10;</code>
     */
    const EXTERNAL_VALUE_SOURCE_IMPORT_FAILED = 10;

    private static $valueToName = [
        self::ERROR_CODE_UNSPECIFIED => 'ERROR_CODE_UNSPECIFIED',
        self::REVISION_FAILED => 'REVISION_FAILED',
        self::CLOUD_BUILD_PERMISSION_DENIED => 'CLOUD_BUILD_PERMISSION_DENIED',
        self::DELETE_BUILD_API_FAILED => 'DELETE_BUILD_API_FAILED',
        self::DELETE_BUILD_RUN_FAILED => 'DELETE_BUILD_RUN_FAILED',
        self::BUCKET_CREATION_PERMISSION_DENIED => 'BUCKET_CREATION_PERMISSION_DENIED',
        self::BUCKET_CREATION_FAILED => 'BUCKET_CREATION_FAILED',
        self::EXTERNAL_VALUE_SOURCE_IMPORT_FAILED => 'EXTERNAL_VALUE_SOURCE_IMPORT_FAILED',
    ];

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


