# 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.VolumeRestore do
  @moduledoc """
  Represents the operation of restoring a volume from a VolumeBackup.

  ## Attributes

  *   `completeTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The timestamp when the associated underlying volume restoration completed.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The timestamp when this VolumeRestore resource was created.
  *   `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 restore from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform volume restore updates in order to avoid race conditions.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. Full name of the VolumeRestore resource. Format: `projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*`
  *   `state` (*type:* `String.t`, *default:* `nil`) - Output only. The current state of this VolumeRestore.
  *   `stateMessage` (*type:* `String.t`, *default:* `nil`) - Output only. A human readable message explaining why the VolumeRestore is in its current state.
  *   `targetPvc` (*type:* `GoogleApi.GKEBackup.V1.Model.NamespacedName.t`, *default:* `nil`) - Output only. The reference to the target Kubernetes PVC to be restored.
  *   `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 VolumeRestore resource was last updated.
  *   `volumeBackup` (*type:* `String.t`, *default:* `nil`) - Output only. The full name of the VolumeBackup from which the volume will be restored. Format: `projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*`.
  *   `volumeHandle` (*type:* `String.t`, *default:* `nil`) - Output only. A storage system-specific opaque handler to the underlying volume created for the target PVC from the volume backup.
  *   `volumeType` (*type:* `String.t`, *default:* `nil`) - Output only. The type of volume provisioned
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :completeTime => DateTime.t() | nil,
          :createTime => DateTime.t() | nil,
          :etag => String.t() | nil,
          :name => String.t() | nil,
          :state => String.t() | nil,
          :stateMessage => String.t() | nil,
          :targetPvc => GoogleApi.GKEBackup.V1.Model.NamespacedName.t() | nil,
          :uid => String.t() | nil,
          :updateTime => DateTime.t() | nil,
          :volumeBackup => String.t() | nil,
          :volumeHandle => String.t() | nil,
          :volumeType => String.t() | nil
        }

  field(:completeTime, as: DateTime)
  field(:createTime, as: DateTime)
  field(:etag)
  field(:name)
  field(:state)
  field(:stateMessage)
  field(:targetPvc, as: GoogleApi.GKEBackup.V1.Model.NamespacedName)
  field(:uid)
  field(:updateTime, as: DateTime)
  field(:volumeBackup)
  field(:volumeHandle)
  field(:volumeType)
end

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

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