# 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.SecurityCenter.V1.Model.IpRule do
  @moduledoc """
  IP rule information.

  ## Attributes

  *   `portRanges` (*type:* `list(GoogleApi.SecurityCenter.V1.Model.PortRange.t)`, *default:* `nil`) - Optional. An optional list of ports to which this rule applies. This field is only applicable for the UDP or (S)TCP protocols. Each entry must be either an integer or a range including a min and max port number.
  *   `protocol` (*type:* `String.t`, *default:* `nil`) - The IP protocol this rule applies to. This value can either be one of the following well known protocol strings (TCP, UDP, ICMP, ESP, AH, IPIP, SCTP) or a string representation of the integer value.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :portRanges => list(GoogleApi.SecurityCenter.V1.Model.PortRange.t()) | nil,
          :protocol => String.t() | nil
        }

  field(:portRanges, as: GoogleApi.SecurityCenter.V1.Model.PortRange, type: :list)
  field(:protocol)
end

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

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