# 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.AlloyDB.V1.Model.AutomatedBackupPolicy do
  @moduledoc """
  Message describing the user-specified automated backup policy. All fields in the automated backup policy are optional. Defaults for each field are provided if they are not set.

  ## Attributes

  *   `backupWindow` (*type:* `String.t`, *default:* `nil`) - The length of the time window during which a backup can be taken. If a backup does not succeed within this time window, it will be canceled and considered failed. The backup window must be at least 5 minutes long. There is no upper bound on the window. If not set, it defaults to 1 hour.
  *   `enabled` (*type:* `boolean()`, *default:* `nil`) - Whether automated automated backups are enabled. If not set, defaults to true.
  *   `encryptionConfig` (*type:* `GoogleApi.AlloyDB.V1.Model.EncryptionConfig.t`, *default:* `nil`) - Optional. The encryption config can be specified to encrypt the backups with a customer-managed encryption key (CMEK). When this field is not specified, the backup will use the cluster's encryption config.
  *   `labels` (*type:* `map()`, *default:* `nil`) - Labels to apply to backups created using this configuration.
  *   `location` (*type:* `String.t`, *default:* `nil`) - The location where the backup will be stored. Currently, the only supported option is to store the backup in the same region as the cluster. If empty, defaults to the region of the cluster.
  *   `quantityBasedRetention` (*type:* `GoogleApi.AlloyDB.V1.Model.QuantityBasedRetention.t`, *default:* `nil`) - Quantity-based Backup retention policy to retain recent backups.
  *   `timeBasedRetention` (*type:* `GoogleApi.AlloyDB.V1.Model.TimeBasedRetention.t`, *default:* `nil`) - Time-based Backup retention policy.
  *   `weeklySchedule` (*type:* `GoogleApi.AlloyDB.V1.Model.WeeklySchedule.t`, *default:* `nil`) - Weekly schedule for the Backup.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :backupWindow => String.t() | nil,
          :enabled => boolean() | nil,
          :encryptionConfig => GoogleApi.AlloyDB.V1.Model.EncryptionConfig.t() | nil,
          :labels => map() | nil,
          :location => String.t() | nil,
          :quantityBasedRetention => GoogleApi.AlloyDB.V1.Model.QuantityBasedRetention.t() | nil,
          :timeBasedRetention => GoogleApi.AlloyDB.V1.Model.TimeBasedRetention.t() | nil,
          :weeklySchedule => GoogleApi.AlloyDB.V1.Model.WeeklySchedule.t() | nil
        }

  field(:backupWindow)
  field(:enabled)
  field(:encryptionConfig, as: GoogleApi.AlloyDB.V1.Model.EncryptionConfig)
  field(:labels, type: :map)
  field(:location)
  field(:quantityBasedRetention, as: GoogleApi.AlloyDB.V1.Model.QuantityBasedRetention)
  field(:timeBasedRetention, as: GoogleApi.AlloyDB.V1.Model.TimeBasedRetention)
  field(:weeklySchedule, as: GoogleApi.AlloyDB.V1.Model.WeeklySchedule)
end

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

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