{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Backup.PutBackupVaultLockConfiguration
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Applies Backup Vault Lock to a backup vault, preventing attempts to
-- delete any recovery point stored in or created in a backup vault. Vault
-- Lock also prevents attempts to update the lifecycle policy that controls
-- the retention period of any recovery point currently stored in a backup
-- vault. If specified, Vault Lock enforces a minimum and maximum retention
-- period for future backup and copy jobs that target a backup vault.
module Amazonka.Backup.PutBackupVaultLockConfiguration
  ( -- * Creating a Request
    PutBackupVaultLockConfiguration (..),
    newPutBackupVaultLockConfiguration,

    -- * Request Lenses
    putBackupVaultLockConfiguration_maxRetentionDays,
    putBackupVaultLockConfiguration_changeableForDays,
    putBackupVaultLockConfiguration_minRetentionDays,
    putBackupVaultLockConfiguration_backupVaultName,

    -- * Destructuring the Response
    PutBackupVaultLockConfigurationResponse (..),
    newPutBackupVaultLockConfigurationResponse,
  )
where

import Amazonka.Backup.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newPutBackupVaultLockConfiguration' smart constructor.
data PutBackupVaultLockConfiguration = PutBackupVaultLockConfiguration'
  { -- | The Backup Vault Lock configuration that specifies the maximum retention
    -- period that the vault retains its recovery points. This setting can be
    -- useful if, for example, your organization\'s policies require you to
    -- destroy certain data after retaining it for four years (1460 days).
    --
    -- If this parameter is not included, Vault Lock does not enforce a maximum
    -- retention period on the recovery points in the vault. If this parameter
    -- is included without a value, Vault Lock will not enforce a maximum
    -- retention period.
    --
    -- If this parameter is specified, any backup or copy job to the vault must
    -- have a lifecycle policy with a retention period equal to or shorter than
    -- the maximum retention period. If the job\'s retention period is longer
    -- than that maximum retention period, then the vault fails the backup or
    -- copy job, and you should either modify your lifecycle settings or use a
    -- different vault. Recovery points already saved in the vault prior to
    -- Vault Lock are not affected.
    PutBackupVaultLockConfiguration -> Maybe Integer
maxRetentionDays :: Prelude.Maybe Prelude.Integer,
    -- | The Backup Vault Lock configuration that specifies the number of days
    -- before the lock date. For example, setting @ChangeableForDays@ to 30 on
    -- Jan. 1, 2022 at 8pm UTC will set the lock date to Jan. 31, 2022 at 8pm
    -- UTC.
    --
    -- Backup enforces a 72-hour cooling-off period before Vault Lock takes
    -- effect and becomes immutable. Therefore, you must set
    -- @ChangeableForDays@ to 3 or greater.
    --
    -- Before the lock date, you can delete Vault Lock from the vault using
    -- @DeleteBackupVaultLockConfiguration@ or change the Vault Lock
    -- configuration using @PutBackupVaultLockConfiguration@. On and after the
    -- lock date, the Vault Lock becomes immutable and cannot be changed or
    -- deleted.
    --
    -- If this parameter is not specified, you can delete Vault Lock from the
    -- vault using @DeleteBackupVaultLockConfiguration@ or change the Vault
    -- Lock configuration using @PutBackupVaultLockConfiguration@ at any time.
    PutBackupVaultLockConfiguration -> Maybe Integer
changeableForDays :: Prelude.Maybe Prelude.Integer,
    -- | The Backup Vault Lock configuration that specifies the minimum retention
    -- period that the vault retains its recovery points. This setting can be
    -- useful if, for example, your organization\'s policies require you to
    -- retain certain data for at least seven years (2555 days).
    --
    -- If this parameter is not specified, Vault Lock will not enforce a
    -- minimum retention period.
    --
    -- If this parameter is specified, any backup or copy job to the vault must
    -- have a lifecycle policy with a retention period equal to or longer than
    -- the minimum retention period. If the job\'s retention period is shorter
    -- than that minimum retention period, then the vault fails that backup or
    -- copy job, and you should either modify your lifecycle settings or use a
    -- different vault. Recovery points already saved in the vault prior to
    -- Vault Lock are not affected.
    PutBackupVaultLockConfiguration -> Maybe Integer
minRetentionDays :: Prelude.Maybe Prelude.Integer,
    -- | The Backup Vault Lock configuration that specifies the name of the
    -- backup vault it protects.
    PutBackupVaultLockConfiguration -> Text
backupVaultName :: Prelude.Text
  }
  deriving (PutBackupVaultLockConfiguration
-> PutBackupVaultLockConfiguration -> Bool
(PutBackupVaultLockConfiguration
 -> PutBackupVaultLockConfiguration -> Bool)
-> (PutBackupVaultLockConfiguration
    -> PutBackupVaultLockConfiguration -> Bool)
-> Eq PutBackupVaultLockConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutBackupVaultLockConfiguration
-> PutBackupVaultLockConfiguration -> Bool
$c/= :: PutBackupVaultLockConfiguration
-> PutBackupVaultLockConfiguration -> Bool
== :: PutBackupVaultLockConfiguration
-> PutBackupVaultLockConfiguration -> Bool
$c== :: PutBackupVaultLockConfiguration
-> PutBackupVaultLockConfiguration -> Bool
Prelude.Eq, ReadPrec [PutBackupVaultLockConfiguration]
ReadPrec PutBackupVaultLockConfiguration
Int -> ReadS PutBackupVaultLockConfiguration
ReadS [PutBackupVaultLockConfiguration]
(Int -> ReadS PutBackupVaultLockConfiguration)
-> ReadS [PutBackupVaultLockConfiguration]
-> ReadPrec PutBackupVaultLockConfiguration
-> ReadPrec [PutBackupVaultLockConfiguration]
-> Read PutBackupVaultLockConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutBackupVaultLockConfiguration]
$creadListPrec :: ReadPrec [PutBackupVaultLockConfiguration]
readPrec :: ReadPrec PutBackupVaultLockConfiguration
$creadPrec :: ReadPrec PutBackupVaultLockConfiguration
readList :: ReadS [PutBackupVaultLockConfiguration]
$creadList :: ReadS [PutBackupVaultLockConfiguration]
readsPrec :: Int -> ReadS PutBackupVaultLockConfiguration
$creadsPrec :: Int -> ReadS PutBackupVaultLockConfiguration
Prelude.Read, Int -> PutBackupVaultLockConfiguration -> ShowS
[PutBackupVaultLockConfiguration] -> ShowS
PutBackupVaultLockConfiguration -> String
(Int -> PutBackupVaultLockConfiguration -> ShowS)
-> (PutBackupVaultLockConfiguration -> String)
-> ([PutBackupVaultLockConfiguration] -> ShowS)
-> Show PutBackupVaultLockConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutBackupVaultLockConfiguration] -> ShowS
$cshowList :: [PutBackupVaultLockConfiguration] -> ShowS
show :: PutBackupVaultLockConfiguration -> String
$cshow :: PutBackupVaultLockConfiguration -> String
showsPrec :: Int -> PutBackupVaultLockConfiguration -> ShowS
$cshowsPrec :: Int -> PutBackupVaultLockConfiguration -> ShowS
Prelude.Show, (forall x.
 PutBackupVaultLockConfiguration
 -> Rep PutBackupVaultLockConfiguration x)
