# frozen_string_literal: true

# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Auto-generated by gapic-generator-ruby. DO NOT EDIT!


module Google
  module Cloud
    module NetworkManagement
      module V1
        # A Connectivity Test for a network reachability analysis.
        # @!attribute [rw] name
        #   @return [::String]
        #     Required. Unique name of the resource using the form:
        #         `projects/{project_id}/locations/global/connectivityTests/{test_id}`
        # @!attribute [rw] description
        #   @return [::String]
        #     The user-supplied description of the Connectivity Test.
        #     Maximum of 512 characters.
        # @!attribute [rw] source
        #   @return [::Google::Cloud::NetworkManagement::V1::Endpoint]
        #     Required. Source specification of the Connectivity Test.
        #
        #     You can use a combination of source IP address, virtual machine
        #     (VM) instance, or Compute Engine network to uniquely identify
        #     the source location.
        #
        #     Examples:
        #     If the source IP address is an internal IP address within a Google Cloud
        #     Virtual Private Cloud (VPC) network, then you must also specify the VPC
        #     network. Otherwise, specify the VM instance, which already contains its
        #     internal IP address and VPC network information.
        #
        #     If the source of the test is within an on-premises network, then you must
        #     provide the destination VPC network.
        #
        #     If the source endpoint is a Compute Engine VM instance with multiple
        #     network interfaces, the instance itself is not sufficient to identify the
        #     endpoint. So, you must also specify the source IP address or VPC network.
        #
        #     A reachability analysis proceeds even if the source location is
        #     ambiguous. However, the test result may include endpoints that you don't
        #     intend to test.
        # @!attribute [rw] destination
        #   @return [::Google::Cloud::NetworkManagement::V1::Endpoint]
        #     Required. Destination specification of the Connectivity Test.
        #
        #     You can use a combination of destination IP address, Compute Engine
        #     VM instance, or VPC network to uniquely identify the destination
        #     location.
        #
        #     Even if the destination IP address is not unique, the source IP
        #     location is unique. Usually, the analysis can infer the destination
        #     endpoint from route information.
        #
        #     If the destination you specify is a VM instance and the instance has
        #     multiple network interfaces, then you must also specify either
        #     a destination IP address  or VPC network to identify the destination
        #     interface.
        #
        #     A reachability analysis proceeds even if the destination location is
        #     ambiguous. However, the result can include endpoints that you don't
        #     intend to test.
        # @!attribute [rw] protocol
        #   @return [::String]
        #     IP Protocol of the test. When not provided, "TCP" is assumed.
        # @!attribute [rw] related_projects
        #   @return [::Array<::String>]
        #     Other projects that may be relevant for reachability analysis.
        #     This is applicable to scenarios where a test can cross project boundaries.
        # @!attribute [r] display_name
        #   @return [::String]
        #     Output only. The display name of a Connectivity Test.
        # @!attribute [rw] labels
        #   @return [::Google::Protobuf::Map{::String => ::String}]
        #     Resource labels to represent user-provided metadata.
        # @!attribute [r] create_time
        #   @return [::Google::Protobuf::Timestamp]
        #     Output only. The time the test was created.
        # @!attribute [r] update_time
        #   @return [::Google::Protobuf::Timestamp]
        #     Output only. The time the test's configuration was updated.
        # @!attribute [r] reachability_details
        #   @return [::Google::Cloud::NetworkManagement::V1::ReachabilityDetails]
        #     Output only. The reachability details of this test from the latest run.
        #     The details are updated when creating a new test, updating an
        #     existing test, or triggering a one-time rerun of an existing test.
        class ConnectivityTest
          include ::Google::Protobuf::MessageExts
          extend ::Google::Protobuf::MessageExts::ClassMethods

          # @!attribute [rw] key
          #   @return [::String]
          # @!attribute [rw] value
          #   @return [::String]
          class LabelsEntry
            include ::Google::Protobuf::MessageExts
            extend ::Google::Protobuf::MessageExts::ClassMethods
          end
        end

        # Source or destination of the Connectivity Test.
        # @!attribute [rw] ip_address
        #   @return [::String]
        #     The IP address of the endpoint, which can be an external or internal IP.
        #     An IPv6 address is only allowed when the test's destination is a
        #     [global load balancer VIP](/load-balancing/docs/load-balancing-overview).
        # @!attribute [rw] port
        #   @return [::Integer]
        #     The IP protocol port of the endpoint.
        #     Only applicable when protocol is TCP or UDP.
        # @!attribute [rw] instance
        #   @return [::String]
        #     A Compute Engine instance URI.
        # @!attribute [rw] gke_master_cluster
        #   @return [::String]
        #     A cluster URI for [Google Kubernetes Engine
        #     master](https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-architecture).
        # @!attribute [rw] cloud_sql_instance
        #   @return [::String]
        #     A [Cloud SQL](https://cloud.google.com/sql) instance URI.
        # @!attribute [rw] network
        #   @return [::String]
        #     A Compute Engine network URI.
        # @!attribute [rw] network_type
        #   @return [::Google::Cloud::NetworkManagement::V1::Endpoint::NetworkType]
        #     Type of the network where the endpoint is located.
        #     Applicable only to source endpoint, as destination network type can be
        #     inferred from the source.
        # @!attribute [rw] project_id
        #   @return [::String]
        #     Project ID where the endpoint is located.
        #     The Project ID can be derived from the URI if you provide a VM instance or
        #     network URI.
        #     The following are two cases where you must provide the project ID:
        #     1. Only the IP address is specified, and the IP address is within a Google
        #     Cloud project.
        #     2. When you are using Shared VPC and the IP address that you provide is
        #     from the service project. In this case, the network that the IP address
        #     resides in is defined in the host project.
        class Endpoint
          include ::Google::Protobuf::MessageExts
          extend ::Google::Protobuf::MessageExts::ClassMethods

          # The type definition of an endpoint's network. Use one of the
          # following choices:
          module NetworkType
            # Default type if unspecified.
            NETWORK_TYPE_UNSPECIFIED = 0

            # A network hosted within Google Cloud.
            # To receive more detailed output, specify the URI for the source or
            # destination network.
            GCP_NETWORK = 1

            # A network hosted outside of Google Cloud.
            # This can be an on-premises network, or a network hosted by another cloud
            # provider.
            NON_GCP_NETWORK = 2
          end
        end

        # Results of the configuration analysis from the last run of the test.
        # @!attribute [rw] result
        #   @return [::Google::Cloud::NetworkManagement::V1::ReachabilityDetails::Result]
        #     The overall result of the test's configuration analysis.
        # @!attribute [rw] verify_time
        #   @return [::Google::Protobuf::Timestamp]
        #     The time of the configuration analysis.
        # @!attribute [rw] error
        #   @return [::Google::Rpc::Status]
        #     The details of a failure or a cancellation of reachability analysis.
        # @!attribute [rw] traces
        #   @return [::Array<::Google::Cloud::NetworkManagement::V1::Trace>]
        #     Result may contain a list of traces if a test has multiple possible
        #     paths in the network, such as when destination endpoint is a load balancer
        #     with multiple backends.
        class ReachabilityDetails
          include ::Google::Protobuf::MessageExts
          extend ::Google::Protobuf::MessageExts::ClassMethods

          # The overall result of the test's configuration analysis.
          module Result
            # No result was specified.
            RESULT_UNSPECIFIED = 0

            # Possible scenarios are:
            #
            # * The configuration analysis determined that a packet originating from
            #   the source is expected to reach the destination.
            # * The analysis didn't complete because the user lacks permission for
            #   some of the resources in the trace. However, at the time the user's
            #   permission became insufficient, the trace had been successful so far.
            REACHABLE = 1

            # A packet originating from the source is expected to be dropped before
            # reaching the destination.
            UNREACHABLE = 2

            # The source and destination endpoints do not uniquely identify
            # the test location in the network, and the reachability result contains
            # multiple traces. For some traces, a packet could be delivered, and for
            # others, it would not be.
            AMBIGUOUS = 4

            # The configuration analysis did not complete. Possible reasons are:
            #
            # * A permissions error occurred--for example, the user might not have
            #   read permission for all of the resources named in the test.
            # * An internal error occurred.
            # * The analyzer received an invalid or unsupported argument or was unable
            #   to identify a known endpoint.
            UNDETERMINED = 5
          end
        end
      end
    end
  end
end