# 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.Storage.V1.Model.BucketIpFilter do
  @moduledoc """
  The bucket's IP filter configuration. Specifies the network sources that are allowed to access the operations on the bucket, as well as its underlying objects. Only enforced when the mode is set to 'Enabled'.

  ## Attributes

  *   `mode` (*type:* `String.t`, *default:* `nil`) - The mode of the IP filter. Valid values are 'Enabled' and 'Disabled'.
  *   `publicNetworkSource` (*type:* `GoogleApi.Storage.V1.Model.BucketIpFilterPublicNetworkSource.t`, *default:* `nil`) - The public network source of the bucket's IP filter.
  *   `vpcNetworkSources` (*type:* `list(GoogleApi.Storage.V1.Model.BucketIpFilterVpcNetworkSources.t)`, *default:* `nil`) - The list of [VPC network](https://cloud.google.com/vpc/docs/vpc) sources of the bucket's IP filter.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :mode => String.t() | nil,
          :publicNetworkSource =>
            GoogleApi.Storage.V1.Model.BucketIpFilterPublicNetworkSource.t() | nil,
          :vpcNetworkSources =>
            list(GoogleApi.Storage.V1.Model.BucketIpFilterVpcNetworkSources.t()) | nil
        }

  field(:mode)
  field(:publicNetworkSource, as: GoogleApi.Storage.V1.Model.BucketIpFilterPublicNetworkSource)

  field(:vpcNetworkSources,
    as: GoogleApi.Storage.V1.Model.BucketIpFilterVpcNetworkSources,
    type: :list
  )
end

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

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