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

namespace Google\Cloud\GkeBackup\V1\RestoreConfig;

use UnexpectedValueException;

/**
 * Defines the behavior for handling the situation where cluster-scoped
 * resources being restored already exist in the target cluster.
 *
 * Protobuf type <code>google.cloud.gkebackup.v1.RestoreConfig.ClusterResourceConflictPolicy</code>
 */
class ClusterResourceConflictPolicy
{
    /**
     * Unspecified. Only allowed if no cluster-scoped resources will be
     * restored.
     *
     * Generated from protobuf enum <code>CLUSTER_RESOURCE_CONFLICT_POLICY_UNSPECIFIED = 0;</code>
     */
    const CLUSTER_RESOURCE_CONFLICT_POLICY_UNSPECIFIED = 0;
    /**
     * Do not attempt to restore the conflicting resource.
     *
     * Generated from protobuf enum <code>USE_EXISTING_VERSION = 1;</code>
     */
    const USE_EXISTING_VERSION = 1;
    /**
     * Delete the existing version before re-creating it from the Backup.
     * Note that this is a dangerous option which could cause unintentional
     * data loss if used inappropriately - for example, deleting a CRD will
     * cause Kubernetes to delete all CRs of that type.
     *
     * Generated from protobuf enum <code>USE_BACKUP_VERSION = 2;</code>
     */
    const USE_BACKUP_VERSION = 2;

    private static $valueToName = [
        self::CLUSTER_RESOURCE_CONFLICT_POLICY_UNSPECIFIED => 'CLUSTER_RESOURCE_CONFLICT_POLICY_UNSPECIFIED',
        self::USE_EXISTING_VERSION => 'USE_EXISTING_VERSION',
        self::USE_BACKUP_VERSION => 'USE_BACKUP_VERSION',
    ];

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


