# 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.CloudDeploy.V1.Model.RollbackTargetRequest do
  @moduledoc """
  The request object for `RollbackTarget`.

  ## Attributes

  *   `overrideDeployPolicy` (*type:* `list(String.t)`, *default:* `nil`) - Optional. Deploy policies to override. Format is `projects/{project}/locations/{location}/deployPolicies/{deploy_policy}`.
  *   `releaseId` (*type:* `String.t`, *default:* `nil`) - Optional. ID of the `Release` to roll back to. If this isn't specified, the previous successful `Rollout` to the specified target will be used to determine the `Release`.
  *   `rollbackConfig` (*type:* `GoogleApi.CloudDeploy.V1.Model.RollbackTargetConfig.t`, *default:* `nil`) - Optional. Configs for the rollback `Rollout`.
  *   `rolloutId` (*type:* `String.t`, *default:* `nil`) - Required. ID of the rollback `Rollout` to create.
  *   `rolloutToRollBack` (*type:* `String.t`, *default:* `nil`) - Optional. If provided, this must be the latest `Rollout` that is on the `Target`.
  *   `targetId` (*type:* `String.t`, *default:* `nil`) - Required. ID of the `Target` that is being rolled back.
  *   `validateOnly` (*type:* `boolean()`, *default:* `nil`) - Optional. If set to true, the request is validated and the user is provided with a `RollbackTargetResponse`.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :overrideDeployPolicy => list(String.t()) | nil,
          :releaseId => String.t() | nil,
          :rollbackConfig => GoogleApi.CloudDeploy.V1.Model.RollbackTargetConfig.t() | nil,
          :rolloutId => String.t() | nil,
          :rolloutToRollBack => String.t() | nil,
          :targetId => String.t() | nil,
          :validateOnly => boolean() | nil
        }

  field(:overrideDeployPolicy, type: :list)
  field(:releaseId)
  field(:rollbackConfig, as: GoogleApi.CloudDeploy.V1.Model.RollbackTargetConfig)
  field(:rolloutId)
  field(:rolloutToRollBack)
  field(:targetId)
  field(:validateOnly)
end

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

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