-> (forall x.
    Rep PutBackupVaultLockConfiguration x
    -> PutBackupVaultLockConfiguration)
-> Generic PutBackupVaultLockConfiguration
forall x.
Rep PutBackupVaultLockConfiguration x
-> PutBackupVaultLockConfiguration
forall x.
PutBackupVaultLockConfiguration
-> Rep PutBackupVaultLockConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutBackupVaultLockConfiguration x
-> PutBackupVaultLockConfiguration
$cfrom :: forall x.
PutBackupVaultLockConfiguration
-> Rep PutBackupVaultLockConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'PutBackupVaultLockConfiguration' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'maxRetentionDays', 'putBackupVaultLockConfiguration_maxRetentionDays' - The Backup Vault Lock configuration that specifies the maximum retention
-- period that the vault retains its recovery points. This setting can be
-- useful if, for example, your organization\'s policies require you to
-- destroy certain data after retaining it for four years (1460 days).
--
-- If this parameter is not included, Vault Lock does not enforce a maximum
-- retention period on the recovery points in the vault. If this parameter
-- is included without a value, Vault Lock will not enforce a maximum
-- retention period.
--
-- If this parameter is specified, any backup or copy job to the vault must
-- have a lifecycle policy with a retention period equal to or shorter than
-- the maximum retention period. If the job\'s retention period is longer
-- than that maximum retention period, then the vault fails the backup or
-- copy job, and you should either modify your lifecycle settings or use a
-- different vault. Recovery points already saved in the vault prior to
-- Vault Lock are not affected.
--
-- 'changeableForDays', 'putBackupVaultLockConfiguration_changeableForDays' - The Backup Vault Lock configuration that specifies the number of days
-- before the lock date. For example, setting @ChangeableForDays@ to 30 on
-- Jan. 1, 2022 at 8pm UTC will set the lock date to Jan. 31, 2022 at 8pm
-- UTC.
--
-- Backup enforces a 72-hour cooling-off period before Vault Lock takes
-- effect and becomes immutable. Therefore, you must set
-- @ChangeableForDays@ to 3 or greater.
--
-- Before the lock date, you can delete Vault Lock from the vault using
-- @DeleteBackupVaultLockConfiguration@ or change the Vault Lock
-- configuration using @PutBackupVaultLockConfiguration@. On and after the
-- lock date, the Vault Lock becomes immutable and cannot be changed or
-- deleted.
--
-- If this parameter is not specified, you can delete Vault Lock from the
-- vault using @DeleteBackupVaultLockConfiguration@ or change the Vault
-- Lock configuration using @PutBackupVaultLockConfiguration@ at any time.
--
-- 'minRetentionDays', 'putBackupVaultLockConfiguration_minRetentionDays' - The Backup Vault Lock configuration that specifies the minimum retention
-- period that the vault retains its recovery points. This setting can be
-- useful if, for example, your organization\'s policies require you to
-- retain certain data for at least seven years (2555 days).
--
-- If this parameter is not specified, Vault Lock will not enforce a
-- minimum retention period.
--
-- If this parameter is specified, any backup or copy job to the vault must
-- have a lifecycle policy with a retention period equal to or longer than
-- the minimum retention period. If the job\'s retention period is shorter
-- than that minimum retention period, then the vault fails that backup or
-- copy job, and you should either modify your lifecycle settings or use a
-- different vault. Recovery points already saved in the vault prior to
-- Vault Lock are not affected.
--
-- 'backupVaultName', 'putBackupVaultLockConfiguration_backupVaultName' - The Backup Vault Lock configuration that specifies the name of the
-- backup vault it protects.
newPutBackupVaultLockConfiguration ::
  -- | 'backupVaultName'
  Prelude.Text ->
  PutBackupVaultLockConfiguration
