# 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.TrafficDirector.V3.Model.StringMatcher do
  @moduledoc """
  Specifies the way to match a string. [#next-free-field: 9]

  ## Attributes

  *   `contains` (*type:* `String.t`, *default:* `nil`) - The input string must have the substring specified here. Note: empty contains match is not allowed, please use regex instead. Examples: * ``abc`` matches the value ``xyz.abc.def``
  *   `custom` (*type:* `GoogleApi.TrafficDirector.V3.Model.TypedExtensionConfig.t`, *default:* `nil`) - Use an extension as the matcher type. [#extension-category: envoy.string_matcher]
  *   `exact` (*type:* `String.t`, *default:* `nil`) - The input string must match exactly the string specified here. Examples: * ``abc`` only matches the value ``abc``.
  *   `ignoreCase` (*type:* `boolean()`, *default:* `nil`) - If true, indicates the exact/prefix/suffix/contains matching should be case insensitive. This has no effect for the safe_regex match. For example, the matcher ``data`` will match both input string ``Data`` and ``data`` if set to true.
  *   `prefix` (*type:* `String.t`, *default:* `nil`) - The input string must have the prefix specified here. Note: empty prefix is not allowed, please use regex instead. Examples: * ``abc`` matches the value ``abc.xyz``
  *   `safeRegex` (*type:* `GoogleApi.TrafficDirector.V3.Model.RegexMatcher.t`, *default:* `nil`) - The input string must match the regular expression specified here.
  *   `suffix` (*type:* `String.t`, *default:* `nil`) - The input string must have the suffix specified here. Note: empty prefix is not allowed, please use regex instead. Examples: * ``abc`` matches the value ``xyz.abc``
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :contains => String.t() | nil,
          :custom => GoogleApi.TrafficDirector.V3.Model.TypedExtensionConfig.t() | nil,
          :exact => String.t() | nil,
          :ignoreCase => boolean() | nil,
          :prefix => String.t() | nil,
          :safeRegex => GoogleApi.TrafficDirector.V3.Model.RegexMatcher.t() | nil,
          :suffix => String.t() | nil
        }

  field(:contains)
  field(:custom, as: GoogleApi.TrafficDirector.V3.Model.TypedExtensionConfig)
  field(:exact)
  field(:ignoreCase)
  field(:prefix)
  field(:safeRegex, as: GoogleApi.TrafficDirector.V3.Model.RegexMatcher)
  field(:suffix)
end

defimpl Poison.Decoder, for: GoogleApi.TrafficDirector.V3.Model.StringMatcher do
  def decode(value, options) do
    GoogleApi.TrafficDirector.V3.Model.StringMatcher.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.TrafficDirector.V3.Model.StringMatcher do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
