# 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.GKEBackup.V1.Model.TransformationRule do
  @moduledoc """
  A transformation rule to be applied against Kubernetes resources as they are selected for restoration from a Backup. A rule contains both filtering logic (which resources are subject to transform) and transformation logic.

  ## Attributes

  *   `description` (*type:* `String.t`, *default:* `nil`) - Optional. The description is a user specified string description of the transformation rule.
  *   `fieldActions` (*type:* `list(GoogleApi.GKEBackup.V1.Model.TransformationRuleAction.t)`, *default:* `nil`) - Required. A list of transformation rule actions to take against candidate resources. Actions are executed in order defined - this order matters, as they could potentially interfere with each other and the first operation could affect the outcome of the second operation.
  *   `resourceFilter` (*type:* `GoogleApi.GKEBackup.V1.Model.ResourceFilter.t`, *default:* `nil`) - Optional. This field is used to specify a set of fields that should be used to determine which resources in backup should be acted upon by the supplied transformation rule actions, and this will ensure that only specific resources are affected by transformation rule actions.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :description => String.t() | nil,
          :fieldActions => list(GoogleApi.GKEBackup.V1.Model.TransformationRuleAction.t()) | nil,
          :resourceFilter => GoogleApi.GKEBackup.V1.Model.ResourceFilter.t() | nil
        }

  field(:description)
  field(:fieldActions, as: GoogleApi.GKEBackup.V1.Model.TransformationRuleAction, type: :list)
  field(:resourceFilter, as: GoogleApi.GKEBackup.V1.Model.ResourceFilter)
end

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

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