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