newPutBackupVaultLockConfiguration :: Text -> PutBackupVaultLockConfiguration
newPutBackupVaultLockConfiguration Text
pBackupVaultName_ =
  PutBackupVaultLockConfiguration' :: Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Text
-> PutBackupVaultLockConfiguration
PutBackupVaultLockConfiguration'
    { $sel:maxRetentionDays:PutBackupVaultLockConfiguration' :: Maybe Integer
maxRetentionDays =
        Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:changeableForDays:PutBackupVaultLockConfiguration' :: Maybe Integer
changeableForDays = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:minRetentionDays:PutBackupVaultLockConfiguration' :: Maybe Integer
minRetentionDays = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:backupVaultName:PutBackupVaultLockConfiguration' :: Text
backupVaultName = Text
pBackupVaultName_
    }

-- | The Backup Vault Lock configuration that specifies the maximum retention
-- period that the vault retains its recovery points. This setting can be
-- useful if, for example, your organization\'s policies require you to
-- destroy certain data after retaining it for four years (1460 days).
--
-- If this parameter is not included, Vault Lock does not enforce a maximum
-- retention period on the recovery points in the vault. If this parameter
-- is included without a value, Vault Lock will not enforce a maximum
-- retention period.
--
-- If this parameter is specified, any backup or copy job to the vault must
-- have a lifecycle policy with a retention period equal to or shorter than
-- the maximum retention period. If the job\'s retention period is longer
-- than that maximum retention period, then the vault fails the backup or
-- copy job, and you should either modify your lifecycle settings or use a
-- different vault. Recovery points already saved in the vault prior to
-- Vault Lock are not affected.
putBackupVaultLockConfiguration_maxRetentionDays :: Lens.Lens' PutBackupVaultLockConfiguration (Prelude.Maybe Prelude.Integer)
putBackupVaultLockConfiguration_maxRetentionDays :: (Maybe Integer -> f (Maybe Integer))
-> PutBackupVaultLockConfiguration
-> f PutBackupVaultLockConfiguration
putBackupVaultLockConfiguration_maxRetentionDays = (PutBackupVaultLockConfiguration -> Maybe Integer)
-> (PutBackupVaultLockConfiguration
    -> Maybe Integer -> PutBackupVaultLockConfiguration)
