# 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.DLP.V2.Model.GooglePrivacyDlpV2DatabaseResourceRegex do
  @moduledoc """
  A pattern to match against one or more database resources. At least one pattern must be specified. Regular expressions use RE2 [syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found under the google/re2 repository on GitHub.

  ## Attributes

  *   `databaseRegex` (*type:* `String.t`, *default:* `nil`) - Regex to test the database name against. If empty, all databases match.
  *   `databaseResourceNameRegex` (*type:* `String.t`, *default:* `nil`) - Regex to test the database resource's name against. An example of a database resource name is a table's name. Other database resource names like view names could be included in the future. If empty, all database resources match.
  *   `instanceRegex` (*type:* `String.t`, *default:* `nil`) - Regex to test the instance name against. If empty, all instances match.
  *   `projectIdRegex` (*type:* `String.t`, *default:* `nil`) - For organizations, if unset, will match all projects. Has no effect for configurations created within a project.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :databaseRegex => String.t() | nil,
          :databaseResourceNameRegex => String.t() | nil,
          :instanceRegex => String.t() | nil,
          :projectIdRegex => String.t() | nil
        }

  field(:databaseRegex)
  field(:databaseResourceNameRegex)
  field(:instanceRegex)
  field(:projectIdRegex)
end

defimpl Poison.Decoder, for: GoogleApi.DLP.V2.Model.GooglePrivacyDlpV2DatabaseResourceRegex do
  def decode(value, options) do
    GoogleApi.DLP.V2.Model.GooglePrivacyDlpV2DatabaseResourceRegex.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.DLP.V2.Model.GooglePrivacyDlpV2DatabaseResourceRegex do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
