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

namespace Google\Cloud\AIPlatform\V1;

use UnexpectedValueException;

/**
 * Represents the failure policy of a pipeline. Currently, the default of a
 * pipeline is that the pipeline will continue to run until no more tasks can be
 * executed, also known as PIPELINE_FAILURE_POLICY_FAIL_SLOW. However, if a
 * pipeline is set to PIPELINE_FAILURE_POLICY_FAIL_FAST, it will stop scheduling
 * any new tasks when a task has failed. Any scheduled tasks will continue to
 * completion.
 *
 * Protobuf type <code>google.cloud.aiplatform.v1.PipelineFailurePolicy</code>
 */
class PipelineFailurePolicy
{
    /**
     * Default value, and follows fail slow behavior.
     *
     * Generated from protobuf enum <code>PIPELINE_FAILURE_POLICY_UNSPECIFIED = 0;</code>
     */
    const PIPELINE_FAILURE_POLICY_UNSPECIFIED = 0;
    /**
     * Indicates that the pipeline should continue to run until all possible
     * tasks have been scheduled and completed.
     *
     * Generated from protobuf enum <code>PIPELINE_FAILURE_POLICY_FAIL_SLOW = 1;</code>
     */
    const PIPELINE_FAILURE_POLICY_FAIL_SLOW = 1;
    /**
     * Indicates that the pipeline should stop scheduling new tasks after a task
     * has failed.
     *
     * Generated from protobuf enum <code>PIPELINE_FAILURE_POLICY_FAIL_FAST = 2;</code>
     */
    const PIPELINE_FAILURE_POLICY_FAIL_FAST = 2;

    private static $valueToName = [
        self::PIPELINE_FAILURE_POLICY_UNSPECIFIED => 'PIPELINE_FAILURE_POLICY_UNSPECIFIED',
        self::PIPELINE_FAILURE_POLICY_FAIL_SLOW => 'PIPELINE_FAILURE_POLICY_FAIL_SLOW',
        self::PIPELINE_FAILURE_POLICY_FAIL_FAST => 'PIPELINE_FAILURE_POLICY_FAIL_FAST',
    ];

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

