{-# 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 #-}
module Amazonka.Glacier.SetVaultAccessPolicy
(
SetVaultAccessPolicy (..),
newSetVaultAccessPolicy,
setVaultAccessPolicy_policy,
setVaultAccessPolicy_accountId,
setVaultAccessPolicy_vaultName,
SetVaultAccessPolicyResponse (..),
newSetVaultAccessPolicyResponse,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Glacier.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data SetVaultAccessPolicy = SetVaultAccessPolicy'
{
SetVaultAccessPolicy -> Maybe VaultAccessPolicy
policy :: Prelude.Maybe VaultAccessPolicy,
SetVaultAccessPolicy -> Text
accountId :: Prelude.Text,
SetVaultAccessPolicy -> Text
vaultName :: Prelude.Text
}
deriving (SetVaultAccessPolicy -> SetVaultAccessPolicy -> Bool
(SetVaultAccessPolicy -> SetVaultAccessPolicy -> Bool)
-> (SetVaultAccessPolicy -> SetVaultAccessPolicy -> Bool)
-> Eq SetVaultAccessPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetVaultAccessPolicy -> SetVaultAccessPolicy -> Bool
$c/= :: SetVaultAccessPolicy -> SetVaultAccessPolicy -> Bool
== :: SetVaultAccessPolicy -> SetVaultAccessPolicy -> Bool
$c== :: SetVaultAccessPolicy -> SetVaultAccessPolicy -> Bool
Prelude.Eq, ReadPrec [SetVaultAccessPolicy]
ReadPrec SetVaultAccessPolicy
Int -> ReadS SetVaultAccessPolicy
ReadS [SetVaultAccessPolicy]
(Int -> ReadS SetVaultAccessPolicy)
-> ReadS [SetVaultAccessPolicy]
-> ReadPrec SetVaultAccessPolicy
-> ReadPrec [SetVaultAccessPolicy]
-> Read SetVaultAccessPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetVaultAccessPolicy]
$creadListPrec :: ReadPrec [SetVaultAccessPolicy]
readPrec :: ReadPrec SetVaultAccessPolicy
$creadPrec :: ReadPrec SetVaultAccessPolicy
readList :: ReadS [SetVaultAccessPolicy]
$creadList :: ReadS [SetVaultAccessPolicy]
readsPrec :: Int -> ReadS SetVaultAccessPolicy
$creadsPrec :: Int -> ReadS SetVaultAccessPolicy
Prelude.Read, Int -> SetVaultAccessPolicy -> ShowS
[SetVaultAccessPolicy] -> ShowS
SetVaultAccessPolicy -> String
(Int -> SetVaultAccessPolicy -> ShowS)
-> (SetVaultAccessPolicy -> String)
-> ([SetVaultAccessPolicy] -> ShowS)
-> Show SetVaultAccessPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetVaultAccessPolicy] -> ShowS
$cshowList :: [SetVaultAccessPolicy] -> ShowS
show :: SetVaultAccessPolicy -> String
$cshow :: SetVaultAccessPolicy -> String
showsPrec :: Int -> SetVaultAccessPolicy -> ShowS
$cshowsPrec :: Int -> SetVaultAccessPolicy -> ShowS
Prelude.Show, (forall x. SetVaultAccessPolicy -> Rep SetVaultAccessPolicy x)
-> (forall x. Rep SetVaultAccessPolicy x -> SetVaultAccessPolicy)
-> Generic SetVaultAccessPolicy
forall x. Rep SetVaultAccessPolicy x -> SetVaultAccessPolicy
forall x. SetVaultAccessPolicy -> Rep SetVaultAccessPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SetVaultAccessPolicy x -> SetVaultAccessPolicy
$cfrom :: forall x. SetVaultAccessPolicy -> Rep SetVaultAccessPolicy x
Prelude.Generic)
newSetVaultAccessPolicy ::
Prelude.Text ->
Prelude.Text ->
SetVaultAccessPolicy
newSetVaultAccessPolicy :: Text -> Text -> SetVaultAccessPolicy
newSetVaultAccessPolicy Text
pAccountId_ Text
pVaultName_ =
SetVaultAccessPolicy' :: Maybe VaultAccessPolicy -> Text -> Text -> SetVaultAccessPolicy
SetVaultAccessPolicy'
{ $sel:policy:SetVaultAccessPolicy' :: Maybe VaultAccessPolicy
policy = Maybe VaultAccessPolicy
forall a. Maybe a
Prelude.Nothing,
$sel:accountId:SetVaultAccessPolicy' :: Text
accountId = Text
pAccountId_,
$sel:vaultName:SetVaultAccessPolicy' :: Text
vaultName = Text
pVaultName_
}
setVaultAccessPolicy_policy :: Lens.Lens' SetVaultAccessPolicy (Prelude.Maybe VaultAccessPolicy)
setVaultAccessPolicy_policy :: (Maybe VaultAccessPolicy -> f (Maybe VaultAccessPolicy))
-> SetVaultAccessPolicy -> f SetVaultAccessPolicy
setVaultAccessPolicy_policy = (SetVaultAccessPolicy -> Maybe VaultAccessPolicy)
-> (SetVaultAccessPolicy
-> Maybe VaultAccessPolicy -> SetVaultAccessPolicy)
-> Lens
SetVaultAccessPolicy
SetVaultAccessPolicy
(Maybe VaultAccessPolicy)
(Maybe VaultAccessPolicy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetVaultAccessPolicy' {Maybe VaultAccessPolicy
policy :: Maybe VaultAccessPolicy
$sel:policy:SetVaultAccessPolicy' :: SetVaultAccessPolicy -> Maybe VaultAccessPolicy
policy} -> Maybe VaultAccessPolicy
policy) (\s :: SetVaultAccessPolicy
s@SetVaultAccessPolicy' {} Maybe VaultAccessPolicy
a -> SetVaultAccessPolicy
s {$sel:policy:SetVaultAccessPolicy' :: Maybe VaultAccessPolicy
policy = Maybe VaultAccessPolicy
a} :: SetVaultAccessPolicy)
setVaultAccessPolicy_accountId :: Lens.Lens' SetVaultAccessPolicy Prelude.Text
setVaultAccessPolicy_accountId :: (Text -> f Text) -> SetVaultAccessPolicy -> f SetVaultAccessPolicy
setVaultAccessPolicy_accountId = (SetVaultAccessPolicy -> Text)
-> (SetVaultAccessPolicy -> Text -> SetVaultAccessPolicy)
-> Lens SetVaultAccessPolicy SetVaultAccessPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetVaultAccessPolicy' {Text
accountId :: Text
$sel:accountId:SetVaultAccessPolicy' :: SetVaultAccessPolicy -> Text
accountId} -> Text
accountId) (\s :: SetVaultAccessPolicy
s@SetVaultAccessPolicy' {} Text
a -> SetVaultAccessPolicy
s {$sel:accountId:SetVaultAccessPolicy' :: Text
accountId = Text
a} :: SetVaultAccessPolicy)
setVaultAccessPolicy_vaultName :: Lens.Lens' SetVaultAccessPolicy Prelude.Text
setVaultAccessPolicy_vaultName :: (Text -> f Text) -> SetVaultAccessPolicy -> f SetVaultAccessPolicy
setVaultAccessPolicy_vaultName = (SetVaultAccessPolicy -> Text)
-> (SetVaultAccessPolicy -> Text -> SetVaultAccessPolicy)
-> Lens SetVaultAccessPolicy SetVaultAccessPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetVaultAccessPolicy' {Text
vaultName :: Text
$sel:vaultName:SetVaultAccessPolicy' :: SetVaultAccessPolicy -> Text
vaultName} -> Text
vaultName) (\s :: SetVaultAccessPolicy
s@SetVaultAccessPolicy' {} Text
a -> SetVaultAccessPolicy
s {$sel:vaultName:SetVaultAccessPolicy' :: Text
vaultName = Text
a} :: SetVaultAccessPolicy)
instance Core.AWSRequest SetVaultAccessPolicy where
type
AWSResponse SetVaultAccessPolicy =
SetVaultAccessPolicyResponse
request :: SetVaultAccessPolicy -> Request SetVaultAccessPolicy
request =
ByteString
-> Request SetVaultAccessPolicy -> Request SetVaultAccessPolicy
forall a. ByteString -> Request a -> Request a
Request.glacierVersionHeader (Service -> ByteString
Core._serviceVersion Service
defaultService)
(Request SetVaultAccessPolicy -> Request SetVaultAccessPolicy)
-> (SetVaultAccessPolicy -> Request SetVaultAccessPolicy)
-> SetVaultAccessPolicy
-> Request SetVaultAccessPolicy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service -> SetVaultAccessPolicy -> Request SetVaultAccessPolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy SetVaultAccessPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SetVaultAccessPolicy)))
response =
AWSResponse SetVaultAccessPolicy
-> Logger
-> Service
-> Proxy SetVaultAccessPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SetVaultAccessPolicy)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse SetVaultAccessPolicy
SetVaultAccessPolicyResponse
SetVaultAccessPolicyResponse'
instance Prelude.Hashable SetVaultAccessPolicy
instance Prelude.NFData SetVaultAccessPolicy
instance Core.ToHeaders SetVaultAccessPolicy where
toHeaders :: SetVaultAccessPolicy -> [Header]
toHeaders = [Header] -> SetVaultAccessPolicy -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON SetVaultAccessPolicy where
toJSON :: SetVaultAccessPolicy -> Value
toJSON SetVaultAccessPolicy' {Maybe VaultAccessPolicy
Text
vaultName :: Text
accountId :: Text
policy :: Maybe VaultAccessPolicy
$sel:vaultName:SetVaultAccessPolicy' :: SetVaultAccessPolicy -> Text
$sel:accountId:SetVaultAccessPolicy' :: SetVaultAccessPolicy -> Text
$sel:policy:SetVaultAccessPolicy' :: SetVaultAccessPolicy -> Maybe VaultAccessPolicy
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"policy" Text -> VaultAccessPolicy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (VaultAccessPolicy -> Pair)
-> Maybe VaultAccessPolicy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VaultAccessPolicy
policy]
)
instance Core.ToPath SetVaultAccessPolicy where
toPath :: SetVaultAccessPolicy -> ByteString
toPath SetVaultAccessPolicy' {Maybe VaultAccessPolicy
Text
vaultName :: Text
accountId :: Text
policy :: Maybe VaultAccessPolicy
$sel:vaultName:SetVaultAccessPolicy' :: SetVaultAccessPolicy -> Text
$sel:accountId:SetVaultAccessPolicy' :: SetVaultAccessPolicy -> Text
$sel:policy:SetVaultAccessPolicy' :: SetVaultAccessPolicy -> Maybe VaultAccessPolicy
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
accountId,
ByteString
"/vaults/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
vaultName,
ByteString
"/access-policy"
]
instance Core.ToQuery SetVaultAccessPolicy where
toQuery :: SetVaultAccessPolicy -> QueryString
toQuery = QueryString -> SetVaultAccessPolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data SetVaultAccessPolicyResponse = SetVaultAccessPolicyResponse'
{
}
deriving (SetVaultAccessPolicyResponse
-> SetVaultAccessPolicyResponse -> Bool
(SetVaultAccessPolicyResponse
-> SetVaultAccessPolicyResponse -> Bool)
-> (SetVaultAccessPolicyResponse
-> SetVaultAccessPolicyResponse -> Bool)
-> Eq SetVaultAccessPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetVaultAccessPolicyResponse
-> SetVaultAccessPolicyResponse -> Bool
$c/= :: SetVaultAccessPolicyResponse
-> SetVaultAccessPolicyResponse -> Bool
== :: SetVaultAccessPolicyResponse
-> SetVaultAccessPolicyResponse -> Bool
$c== :: SetVaultAccessPolicyResponse
-> SetVaultAccessPolicyResponse -> Bool
Prelude.Eq, ReadPrec [SetVaultAccessPolicyResponse]
ReadPrec SetVaultAccessPolicyResponse
Int -> ReadS SetVaultAccessPolicyResponse
ReadS [SetVaultAccessPolicyResponse]
(Int -> ReadS SetVaultAccessPolicyResponse)
-> ReadS [SetVaultAccessPolicyResponse]
-> ReadPrec SetVaultAccessPolicyResponse
-> ReadPrec [SetVaultAccessPolicyResponse]
-> Read SetVaultAccessPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetVaultAccessPolicyResponse]
$creadListPrec :: ReadPrec [SetVaultAccessPolicyResponse]
readPrec :: ReadPrec SetVaultAccessPolicyResponse
$creadPrec :: ReadPrec SetVaultAccessPolicyResponse
readList :: ReadS [SetVaultAccessPolicyResponse]
$creadList :: ReadS [SetVaultAccessPolicyResponse]
readsPrec :: Int -> ReadS SetVaultAccessPolicyResponse
$creadsPrec :: Int -> ReadS SetVaultAccessPolicyResponse
Prelude.Read, Int -> SetVaultAccessPolicyResponse -> ShowS
[SetVaultAccessPolicyResponse] -> ShowS
SetVaultAccessPolicyResponse -> String
(Int -> SetVaultAccessPolicyResponse -> ShowS)
-> (SetVaultAccessPolicyResponse -> String)
-> ([SetVaultAccessPolicyResponse] -> ShowS)
-> Show SetVaultAccessPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetVaultAccessPolicyResponse] -> ShowS
$cshowList :: [SetVaultAccessPolicyResponse] -> ShowS
show :: SetVaultAccessPolicyResponse -> String
$cshow :: SetVaultAccessPolicyResponse -> String
showsPrec :: Int -> SetVaultAccessPolicyResponse -> ShowS
$cshowsPrec :: Int -> SetVaultAccessPolicyResponse -> ShowS
Prelude.Show, (forall x.
SetVaultAccessPolicyResponse -> Rep SetVaultAccessPolicyResponse x)
-> (forall x.
Rep SetVaultAccessPolicyResponse x -> SetVaultAccessPolicyResponse)
-> Generic SetVaultAccessPolicyResponse
forall x.
Rep SetVaultAccessPolicyResponse x -> SetVaultAccessPolicyResponse
forall x.
SetVaultAccessPolicyResponse -> Rep SetVaultAccessPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SetVaultAccessPolicyResponse x -> SetVaultAccessPolicyResponse
$cfrom :: forall x.
SetVaultAccessPolicyResponse -> Rep SetVaultAccessPolicyResponse x
Prelude.Generic)
newSetVaultAccessPolicyResponse ::
SetVaultAccessPolicyResponse
newSetVaultAccessPolicyResponse :: SetVaultAccessPolicyResponse
newSetVaultAccessPolicyResponse =
SetVaultAccessPolicyResponse
SetVaultAccessPolicyResponse'
instance Prelude.NFData SetVaultAccessPolicyResponse