# 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.SQLAdmin.V1beta4.Model.Backup do
  @moduledoc """
  A backup resource.

  ## Attributes

  *   `backupInterval` (*type:* `GoogleApi.SQLAdmin.V1beta4.Model.Interval.t`, *default:* `nil`) - Output only. This output contains the following values: start_time: All database writes up to this time are available. end_time: Any database writes after this time aren't available.
  *   `backupKind` (*type:* `String.t`, *default:* `nil`) - Output only. Specifies the kind of backup, PHYSICAL or DEFAULT_SNAPSHOT.
  *   `backupRun` (*type:* `String.t`, *default:* `nil`) - Output only. The mapping to backup run resource used for IAM validations.
  *   `databaseVersion` (*type:* `String.t`, *default:* `nil`) - Output only. The database version of the instance of when this backup was made.
  *   `description` (*type:* `String.t`, *default:* `nil`) - The description of this backup.
  *   `error` (*type:* `GoogleApi.SQLAdmin.V1beta4.Model.OperationError.t`, *default:* `nil`) - Output only. Information about why the backup operation fails (for example, when the backup state fails).
  *   `expiryTime` (*type:* `DateTime.t`, *default:* `nil`) - Backup expiration time. A UTC timestamp of when this resource expired.
  *   `instance` (*type:* `String.t`, *default:* `nil`) - The name of the database instance.
  *   `instanceDeletionTime` (*type:* `DateTime.t`, *default:* `nil`) - Optional. Output only. Timestamp in UTC of when the instance associated with this backup is deleted.
  *   `instanceSettings` (*type:* `GoogleApi.SQLAdmin.V1beta4.Model.DatabaseInstance.t`, *default:* `nil`) - Optional. Output only. Instance setting of the source instance that's associated with this backup.
  *   `kind` (*type:* `String.t`, *default:* `nil`) - Output only. This is always `sql#backup`.
  *   `kmsKey` (*type:* `String.t`, *default:* `nil`) - Output only. This output contains the encryption configuration for a backup and the resource name of the KMS key for disk encryption.
  *   `kmsKeyVersion` (*type:* `String.t`, *default:* `nil`) - Output only. This output contains the encryption status for a backup and the version of the KMS key that's used to encrypt the Cloud SQL instance.
  *   `location` (*type:* `String.t`, *default:* `nil`) - The storage location of the backups. The location can be multi-regional.
  *   `maxChargeableBytes` (*type:* `String.t`, *default:* `nil`) - Output only. The maximum chargeable bytes for the backup.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. The resource name of the backup. Format: projects/{project}/backups/{backup}.
  *   `satisfiesPzi` (*type:* `boolean()`, *default:* `nil`) - Output only. This status indicates whether the backup satisfies PZI. The status is reserved for future use.
  *   `satisfiesPzs` (*type:* `boolean()`, *default:* `nil`) - Output only. This status indicates whether the backup satisfies PZS. The status is reserved for future use.
  *   `selfLink` (*type:* `String.t`, *default:* `nil`) - Output only. The URI of this resource.
  *   `state` (*type:* `String.t`, *default:* `nil`) - Output only. The state of this backup.
  *   `timeZone` (*type:* `String.t`, *default:* `nil`) - Output only. This output contains a backup time zone. If a Cloud SQL for SQL Server instance has a different time zone from the backup's time zone, then the restore to the instance doesn't happen.
  *   `ttlDays` (*type:* `String.t`, *default:* `nil`) - Input only. The time-to-live (TTL) interval for this resource (in days). For example: ttlDays:7, means 7 days from the current time. The expiration time can't exceed 365 days from the time that the backup is created.
  *   `type` (*type:* `String.t`, *default:* `nil`) - Output only. The type of this backup. The type can be "AUTOMATED", "ON_DEMAND", or “FINAL”.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :backupInterval => GoogleApi.SQLAdmin.V1beta4.Model.Interval.t() | nil,
          :backupKind => String.t() | nil,
          :backupRun => String.t() | nil,
          :databaseVersion => String.t() | nil,
          :description => String.t() | nil,
          :error => GoogleApi.SQLAdmin.V1beta4.Model.OperationError.t() | nil,
          :expiryTime => DateTime.t() | nil,
          :instance => String.t() | nil,
          :instanceDeletionTime => DateTime.t() | nil,
          :instanceSettings => GoogleApi.SQLAdmin.V1beta4.Model.DatabaseInstance.t() | nil,
          :kind => String.t() | nil,
          :kmsKey => String.t() | nil,
          :kmsKeyVersion => String.t() | nil,
          :location => String.t() | nil,
          :maxChargeableBytes => String.t() | nil,
          :name => String.t() | nil,
          :satisfiesPzi => boolean() | nil,
          :satisfiesPzs => boolean() | nil,
          :selfLink => String.t() | nil,
          :state => String.t() | nil,
          :timeZone => String.t() | nil,
          :ttlDays => String.t() | nil,
          :type => String.t() | nil
        }

  field(:backupInterval, as: GoogleApi.SQLAdmin.V1beta4.Model.Interval)
  field(:backupKind)
  field(:backupRun)
  field(:databaseVersion)
  field(:description)
  field(:error, as: GoogleApi.SQLAdmin.V1beta4.Model.OperationError)
  field(:expiryTime, as: DateTime)
  field(:instance)
  field(:instanceDeletionTime, as: DateTime)
  field(:instanceSettings, as: GoogleApi.SQLAdmin.V1beta4.Model.DatabaseInstance)
  field(:kind)
  field(:kmsKey)
  field(:kmsKeyVersion)
  field(:location)
  field(:maxChargeableBytes)
  field(:name)
  field(:satisfiesPzi)
  field(:satisfiesPzs)
  field(:selfLink)
  field(:state)
  field(:timeZone)
  field(:ttlDays)
  field(:type)
end

defimpl Poison.Decoder, for: GoogleApi.SQLAdmin.V1beta4.Model.Backup do
  def decode(value, options) do
    GoogleApi.SQLAdmin.V1beta4.Model.Backup.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.SQLAdmin.V1beta4.Model.Backup do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