-> Lens
     PutBackupVaultLockConfiguration
     PutBackupVaultLockConfiguration
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutBackupVaultLockConfiguration' {Maybe Integer
maxRetentionDays :: Maybe Integer
$sel:maxRetentionDays:PutBackupVaultLockConfiguration' :: PutBackupVaultLockConfiguration -> Maybe Integer
maxRetentionDays} -> Maybe Integer
maxRetentionDays) (\s :: PutBackupVaultLockConfiguration
s@PutBackupVaultLockConfiguration' {} Maybe Integer
a -> PutBackupVaultLockConfiguration
s {$sel:maxRetentionDays:PutBackupVaultLockConfiguration' :: Maybe Integer
maxRetentionDays = Maybe Integer
a} :: PutBackupVaultLockConfiguration)

-- | The Backup Vault Lock configuration that specifies the number of days
-- before the lock date. For example, setting @ChangeableForDays@ to 30 on
-- Jan. 1, 2022 at 8pm UTC will set the lock date to Jan. 31, 2022 at 8pm
-- UTC.
--
-- Backup enforces a 72-hour cooling-off period before Vault Lock takes
-- effect and becomes immutable. Therefore, you must set
-- @ChangeableForDays@ to 3 or greater.
--
-- Before the lock date, you can delete Vault Lock from the vault using
-- @DeleteBackupVaultLockConfiguration@ or change the Vault Lock
-- configuration using @PutBackupVaultLockConfiguration@. On and after the
-- lock date, the Vault Lock becomes immutable and cannot be changed or
-- deleted.
--
-- If this parameter is not specified, you can delete Vault Lock from the
-- vault using @DeleteBackupVaultLockConfiguration@ or change the Vault
-- Lock configuration using @PutBackupVaultLockConfiguration@ at any time.
putBackupVaultLockConfiguration_changeableForDays :: Lens.Lens' PutBackupVaultLockConfiguration (Prelude.Maybe Prelude.Integer)
putBackupVaultLockConfiguration_changeableForDays :: (Maybe Integer -> f (Maybe Integer))
-> PutBackupVaultLockConfiguration
-> f PutBackupVaultLockConfiguration
putBackupVaultLockConfiguration_changeableForDays = (PutBackupVaultLockConfiguration -> Maybe Integer)
-> (PutBackupVaultLockConfiguration
    -> Maybe Integer -> PutBackupVaultLockConfiguration)
