# 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.NetworkConnectivity.V1.Model.PolicyBasedRoute do
  @moduledoc """
  Policy-based routes route L4 network traffic based on not just destination IP address, but also source IP address, protocol, and more. If a policy-based route conflicts with other types of routes, the policy-based route always takes precedence.

  ## Attributes

  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Time when the policy-based route was created.
  *   `description` (*type:* `String.t`, *default:* `nil`) - Optional. An optional description of this resource. Provide this field when you create the resource.
  *   `filter` (*type:* `GoogleApi.NetworkConnectivity.V1.Model.Filter.t`, *default:* `nil`) - Required. The filter to match L4 traffic.
  *   `interconnectAttachment` (*type:* `GoogleApi.NetworkConnectivity.V1.Model.InterconnectAttachment.t`, *default:* `nil`) - Optional. The interconnect attachments that this policy-based route applies to.
  *   `kind` (*type:* `String.t`, *default:* `nil`) - Output only. Type of this resource. Always networkconnectivity#policyBasedRoute for policy-based Route resources.
  *   `labels` (*type:* `map()`, *default:* `nil`) - User-defined labels.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Immutable. A unique name of the resource in the form of `projects/{project_number}/locations/global/PolicyBasedRoutes/{policy_based_route_id}`
  *   `network` (*type:* `String.t`, *default:* `nil`) - Required. Fully-qualified URL of the network that this route applies to, for example: projects/my-project/global/networks/my-network.
  *   `nextHopIlbIp` (*type:* `String.t`, *default:* `nil`) - Optional. The IP address of a global-access-enabled L4 ILB that is the next hop for matching packets. For this version, only nextHopIlbIp is supported.
  *   `nextHopOtherRoutes` (*type:* `String.t`, *default:* `nil`) - Optional. Other routes that will be referenced to determine the next hop of the packet.
  *   `priority` (*type:* `integer()`, *default:* `nil`) - Optional. The priority of this policy-based route. Priority is used to break ties in cases where there are more than one matching policy-based routes found. In cases where multiple policy-based routes are matched, the one with the lowest-numbered priority value wins. The default value is 1000. The priority value must be from 1 to 65535, inclusive.
  *   `selfLink` (*type:* `String.t`, *default:* `nil`) - Output only. Server-defined fully-qualified URL for this resource.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Time when the policy-based route was updated.
  *   `virtualMachine` (*type:* `GoogleApi.NetworkConnectivity.V1.Model.VirtualMachine.t`, *default:* `nil`) - Optional. VM instances that this policy-based route applies to.
  *   `warnings` (*type:* `list(GoogleApi.NetworkConnectivity.V1.Model.Warnings.t)`, *default:* `nil`) - Output only. If potential misconfigurations are detected for this route, this field will be populated with warning messages.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :createTime => DateTime.t() | nil,
          :description => String.t() | nil,
          :filter => GoogleApi.NetworkConnectivity.V1.Model.Filter.t() | nil,
          :interconnectAttachment =>
            GoogleApi.NetworkConnectivity.V1.Model.InterconnectAttachment.t() | nil,
          :kind => String.t() | nil,
          :labels => map() | nil,
          :name => String.t() | nil,
          :network => String.t() | nil,
          :nextHopIlbIp => String.t() | nil,
          :nextHopOtherRoutes => String.t() | nil,
          :priority => integer() | nil,
          :selfLink => String.t() | nil,
          :updateTime => DateTime.t() | nil,
          :virtualMachine => GoogleApi.NetworkConnectivity.V1.Model.VirtualMachine.t() | nil,
          :warnings => list(GoogleApi.NetworkConnectivity.V1.Model.Warnings.t()) | nil
        }

  field(:createTime, as: DateTime)
  field(:description)
  field(:filter, as: GoogleApi.NetworkConnectivity.V1.Model.Filter)

  field(:interconnectAttachment, as: GoogleApi.NetworkConnectivity.V1.Model.InterconnectAttachment)

  field(:kind)
  field(:labels, type: :map)
  field(:name)
  field(:network)
  field(:nextHopIlbIp)
  field(:nextHopOtherRoutes)
  field(:priority)
  field(:selfLink)
  field(:updateTime, as: DateTime)
  field(:virtualMachine, as: GoogleApi.NetworkConnectivity.V1.Model.VirtualMachine)
  field(:warnings, as: GoogleApi.NetworkConnectivity.V1.Model.Warnings, type: :list)
end

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

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