{-# 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 #-}
module Amazonka.Glacier.Types.VaultAccessPolicy where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data VaultAccessPolicy = VaultAccessPolicy'
{
VaultAccessPolicy -> Maybe Text
policy :: Prelude.Maybe Prelude.Text
}
deriving (VaultAccessPolicy -> VaultAccessPolicy -> Bool
(VaultAccessPolicy -> VaultAccessPolicy -> Bool)
-> (VaultAccessPolicy -> VaultAccessPolicy -> Bool)
-> Eq VaultAccessPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VaultAccessPolicy -> VaultAccessPolicy -> Bool
$c/= :: VaultAccessPolicy -> VaultAccessPolicy -> Bool
== :: VaultAccessPolicy -> VaultAccessPolicy -> Bool
$c== :: VaultAccessPolicy -> VaultAccessPolicy -> Bool
Prelude.Eq, ReadPrec [VaultAccessPolicy]
ReadPrec VaultAccessPolicy
Int -> ReadS VaultAccessPolicy
ReadS [VaultAccessPolicy]
(Int -> ReadS VaultAccessPolicy)
-> ReadS [VaultAccessPolicy]
-> ReadPrec VaultAccessPolicy
-> ReadPrec [VaultAccessPolicy]
-> Read VaultAccessPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VaultAccessPolicy]
$creadListPrec :: ReadPrec [VaultAccessPolicy]
readPrec :: ReadPrec VaultAccessPolicy
$creadPrec :: ReadPrec VaultAccessPolicy
readList :: ReadS [VaultAccessPolicy]
$creadList :: ReadS [VaultAccessPolicy]
readsPrec :: Int -> ReadS VaultAccessPolicy
$creadsPrec :: Int -> ReadS VaultAccessPolicy
Prelude.Read, Int -> VaultAccessPolicy -> ShowS
[VaultAccessPolicy] -> ShowS
VaultAccessPolicy -> String
(Int -> VaultAccessPolicy -> ShowS)
-> (VaultAccessPolicy -> String)
-> ([VaultAccessPolicy] -> ShowS)
-> Show VaultAccessPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VaultAccessPolicy] -> ShowS
$cshowList :: [VaultAccessPolicy] -> ShowS
show :: VaultAccessPolicy -> String
$cshow :: VaultAccessPolicy -> String
showsPrec :: Int -> VaultAccessPolicy -> ShowS
$cshowsPrec :: Int -> VaultAccessPolicy -> ShowS
Prelude.Show, (forall x. VaultAccessPolicy -> Rep VaultAccessPolicy x)
-> (forall x. Rep VaultAccessPolicy x -> VaultAccessPolicy)
-> Generic VaultAccessPolicy
forall x. Rep VaultAccessPolicy x -> VaultAccessPolicy
forall x. VaultAccessPolicy -> Rep VaultAccessPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VaultAccessPolicy x -> VaultAccessPolicy
$cfrom :: forall x. VaultAccessPolicy -> Rep VaultAccessPolicy x
Prelude.Generic)
newVaultAccessPolicy ::
VaultAccessPolicy
newVaultAccessPolicy :: VaultAccessPolicy
newVaultAccessPolicy =
VaultAccessPolicy' :: Maybe Text -> VaultAccessPolicy
VaultAccessPolicy' {$sel:policy:VaultAccessPolicy' :: Maybe Text
policy = Maybe Text
forall a. Maybe a
Prelude.Nothing}
vaultAccessPolicy_policy :: Lens.Lens' VaultAccessPolicy (Prelude.Maybe Prelude.Text)
vaultAccessPolicy_policy :: (Maybe Text -> f (Maybe Text))
-> VaultAccessPolicy -> f VaultAccessPolicy
vaultAccessPolicy_policy = (VaultAccessPolicy -> Maybe Text)
-> (VaultAccessPolicy -> Maybe Text -> VaultAccessPolicy)
-> Lens
VaultAccessPolicy VaultAccessPolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VaultAccessPolicy' {Maybe Text
policy :: Maybe Text
$sel:policy:VaultAccessPolicy' :: VaultAccessPolicy -> Maybe Text
policy} -> Maybe Text
policy) (\s :: VaultAccessPolicy
s@VaultAccessPolicy' {} Maybe Text
a -> VaultAccessPolicy
s {$sel:policy:VaultAccessPolicy' :: Maybe Text
policy = Maybe Text
a} :: VaultAccessPolicy)
instance Core.FromJSON VaultAccessPolicy where
parseJSON :: Value -> Parser VaultAccessPolicy
parseJSON =
String
-> (Object -> Parser VaultAccessPolicy)
-> Value
-> Parser VaultAccessPolicy
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"VaultAccessPolicy"
( \Object
x ->
Maybe Text -> VaultAccessPolicy
VaultAccessPolicy' (Maybe Text -> VaultAccessPolicy)
-> Parser (Maybe Text) -> Parser VaultAccessPolicy
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Policy")
)
instance Prelude.Hashable VaultAccessPolicy
instance Prelude.NFData VaultAccessPolicy
instance Core.ToJSON VaultAccessPolicy where
toJSON :: VaultAccessPolicy -> Value
toJSON VaultAccessPolicy' {Maybe Text
policy :: Maybe Text
$sel:policy:VaultAccessPolicy' :: VaultAccessPolicy -> 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]
)