-> Lens
     PutBackupVaultLockConfiguration
     PutBackupVaultLockConfiguration
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutBackupVaultLockConfiguration' {Maybe Integer
changeableForDays :: Maybe Integer
$sel:changeableForDays:PutBackupVaultLockConfiguration' :: PutBackupVaultLockConfiguration -> Maybe Integer
changeableForDays} -> Maybe Integer
changeableForDays) (\s :: PutBackupVaultLockConfiguration
s@PutBackupVaultLockConfiguration' {} Maybe Integer
a -> PutBackupVaultLockConfiguration
s {$sel:changeableForDays:PutBackupVaultLockConfiguration' :: Maybe Integer
changeableForDays = Maybe Integer
a} :: PutBackupVaultLockConfiguration)

-- | The Backup Vault Lock configuration that specifies the minimum retention
-- period that the vault retains its recovery points. This setting can be
-- useful if, for example, your organization\'s policies require you to
-- retain certain data for at least seven years (2555 days).
--
-- If this parameter is not specified, Vault Lock will not enforce a
-- minimum retention period.
--
-- If this parameter is specified, any backup or copy job to the vault must
-- have a lifecycle policy with a retention period equal to or longer than
-- the minimum retention period. If the job\'s retention period is shorter
-- than that minimum retention period, then the vault fails that backup or
-- copy job, and you should either modify your lifecycle settings or use a
-- different vault. Recovery points already saved in the vault prior to
-- Vault Lock are not affected.
putBackupVaultLockConfiguration_minRetentionDays :: Lens.Lens' PutBackupVaultLockConfiguration (Prelude.Maybe Prelude.Integer)
putBackupVaultLockConfiguration_minRetentionDays :: (Maybe Integer -> f (Maybe Integer))
-> PutBackupVaultLockConfiguration
-> f PutBackupVaultLockConfiguration
putBackupVaultLockConfiguration_minRetentionDays = (PutBackupVaultLockConfiguration -> Maybe Integer)
-> (PutBackupVaultLockConfiguration
    -> Maybe Integer -> PutBackupVaultLockConfiguration)
-> Lens
     PutBackupVaultLockConfiguration
     PutBackupVaultLockConfiguration
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutBackupVaultLockConfiguration' {Maybe Integer
minRetentionDays :: Maybe Integer
$sel:minRetentionDays:PutBackupVaultLockConfiguration' :: PutBackupVaultLockConfiguration -> Maybe Integer
minRetentionDays} -> Maybe Integer
minRetentionDays) (\s :: PutBackupVaultLockConfiguration
s@PutBackupVaultLockConfiguration' {} Maybe Integer
a -> PutBackupVaultLockConfiguration
s {$sel:minRetentionDays:PutBackupVaultLockConfiguration' :: Maybe Integer
minRetentionDays = Maybe Integer
a} :: PutBackupVaultLockConfiguration)

-- | The Backup Vault Lock configuration that specifies the name of the
-- backup vault it protects.
putBackupVaultLockConfiguration_backupVaultName :: Lens.Lens' PutBackupVaultLockConfiguration Prelude.Text
putBackupVaultLockConfiguration_backupVaultName :: (Text -> f Text)
-> PutBackupVaultLockConfiguration
-> f PutBackupVaultLockConfiguration
putBackupVaultLockConfiguration_backupVaultName = (PutBackupVaultLockConfiguration -> Text)
-> (PutBackupVaultLockConfiguration
    -> Text -> PutBackupVaultLockConfiguration)
-> Lens
     PutBackupVaultLockConfiguration
     PutBackupVaultLockConfiguration
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutBackupVaultLockConfiguration' {Text
backupVaultName :: Text
$sel:backupVaultName:PutBackupVaultLockConfiguration' :: PutBackupVaultLockConfiguration -> Text
backupVaultName} -> Text
backupVaultName) (\s :: PutBackupVaultLockConfiguration
s@PutBackupVaultLockConfiguration' {} Text
a -> PutBackupVaultLockConfiguration
s {$sel:backupVaultName:PutBackupVaultLockConfiguration' :: Text
backupVaultName = Text
a} :: PutBackupVaultLockConfiguration)

