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

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

-- |
-- Module      : Amazonka.Glacier.Types.VaultLockPolicy
-- 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)
module Amazonka.Glacier.Types.VaultLockPolicy where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

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

-- |
-- Create a value of 'VaultLockPolicy' 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:
--
-- 'policy', 'vaultLockPolicy_policy' - The vault lock policy.
newVaultLockPolicy ::
  VaultLockPolicy
newVaultLockPolicy :: VaultLockPolicy
newVaultLockPolicy =
  VaultLockPolicy' :: Maybe Text -> VaultLockPolicy
VaultLockPolicy' {$sel:policy:VaultLockPolicy' :: Maybe Text
policy = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The vault lock policy.
vaultLockPolicy_policy :: Lens.Lens' VaultLockPolicy (Prelude.Maybe Prelude.Text)
vaultLockPolicy_policy :: (Maybe Text -> f (Maybe Text))
-> VaultLockPolicy -> f VaultLockPolicy
vaultLockPolicy_policy = (VaultLockPolicy -> Maybe Text)
-> (VaultLockPolicy -> Maybe Text -> VaultLockPolicy)
-> Lens VaultLockPolicy VaultLockPolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VaultLockPolicy' {Maybe Text
policy :: Maybe Text
$sel:policy:VaultLockPolicy' :: VaultLockPolicy -> Maybe Text
policy} -> Maybe Text
policy) (\s :: VaultLockPolicy
s@VaultLockPolicy' {} Maybe Text
a -> VaultLockPolicy
s {$sel:policy:VaultLockPolicy' :: Maybe Text
policy = Maybe Text
a} :: VaultLockPolicy)

instance Prelude.Hashable VaultLockPolicy

instance Prelude.NFData VaultLockPolicy

instance Core.ToJSON VaultLockPolicy where
  toJSON :: VaultLockPolicy -> Value
toJSON VaultLockPolicy' {Maybe Text
policy :: Maybe Text
$sel:policy:VaultLockPolicy' :: VaultLockPolicy -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"Policy" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
policy]
      )