# 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.Release do
  @moduledoc """
  A `Release` resource in the Cloud Deploy API. A `Release` defines a specific Skaffold configuration instance that can be deployed.

  ## Attributes

  *   `abandoned` (*type:* `boolean()`, *default:* `nil`) - Output only. Indicates whether this is an abandoned release.
  *   `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.
  *   `buildArtifacts` (*type:* `list(GoogleApi.CloudDeploy.V1.Model.BuildArtifact.t)`, *default:* `nil`) - Optional. List of artifacts to pass through to Skaffold command.
  *   `condition` (*type:* `GoogleApi.CloudDeploy.V1.Model.ReleaseCondition.t`, *default:* `nil`) - Output only. Information around the state of the Release.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Time at which the `Release` was created.
  *   `customTargetTypeSnapshots` (*type:* `list(GoogleApi.CloudDeploy.V1.Model.CustomTargetType.t)`, *default:* `nil`) - Output only. Snapshot of the custom target types referenced by the targets taken at release creation time.
  *   `deliveryPipelineSnapshot` (*type:* `GoogleApi.CloudDeploy.V1.Model.DeliveryPipeline.t`, *default:* `nil`) - Output only. Snapshot of the parent pipeline taken at release creation time.
  *   `deployParameters` (*type:* `map()`, *default:* `nil`) - Optional. The deploy parameters to use for all targets in this release.
  *   `description` (*type:* `String.t`, *default:* `nil`) - Optional. Description of the `Release`. Max length is 255 characters.
  *   `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.
  *   `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.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Identifier. Name of the `Release`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}`. The `release` component must match `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`
  *   `renderEndTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Time at which the render completed.
  *   `renderStartTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Time at which the render began.
  *   `renderState` (*type:* `String.t`, *default:* `nil`) - Output only. Current state of the render operation.
  *   `skaffoldConfigPath` (*type:* `String.t`, *default:* `nil`) - Optional. Filepath of the Skaffold config inside of the config URI.
  *   `skaffoldConfigUri` (*type:* `String.t`, *default:* `nil`) - Optional. Cloud Storage URI of tar.gz archive containing Skaffold configuration.
  *   `skaffoldVersion` (*type:* `String.t`, *default:* `nil`) - Optional. The Skaffold version to use when operating on this release, such as "1.20.0". Not all versions are valid; Cloud Deploy supports a specific set of versions. If unset, the most recent supported Skaffold version will be used.
  *   `targetArtifacts` (*type:* `%{optional(String.t) => GoogleApi.CloudDeploy.V1.Model.TargetArtifact.t}`, *default:* `nil`) - Output only. Map from target ID to the target artifacts created during the render operation.
  *   `targetRenders` (*type:* `%{optional(String.t) => GoogleApi.CloudDeploy.V1.Model.TargetRender.t}`, *default:* `nil`) - Output only. Map from target ID to details of the render operation for that target.
  *   `targetSnapshots` (*type:* `list(GoogleApi.CloudDeploy.V1.Model.Target.t)`, *default:* `nil`) - Output only. Snapshot of the targets taken at release creation time.
  *   `uid` (*type:* `String.t`, *default:* `nil`) - Output only. Unique identifier of the `Release`.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :abandoned => boolean() | nil,
          :annotations => map() | nil,
          :buildArtifacts => list(GoogleApi.CloudDeploy.V1.Model.BuildArtifact.t()) | nil,
          :condition => GoogleApi.CloudDeploy.V1.Model.ReleaseCondition.t() | nil,
          :createTime => DateTime.t() | nil,
          :customTargetTypeSnapshots =>
            list(GoogleApi.CloudDeploy.V1.Model.CustomTargetType.t()) | nil,
          :deliveryPipelineSnapshot => GoogleApi.CloudDeploy.V1.Model.DeliveryPipeline.t() | nil,
          :deployParameters => map() | nil,
          :description => String.t() | nil,
          :etag => String.t() | nil,
          :labels => map() | nil,
          :name => String.t() | nil,
          :renderEndTime => DateTime.t() | nil,
          :renderStartTime => DateTime.t() | nil,
          :renderState => String.t() | nil,
          :skaffoldConfigPath => String.t() | nil,
          :skaffoldConfigUri => String.t() | nil,
          :skaffoldVersion => String.t() | nil,
          :targetArtifacts =>
            %{optional(String.t()) => GoogleApi.CloudDeploy.V1.Model.TargetArtifact.t()} | nil,
          :targetRenders =>
            %{optional(String.t()) => GoogleApi.CloudDeploy.V1.Model.TargetRender.t()} | nil,
          :targetSnapshots => list(GoogleApi.CloudDeploy.V1.Model.Target.t()) | nil,
          :uid => String.t() | nil
        }

  field(:abandoned)
  field(:annotations, type: :map)
  field(:buildArtifacts, as: GoogleApi.CloudDeploy.V1.Model.BuildArtifact, type: :list)
  field(:condition, as: GoogleApi.CloudDeploy.V1.Model.ReleaseCondition)
  field(:createTime, as: DateTime)

  field(:customTargetTypeSnapshots,
    as: GoogleApi.CloudDeploy.V1.Model.CustomTargetType,
    type: :list
  )

  field(:deliveryPipelineSnapshot, as: GoogleApi.CloudDeploy.V1.Model.DeliveryPipeline)
  field(:deployParameters, type: :map)
  field(:description)
  field(:etag)
  field(:labels, type: :map)
  field(:name)
  field(:renderEndTime, as: DateTime)
  field(:renderStartTime, as: DateTime)
  field(:renderState)
  field(:skaffoldConfigPath)
  field(:skaffoldConfigUri)
  field(:skaffoldVersion)
  field(:targetArtifacts, as: GoogleApi.CloudDeploy.V1.Model.TargetArtifact, type: :map)
  field(:targetRenders, as: GoogleApi.CloudDeploy.V1.Model.TargetRender, type: :map)
  field(:targetSnapshots, as: GoogleApi.CloudDeploy.V1.Model.Target, type: :list)
  field(:uid)
end

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

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