instance
  Core.AWSRequest
    PutBackupVaultLockConfiguration
  where
  type
    AWSResponse PutBackupVaultLockConfiguration =
      PutBackupVaultLockConfigurationResponse
  request :: PutBackupVaultLockConfiguration
-> Request PutBackupVaultLockConfiguration
request = Service
-> PutBackupVaultLockConfiguration
-> Request PutBackupVaultLockConfiguration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy PutBackupVaultLockConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse PutBackupVaultLockConfiguration)))
response =
    AWSResponse PutBackupVaultLockConfiguration
-> Logger
-> Service
-> Proxy PutBackupVaultLockConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse PutBackupVaultLockConfiguration)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse PutBackupVaultLockConfiguration
PutBackupVaultLockConfigurationResponse
PutBackupVaultLockConfigurationResponse'

instance
  Prelude.Hashable
    PutBackupVaultLockConfiguration

instance
  Prelude.NFData
    PutBackupVaultLockConfiguration

instance
  Core.ToHeaders
    PutBackupVaultLockConfiguration
  where
  toHeaders :: PutBackupVaultLockConfiguration -> [Header]
toHeaders =
    [Header] -> PutBackupVaultLockConfiguration -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON PutBackupVaultLockConfiguration where
  toJSON :: PutBackupVaultLockConfiguration -> Value
toJSON PutBackupVaultLockConfiguration' {Maybe Integer
Text
backupVaultName :: Text
minRetentionDays :: Maybe Integer
changeableForDays :: Maybe Integer
maxRetentionDays :: Maybe Integer
$sel:backupVaultName:PutBackupVaultLockConfiguration' :: PutBackupVaultLockConfiguration -> Text
$sel:minRetentionDays:PutBackupVaultLockConfiguration' :: PutBackupVaultLockConfiguration -> Maybe Integer
$sel:changeableForDays:PutBackupVaultLockConfiguration' :: PutBackupVaultLockConfiguration -> Maybe Integer
$sel:maxRetentionDays:PutBackupVaultLockConfiguration' :: PutBackupVaultLockConfiguration -> Maybe Integer
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"MaxRetentionDays" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
maxRetentionDays,
            (Text
"ChangeableForDays" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
changeableForDays,
            (Text
"MinRetentionDays" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
minRetentionDays
          ]
      )

instance Core.ToPath PutBackupVaultLockConfiguration where
  toPath :: PutBackupVaultLockConfiguration -> ByteString
toPath PutBackupVaultLockConfiguration' {Maybe Integer
Text
backupVaultName :: Text
minRetentionDays :: Maybe Integer
changeableForDays :: Maybe Integer
maxRetentionDays :: Maybe Integer
$sel:backupVaultName:PutBackupVaultLockConfiguration' :: PutBackupVaultLockConfiguration -> Text
$sel:minRetentionDays:PutBackupVaultLockConfiguration' :: PutBackupVaultLockConfiguration -> Maybe Integer
$sel:changeableForDays:PutBackupVaultLockConfiguration' :: PutBackupVaultLockConfiguration -> Maybe Integer
$sel:maxRetentionDays:PutBackupVaultLockConfiguration' :: PutBackupVaultLockConfiguration -> Maybe Integer
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/backup-vaults/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
backupVaultName,
        ByteString
"/vault-lock"
      ]

instance Core.ToQuery PutBackupVaultLockConfiguration where
  toQuery :: PutBackupVaultLockConfiguration -> QueryString
