# 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.Rollout do
  @moduledoc """
  A `Rollout` resource in the Cloud Deploy API. A `Rollout` contains information around a specific deployment to a `Target`.

  ## Attributes

  *   `activeRepairAutomationRun` (*type:* `String.t`, *default:* `nil`) - Output only. The AutomationRun actively repairing the rollout.
  *   `annotations` (*type:* `map()`, *default:* `nil`) - Optional. User annotations. These attributes can only be set and used by the user, and not by Cloud Deploy. See https://google.aip.dev/128#annotations for more details such as format and size limitations.
  *   `approvalState` (*type:* `String.t`, *default:* `nil`) - Output only. Approval state of the `Rollout`.
  *   `approveTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Time at which the `Rollout` was approved.
  *   `controllerRollout` (*type:* `String.t`, *default:* `nil`) - Output only. Name of the `ControllerRollout`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Time at which the `Rollout` was created.
  *   `deployEndTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Time at which the `Rollout` finished deploying.
  *   `deployFailureCause` (*type:* `String.t`, *default:* `nil`) - Output only. The reason this rollout failed. This will always be unspecified while the rollout is in progress.
  *   `deployStartTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Time at which the `Rollout` started deploying.
  *   `deployingBuild` (*type:* `String.t`, *default:* `nil`) - Output only. The resource name of the Cloud Build `Build` object that is used to deploy the Rollout. Format is `projects/{project}/locations/{location}/builds/{build}`.
  *   `description` (*type:* `String.t`, *default:* `nil`) - Optional. Description of the `Rollout` for user purposes. Max length is 255 characters.
  *   `enqueueTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Time at which the `Rollout` was enqueued.
  *   `etag` (*type:* `String.t`, *default:* `nil`) - This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
  *   `failureReason` (*type:* `String.t`, *default:* `nil`) - Output only. Additional information about the rollout failure, if available.
  *   `labels` (*type:* `map()`, *default:* `nil`) - Labels are attributes that can be set and used by both the user and by Cloud Deploy. Labels must meet the following constraints: * Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. * All characters must use UTF-8 encoding, and international characters are allowed. * Keys must start with a lowercase letter or international character. * Each resource is limited to a maximum of 64 labels. Both keys and values are additionally constrained to be <= 128 bytes.
  *   `metadata` (*type:* `GoogleApi.CloudDeploy.V1.Model.Metadata.t`, *default:* `nil`) - Output only. Metadata contains information about the rollout.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Identifier. Name of the `Rollout`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`. The `rollout` component must match `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`
  *   `phases` (*type:* `list(GoogleApi.CloudDeploy.V1.Model.Phase.t)`, *default:* `nil`) - Output only. The phases that represent the workflows of this `Rollout`.
  *   `rollbackOfRollout` (*type:* `String.t`, *default:* `nil`) - Output only. Name of the `Rollout` that is rolled back by this `Rollout`. Empty if this `Rollout` wasn't created as a rollback.
  *   `rolledBackByRollouts` (*type:* `list(String.t)`, *default:* `nil`) - Output only. Names of `Rollouts` that rolled back this `Rollout`.
  *   `state` (*type:* `String.t`, *default:* `nil`) - Output only. Current state of the `Rollout`.
  *   `targetId` (*type:* `String.t`, *default:* `nil`) - Required. The ID of Target to which this `Rollout` is deploying.
  *   `uid` (*type:* `String.t`, *default:* `nil`) - Output only. Unique identifier of the `Rollout`.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :activeRepairAutomationRun => String.t() | nil,
          :annotations => map() | nil,
          :approvalState => String.t() | nil,
          :approveTime => DateTime.t() | nil,
          :controllerRollout => String.t() | nil,
          :createTime => DateTime.t() | nil,
          :deployEndTime => DateTime.t() | nil,
          :deployFailureCause => String.t() | nil,
          :deployStartTime => DateTime.t() | nil,
          :deployingBuild => String.t() | nil,
          :description => String.t() | nil,
          :enqueueTime => DateTime.t() | nil,
          :etag => String.t() | nil,
          :failureReason => String.t() | nil,
          :labels => map() | nil,
          :metadata => GoogleApi.CloudDeploy.V1.Model.Metadata.t() | nil,
          :name => String.t() | nil,
          :phases => list(GoogleApi.CloudDeploy.V1.Model.Phase.t()) | nil,
          :rollbackOfRollout => String.t() | nil,
          :rolledBackByRollouts => list(String.t()) | nil,
          :state => String.t() | nil,
          :targetId => String.t() | nil,
          :uid => String.t() | nil
        }

  field(:activeRepairAutomationRun)
  field(:annotations, type: :map)
  field(:approvalState)
  field(:approveTime, as: DateTime)
  field(:controllerRollout)
  field(:createTime, as: DateTime)
  field(:deployEndTime, as: DateTime)
  field(:deployFailureCause)
  field(:deployStartTime, as: DateTime)
  field(:deployingBuild)
  field(:description)
  field(:enqueueTime, as: DateTime)
  field(:etag)
  field(:failureReason)
  field(:labels, type: :map)
  field(:metadata, as: GoogleApi.CloudDeploy.V1.Model.Metadata)
  field(:name)
  field(:phases, as: GoogleApi.CloudDeploy.V1.Model.Phase, type: :list)
  field(:rollbackOfRollout)
  field(:rolledBackByRollouts, type: :list)
  field(:state)
  field(:targetId)
  field(:uid)
end

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

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