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

namespace Google\Cloud\NetworkManagement\V1\AbortInfo;

use UnexpectedValueException;

/**
 * Abort cause types:
 *
 * Protobuf type <code>google.cloud.networkmanagement.v1.AbortInfo.Cause</code>
 */
class Cause
{
    /**
     * Cause is unspecified.
     *
     * Generated from protobuf enum <code>CAUSE_UNSPECIFIED = 0;</code>
     */
    const CAUSE_UNSPECIFIED = 0;
    /**
     * Aborted due to unknown network.
     * The reachability analysis cannot proceed because the user does not have
     * access to the host project's network configurations, including firewall
     * rules and routes. This happens when the project is a service project and
     * the endpoints being traced are in the host project's network.
     *
     * Generated from protobuf enum <code>UNKNOWN_NETWORK = 1;</code>
     */
    const UNKNOWN_NETWORK = 1;
    /**
     * Aborted because the IP address(es) are unknown.
     *
     * Generated from protobuf enum <code>UNKNOWN_IP = 2;</code>
     */
    const UNKNOWN_IP = 2;
    /**
     * Aborted because no project information can be derived from the test
     * input.
     *
     * Generated from protobuf enum <code>UNKNOWN_PROJECT = 3;</code>
     */
    const UNKNOWN_PROJECT = 3;
    /**
     * Aborted because the user lacks the permission to access all or part of
     * the network configurations required to run the test.
     *
     * Generated from protobuf enum <code>PERMISSION_DENIED = 4;</code>
     */
    const PERMISSION_DENIED = 4;
    /**
     * Aborted because no valid source endpoint is derived from the input test
     * request.
     *
     * Generated from protobuf enum <code>NO_SOURCE_LOCATION = 5;</code>
     */
    const NO_SOURCE_LOCATION = 5;
    /**
     * Aborted because the source and/or destination endpoint specified in
     * the test are invalid. The possible reasons that an endpoint is
     * invalid include: malformed IP address; nonexistent instance or
     * network URI; IP address not in the range of specified network URI; and
     * instance not owning the network interface in the specified network.
     *
     * Generated from protobuf enum <code>INVALID_ARGUMENT = 6;</code>
     */
    const INVALID_ARGUMENT = 6;
    /**
     * Aborted because traffic is sent from a public IP to an instance without
     * an external IP.
     *
     * Generated from protobuf enum <code>NO_EXTERNAL_IP = 7;</code>
     */
    const NO_EXTERNAL_IP = 7;
    /**
     * Aborted because none of the traces matches destination information
     * specified in the input test request.
     *
     * Generated from protobuf enum <code>UNINTENDED_DESTINATION = 8;</code>
     */
    const UNINTENDED_DESTINATION = 8;
    /**
     * Aborted because the number of steps in the trace exceeding a certain
     * limit which may be caused by routing loop.
     *
     * Generated from protobuf enum <code>TRACE_TOO_LONG = 9;</code>
     */
    const TRACE_TOO_LONG = 9;
    /**
     * Aborted due to internal server error.
     *
     * Generated from protobuf enum <code>INTERNAL_ERROR = 10;</code>
     */
    const INTERNAL_ERROR = 10;
    /**
     * Aborted because the source endpoint could not be found.
     *
     * Generated from protobuf enum <code>SOURCE_ENDPOINT_NOT_FOUND = 11;</code>
     */
    const SOURCE_ENDPOINT_NOT_FOUND = 11;
    /**
     * Aborted because the source network does not match the source endpoint.
     *
     * Generated from protobuf enum <code>MISMATCHED_SOURCE_NETWORK = 12;</code>
     */
    const MISMATCHED_SOURCE_NETWORK = 12;
    /**
     * Aborted because the destination endpoint could not be found.
     *
     * Generated from protobuf enum <code>DESTINATION_ENDPOINT_NOT_FOUND = 13;</code>
     */
    const DESTINATION_ENDPOINT_NOT_FOUND = 13;
    /**
     * Aborted because the destination network does not match the destination
     * endpoint.
     *
     * Generated from protobuf enum <code>MISMATCHED_DESTINATION_NETWORK = 14;</code>
     */
    const MISMATCHED_DESTINATION_NETWORK = 14;
    /**
     * Aborted because the test scenario is not supported.
     *
     * Generated from protobuf enum <code>UNSUPPORTED = 15;</code>
     */
    const UNSUPPORTED = 15;

    private static $valueToName = [
        self::CAUSE_UNSPECIFIED => 'CAUSE_UNSPECIFIED',
        self::UNKNOWN_NETWORK => 'UNKNOWN_NETWORK',
        self::UNKNOWN_IP => 'UNKNOWN_IP',
        self::UNKNOWN_PROJECT => 'UNKNOWN_PROJECT',
        self::PERMISSION_DENIED => 'PERMISSION_DENIED',
        self::NO_SOURCE_LOCATION => 'NO_SOURCE_LOCATION',
        self::INVALID_ARGUMENT => 'INVALID_ARGUMENT',
        self::NO_EXTERNAL_IP => 'NO_EXTERNAL_IP',
        self::UNINTENDED_DESTINATION => 'UNINTENDED_DESTINATION',
        self::TRACE_TOO_LONG => 'TRACE_TOO_LONG',
        self::INTERNAL_ERROR => 'INTERNAL_ERROR',
        self::SOURCE_ENDPOINT_NOT_FOUND => 'SOURCE_ENDPOINT_NOT_FOUND',
        self::MISMATCHED_SOURCE_NETWORK => 'MISMATCHED_SOURCE_NETWORK',
        self::DESTINATION_ENDPOINT_NOT_FOUND => 'DESTINATION_ENDPOINT_NOT_FOUND',
        self::MISMATCHED_DESTINATION_NETWORK => 'MISMATCHED_DESTINATION_NETWORK',
        self::UNSUPPORTED => 'UNSUPPORTED',
    ];

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

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Cause::class, \Google\Cloud\NetworkManagement\V1\AbortInfo_Cause::class);