toQuery = QueryString -> PutBackupVaultLockConfiguration -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newPutBackupVaultLockConfigurationResponse' smart constructor.
data PutBackupVaultLockConfigurationResponse = PutBackupVaultLockConfigurationResponse'
  {
  }
  deriving (PutBackupVaultLockConfigurationResponse
-> PutBackupVaultLockConfigurationResponse -> Bool
(PutBackupVaultLockConfigurationResponse
 -> PutBackupVaultLockConfigurationResponse -> Bool)
-> (PutBackupVaultLockConfigurationResponse
    -> PutBackupVaultLockConfigurationResponse -> Bool)
-> Eq PutBackupVaultLockConfigurationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutBackupVaultLockConfigurationResponse
-> PutBackupVaultLockConfigurationResponse -> Bool
$c/= :: PutBackupVaultLockConfigurationResponse
-> PutBackupVaultLockConfigurationResponse -> Bool
== :: PutBackupVaultLockConfigurationResponse
-> PutBackupVaultLockConfigurationResponse -> Bool
$c== :: PutBackupVaultLockConfigurationResponse
-> PutBackupVaultLockConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [PutBackupVaultLockConfigurationResponse]
ReadPrec PutBackupVaultLockConfigurationResponse
Int -> ReadS PutBackupVaultLockConfigurationResponse
ReadS [PutBackupVaultLockConfigurationResponse]
(Int -> ReadS PutBackupVaultLockConfigurationResponse)
-> ReadS [PutBackupVaultLockConfigurationResponse]
-> ReadPrec PutBackupVaultLockConfigurationResponse
-> ReadPrec [PutBackupVaultLockConfigurationResponse]
-> Read PutBackupVaultLockConfigurationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutBackupVaultLockConfigurationResponse]
$creadListPrec :: ReadPrec [PutBackupVaultLockConfigurationResponse]
readPrec :: ReadPrec PutBackupVaultLockConfigurationResponse
$creadPrec :: ReadPrec PutBackupVaultLockConfigurationResponse
readList :: ReadS [PutBackupVaultLockConfigurationResponse]
$creadList :: ReadS [PutBackupVaultLockConfigurationResponse]
readsPrec :: Int -> ReadS PutBackupVaultLockConfigurationResponse
$creadsPrec :: Int -> ReadS PutBackupVaultLockConfigurationResponse
Prelude.Read, Int -> PutBackupVaultLockConfigurationResponse -> ShowS
[PutBackupVaultLockConfigurationResponse] -> ShowS
PutBackupVaultLockConfigurationResponse -> String
(Int -> PutBackupVaultLockConfigurationResponse -> ShowS)
-> (PutBackupVaultLockConfigurationResponse -> String)
-> ([PutBackupVaultLockConfigurationResponse] -> ShowS)
-> Show PutBackupVaultLockConfigurationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutBackupVaultLockConfigurationResponse] -> ShowS
$cshowList :: [PutBackupVaultLockConfigurationResponse] -> ShowS
show :: PutBackupVaultLockConfigurationResponse -> String
$cshow :: PutBackupVaultLockConfigurationResponse -> String
showsPrec :: Int -> PutBackupVaultLockConfigurationResponse -> ShowS
$cshowsPrec :: Int -> PutBackupVaultLockConfigurationResponse -> ShowS
Prelude.Show, (forall x.
 PutBackupVaultLockConfigurationResponse
 -> Rep PutBackupVaultLockConfigurationResponse x)
-> (forall x.
    Rep PutBackupVaultLockConfigurationResponse x
    -> PutBackupVaultLockConfigurationResponse)
-> Generic PutBackupVaultLockConfigurationResponse
forall x.
Rep PutBackupVaultLockConfigurationResponse x
-> PutBackupVaultLockConfigurationResponse
forall x.
PutBackupVaultLockConfigurationResponse
-> Rep PutBackupVaultLockConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutBackupVaultLockConfigurationResponse x
-> PutBackupVaultLockConfigurationResponse
$cfrom :: forall x.
PutBackupVaultLockConfigurationResponse
-> Rep PutBackupVaultLockConfigurationResponse x
Prelude.Generic)

-- |
-- Create a value of 'PutBackupVaultLockConfigurationResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
newPutBackupVaultLockConfigurationResponse ::
  PutBackupVaultLockConfigurationResponse
newPutBackupVaultLockConfigurationResponse :: PutBackupVaultLockConfigurationResponse
newPutBackupVaultLockConfigurationResponse =
  PutBackupVaultLockConfigurationResponse
PutBackupVaultLockConfigurationResponse'

instance
  Prelude.NFData
    PutBackupVaultLockConfigurationResponse