# Copyright 2019 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
#
#     http://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.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.NetworkManagement.V1.Model.ProbingDetails do
  @moduledoc """
  Results of active probing from the last run of the test.

  ## Attributes

  *   `abortCause` (*type:* `String.t`, *default:* `nil`) - The reason probing was aborted.
  *   `destinationEgressLocation` (*type:* `GoogleApi.NetworkManagement.V1.Model.EdgeLocation.t`, *default:* `nil`) - The EdgeLocation from which a packet destined for/originating from the internet will egress/ingress the Google network. This will only be populated for a connectivity test which has an internet destination/source address. The absence of this field *must not* be used as an indication that the destination/source is part of the Google network.
  *   `endpointInfo` (*type:* `GoogleApi.NetworkManagement.V1.Model.EndpointInfo.t`, *default:* `nil`) - The source and destination endpoints derived from the test input and used for active probing.
  *   `error` (*type:* `GoogleApi.NetworkManagement.V1.Model.Status.t`, *default:* `nil`) - Details about an internal failure or the cancellation of active probing.
  *   `probingLatency` (*type:* `GoogleApi.NetworkManagement.V1.Model.LatencyDistribution.t`, *default:* `nil`) - Latency as measured by active probing in one direction: from the source to the destination endpoint.
  *   `result` (*type:* `String.t`, *default:* `nil`) - The overall result of active probing.
  *   `sentProbeCount` (*type:* `integer()`, *default:* `nil`) - Number of probes sent.
  *   `successfulProbeCount` (*type:* `integer()`, *default:* `nil`) - Number of probes that reached the destination.
  *   `verifyTime` (*type:* `DateTime.t`, *default:* `nil`) - The time that reachability was assessed through active probing.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :abortCause => String.t() | nil,
          :destinationEgressLocation =>
            GoogleApi.NetworkManagement.V1.Model.EdgeLocation.t() | nil,
          :endpointInfo => GoogleApi.NetworkManagement.V1.Model.EndpointInfo.t() | nil,
          :error => GoogleApi.NetworkManagement.V1.Model.Status.t() | nil,
          :probingLatency => GoogleApi.NetworkManagement.V1.Model.LatencyDistribution.t() | nil,
          :result => String.t() | nil,
          :sentProbeCount => integer() | nil,
          :successfulProbeCount => integer() | nil,
          :verifyTime => DateTime.t() | nil
        }

  field(:abortCause)
  field(:destinationEgressLocation, as: GoogleApi.NetworkManagement.V1.Model.EdgeLocation)
  field(:endpointInfo, as: GoogleApi.NetworkManagement.V1.Model.EndpointInfo)
  field(:error, as: GoogleApi.NetworkManagement.V1.Model.Status)
  field(:probingLatency, as: GoogleApi.NetworkManagement.V1.Model.LatencyDistribution)
  field(:result)
  field(:sentProbeCount)
  field(:successfulProbeCount)
  field(:verifyTime, as: DateTime)
end

defimpl Poison.Decoder, for: GoogleApi.NetworkManagement.V1.Model.ProbingDetails do
  def decode(value, options) do
    GoogleApi.NetworkManagement.V1.Model.ProbingDetails.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.NetworkManagement.V1.Model.ProbingDetails do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
