# 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.VolumeBackup do
  @moduledoc """
  Represents the backup of a specific persistent volume as a component of a Backup - both the record of the operation and a pointer to the underlying storage-specific artifacts.

  ## Attributes

  *   `completeTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The timestamp when the associated underlying volume backup operation completed.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The timestamp when this VolumeBackup resource was created.
  *   `diskSizeBytes` (*type:* `String.t`, *default:* `nil`) - Output only. The minimum size of the disk to which this VolumeBackup can be restored.
  *   `etag` (*type:* `String.t`, *default:* `nil`) - Output only. `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a volume backup from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform volume backup updates in order to avoid race conditions.
  *   `format` (*type:* `String.t`, *default:* `nil`) - Output only. The format used for the volume backup.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. The full name of the VolumeBackup resource. Format: `projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*`.
  *   `sourcePvc` (*type:* `GoogleApi.GKEBackup.V1.Model.NamespacedName.t`, *default:* `nil`) - Output only. A reference to the source Kubernetes PVC from which this VolumeBackup was created.
  *   `state` (*type:* `String.t`, *default:* `nil`) - Output only. The current state of this VolumeBackup.
  *   `stateMessage` (*type:* `String.t`, *default:* `nil`) - Output only. A human readable message explaining why the VolumeBackup is in its current state.
  *   `storageBytes` (*type:* `String.t`, *default:* `nil`) - Output only. The aggregate size of the underlying artifacts associated with this VolumeBackup in the backup storage. This may change over time when multiple backups of the same volume share the same backup storage location. In particular, this is likely to increase in size when the immediately preceding backup of the same volume is deleted.
  *   `uid` (*type:* `String.t`, *default:* `nil`) - Output only. Server generated global unique identifier of [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The timestamp when this VolumeBackup resource was last updated.
  *   `volumeBackupHandle` (*type:* `String.t`, *default:* `nil`) - Output only. A storage system-specific opaque handle to the underlying volume backup.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :completeTime => DateTime.t() | nil,
          :createTime => DateTime.t() | nil,
          :diskSizeBytes => String.t() | nil,
          :etag => String.t() | nil,
          :format => String.t() | nil,
          :name => String.t() | nil,
          :sourcePvc => GoogleApi.GKEBackup.V1.Model.NamespacedName.t() | nil,
          :state => String.t() | nil,
          :stateMessage => String.t() | nil,
          :storageBytes => String.t() | nil,
          :uid => String.t() | nil,
          :updateTime => DateTime.t() | nil,
          :volumeBackupHandle => String.t() | nil
        }

  field(:completeTime, as: DateTime)
  field(:createTime, as: DateTime)
  field(:diskSizeBytes)
  field(:etag)
  field(:format)
  field(:name)
  field(:sourcePvc, as: GoogleApi.GKEBackup.V1.Model.NamespacedName)
  field(:state)
  field(:stateMessage)
  field(:storageBytes)
  field(:uid)
  field(:updateTime, as: DateTime)
  field(:volumeBackupHandle)
end

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

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