{-# 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.GetVaultAccessPolicy
(
GetVaultAccessPolicy (..),
newGetVaultAccessPolicy,
getVaultAccessPolicy_accountId,
getVaultAccessPolicy_vaultName,
GetVaultAccessPolicyResponse (..),
newGetVaultAccessPolicyResponse,
getVaultAccessPolicyResponse_policy,
getVaultAccessPolicyResponse_httpStatus,
)
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 GetVaultAccessPolicy = GetVaultAccessPolicy'
{
GetVaultAccessPolicy -> Text
accountId :: Prelude.Text,
GetVaultAccessPolicy -> Text
vaultName :: Prelude.Text
}
deriving (GetVaultAccessPolicy -> GetVaultAccessPolicy -> Bool
(GetVaultAccessPolicy -> GetVaultAccessPolicy -> Bool)
-> (GetVaultAccessPolicy -> GetVaultAccessPolicy -> Bool)
-> Eq GetVaultAccessPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetVaultAccessPolicy -> GetVaultAccessPolicy -> Bool
$c/= :: GetVaultAccessPolicy -> GetVaultAccessPolicy -> Bool
== :: GetVaultAccessPolicy -> GetVaultAccessPolicy -> Bool
$c== :: GetVaultAccessPolicy -> GetVaultAccessPolicy -> Bool
Prelude.Eq, ReadPrec [GetVaultAccessPolicy]
ReadPrec GetVaultAccessPolicy
Int -> ReadS GetVaultAccessPolicy
ReadS [GetVaultAccessPolicy]
(Int -> ReadS GetVaultAccessPolicy)
-> ReadS [GetVaultAccessPolicy]
-> ReadPrec GetVaultAccessPolicy
-> ReadPrec [GetVaultAccessPolicy]
-> Read GetVaultAccessPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetVaultAccessPolicy]
$creadListPrec :: ReadPrec [GetVaultAccessPolicy]
readPrec :: ReadPrec GetVaultAccessPolicy
$creadPrec :: ReadPrec GetVaultAccessPolicy
readList :: ReadS [GetVaultAccessPolicy]
$creadList :: ReadS [GetVaultAccessPolicy]
readsPrec :: Int -> ReadS GetVaultAccessPolicy
$creadsPrec :: Int -> ReadS GetVaultAccessPolicy
Prelude.Read, Int -> GetVaultAccessPolicy -> ShowS
[GetVaultAccessPolicy] -> ShowS
GetVaultAccessPolicy -> String
(Int -> GetVaultAccessPolicy -> ShowS)
-> (GetVaultAccessPolicy -> String)
-> ([GetVaultAccessPolicy] -> ShowS)
-> Show GetVaultAccessPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetVaultAccessPolicy] -> ShowS
$cshowList :: [GetVaultAccessPolicy] -> ShowS
show :: GetVaultAccessPolicy -> String
$cshow :: GetVaultAccessPolicy -> String
showsPrec :: Int -> GetVaultAccessPolicy -> ShowS
$cshowsPrec :: Int -> GetVaultAccessPolicy -> ShowS
Prelude.Show, (forall x. GetVaultAccessPolicy -> Rep GetVaultAccessPolicy x)
-> (forall x. Rep GetVaultAccessPolicy x -> GetVaultAccessPolicy)
-> Generic GetVaultAccessPolicy
forall x. Rep GetVaultAccessPolicy x -> GetVaultAccessPolicy
forall x. GetVaultAccessPolicy -> Rep GetVaultAccessPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetVaultAccessPolicy x -> GetVaultAccessPolicy
$cfrom :: forall x. GetVaultAccessPolicy -> Rep GetVaultAccessPolicy x
Prelude.Generic)
newGetVaultAccessPolicy ::
Prelude.Text ->
Prelude.Text ->
GetVaultAccessPolicy
newGetVaultAccessPolicy :: Text -> Text -> GetVaultAccessPolicy
newGetVaultAccessPolicy Text
pAccountId_ Text
pVaultName_ =
GetVaultAccessPolicy' :: Text -> Text -> GetVaultAccessPolicy
GetVaultAccessPolicy'
{ $sel:accountId:GetVaultAccessPolicy' :: Text
accountId = Text
pAccountId_,
$sel:vaultName:GetVaultAccessPolicy' :: Text
vaultName = Text
pVaultName_
}
getVaultAccessPolicy_accountId :: Lens.Lens' GetVaultAccessPolicy Prelude.Text
getVaultAccessPolicy_accountId :: (Text -> f Text) -> GetVaultAccessPolicy -> f GetVaultAccessPolicy
getVaultAccessPolicy_accountId = (GetVaultAccessPolicy -> Text)
-> (GetVaultAccessPolicy -> Text -> GetVaultAccessPolicy)
-> Lens GetVaultAccessPolicy GetVaultAccessPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVaultAccessPolicy' {Text
accountId :: Text
$sel:accountId:GetVaultAccessPolicy' :: GetVaultAccessPolicy -> Text
accountId} -> Text
accountId) (\s :: GetVaultAccessPolicy
s@GetVaultAccessPolicy' {} Text
a -> GetVaultAccessPolicy
s {$sel:accountId:GetVaultAccessPolicy' :: Text
accountId = Text
a} :: GetVaultAccessPolicy)
getVaultAccessPolicy_vaultName :: Lens.Lens' GetVaultAccessPolicy Prelude.Text
getVaultAccessPolicy_vaultName :: (Text -> f Text) -> GetVaultAccessPolicy -> f GetVaultAccessPolicy
getVaultAccessPolicy_vaultName = (GetVaultAccessPolicy -> Text)
-> (GetVaultAccessPolicy -> Text -> GetVaultAccessPolicy)
-> Lens GetVaultAccessPolicy GetVaultAccessPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVaultAccessPolicy' {Text
vaultName :: Text
$sel:vaultName:GetVaultAccessPolicy' :: GetVaultAccessPolicy -> Text
vaultName} -> Text
vaultName) (\s :: GetVaultAccessPolicy
s@GetVaultAccessPolicy' {} Text
a -> GetVaultAccessPolicy
s {$sel:vaultName:GetVaultAccessPolicy' :: Text
vaultName = Text
a} :: GetVaultAccessPolicy)
instance Core.AWSRequest GetVaultAccessPolicy where
type
AWSResponse GetVaultAccessPolicy =
GetVaultAccessPolicyResponse
request :: GetVaultAccessPolicy -> Request GetVaultAccessPolicy
request =
ByteString
-> Request GetVaultAccessPolicy -> Request GetVaultAccessPolicy
forall a. ByteString -> Request a -> Request a
Request.glacierVersionHeader (Service -> ByteString
Core._serviceVersion Service
defaultService)
(Request GetVaultAccessPolicy -> Request GetVaultAccessPolicy)
-> (GetVaultAccessPolicy -> Request GetVaultAccessPolicy)
-> GetVaultAccessPolicy
-> Request GetVaultAccessPolicy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service -> GetVaultAccessPolicy -> Request GetVaultAccessPolicy
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetVaultAccessPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetVaultAccessPolicy)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetVaultAccessPolicy))
-> Logger
-> Service
-> Proxy GetVaultAccessPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetVaultAccessPolicy)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe VaultAccessPolicy -> Int -> GetVaultAccessPolicyResponse
GetVaultAccessPolicyResponse'
(Maybe VaultAccessPolicy -> Int -> GetVaultAccessPolicyResponse)
-> Either String (Maybe VaultAccessPolicy)
-> Either String (Int -> GetVaultAccessPolicyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object -> Either String (Maybe VaultAccessPolicy)
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
Either String (Int -> GetVaultAccessPolicyResponse)
-> Either String Int -> Either String GetVaultAccessPolicyResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetVaultAccessPolicy
instance Prelude.NFData GetVaultAccessPolicy
instance Core.ToHeaders GetVaultAccessPolicy where
toHeaders :: GetVaultAccessPolicy -> ResponseHeaders
toHeaders = ResponseHeaders -> GetVaultAccessPolicy -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetVaultAccessPolicy where
toPath :: GetVaultAccessPolicy -> ByteString
toPath GetVaultAccessPolicy' {Text
vaultName :: Text
accountId :: Text
$sel:vaultName:GetVaultAccessPolicy' :: GetVaultAccessPolicy -> Text
$sel:accountId:GetVaultAccessPolicy' :: GetVaultAccessPolicy -> Text
..} =
[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 GetVaultAccessPolicy where
toQuery :: GetVaultAccessPolicy -> QueryString
toQuery = QueryString -> GetVaultAccessPolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetVaultAccessPolicyResponse = GetVaultAccessPolicyResponse'
{
GetVaultAccessPolicyResponse -> Maybe VaultAccessPolicy
policy :: Prelude.Maybe VaultAccessPolicy,
GetVaultAccessPolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetVaultAccessPolicyResponse
-> GetVaultAccessPolicyResponse -> Bool
(GetVaultAccessPolicyResponse
-> GetVaultAccessPolicyResponse -> Bool)
-> (GetVaultAccessPolicyResponse
-> GetVaultAccessPolicyResponse -> Bool)
-> Eq GetVaultAccessPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetVaultAccessPolicyResponse
-> GetVaultAccessPolicyResponse -> Bool
$c/= :: GetVaultAccessPolicyResponse
-> GetVaultAccessPolicyResponse -> Bool
== :: GetVaultAccessPolicyResponse
-> GetVaultAccessPolicyResponse -> Bool
$c== :: GetVaultAccessPolicyResponse
-> GetVaultAccessPolicyResponse -> Bool
Prelude.Eq, ReadPrec [GetVaultAccessPolicyResponse]
ReadPrec GetVaultAccessPolicyResponse
Int -> ReadS GetVaultAccessPolicyResponse
ReadS [GetVaultAccessPolicyResponse]
(Int -> ReadS GetVaultAccessPolicyResponse)
-> ReadS [GetVaultAccessPolicyResponse]
-> ReadPrec GetVaultAccessPolicyResponse
-> ReadPrec [GetVaultAccessPolicyResponse]
-> Read GetVaultAccessPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetVaultAccessPolicyResponse]
$creadListPrec :: ReadPrec [GetVaultAccessPolicyResponse]
readPrec :: ReadPrec GetVaultAccessPolicyResponse
$creadPrec :: ReadPrec GetVaultAccessPolicyResponse
readList :: ReadS [GetVaultAccessPolicyResponse]
$creadList :: ReadS [GetVaultAccessPolicyResponse]
readsPrec :: Int -> ReadS GetVaultAccessPolicyResponse
$creadsPrec :: Int -> ReadS GetVaultAccessPolicyResponse
Prelude.Read, Int -> GetVaultAccessPolicyResponse -> ShowS
[GetVaultAccessPolicyResponse] -> ShowS
GetVaultAccessPolicyResponse -> String
(Int -> GetVaultAccessPolicyResponse -> ShowS)
-> (GetVaultAccessPolicyResponse -> String)
-> ([GetVaultAccessPolicyResponse] -> ShowS)
-> Show GetVaultAccessPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetVaultAccessPolicyResponse] -> ShowS
$cshowList :: [GetVaultAccessPolicyResponse] -> ShowS
show :: GetVaultAccessPolicyResponse -> String
$cshow :: GetVaultAccessPolicyResponse -> String
showsPrec :: Int -> GetVaultAccessPolicyResponse -> ShowS
$cshowsPrec :: Int -> GetVaultAccessPolicyResponse -> ShowS
Prelude.Show, (forall x.
GetVaultAccessPolicyResponse -> Rep GetVaultAccessPolicyResponse x)
-> (forall x.
Rep GetVaultAccessPolicyResponse x -> GetVaultAccessPolicyResponse)
-> Generic GetVaultAccessPolicyResponse
forall x.
Rep GetVaultAccessPolicyResponse x -> GetVaultAccessPolicyResponse
forall x.
GetVaultAccessPolicyResponse -> Rep GetVaultAccessPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetVaultAccessPolicyResponse x -> GetVaultAccessPolicyResponse
$cfrom :: forall x.
GetVaultAccessPolicyResponse -> Rep GetVaultAccessPolicyResponse x
Prelude.Generic)
newGetVaultAccessPolicyResponse ::
Prelude.Int ->
GetVaultAccessPolicyResponse
newGetVaultAccessPolicyResponse :: Int -> GetVaultAccessPolicyResponse
newGetVaultAccessPolicyResponse Int
pHttpStatus_ =
GetVaultAccessPolicyResponse' :: Maybe VaultAccessPolicy -> Int -> GetVaultAccessPolicyResponse
GetVaultAccessPolicyResponse'
{ $sel:policy:GetVaultAccessPolicyResponse' :: Maybe VaultAccessPolicy
policy =
Maybe VaultAccessPolicy
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetVaultAccessPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getVaultAccessPolicyResponse_policy :: Lens.Lens' GetVaultAccessPolicyResponse (Prelude.Maybe VaultAccessPolicy)
getVaultAccessPolicyResponse_policy :: (Maybe VaultAccessPolicy -> f (Maybe VaultAccessPolicy))
-> GetVaultAccessPolicyResponse -> f GetVaultAccessPolicyResponse
getVaultAccessPolicyResponse_policy = (GetVaultAccessPolicyResponse -> Maybe VaultAccessPolicy)
-> (GetVaultAccessPolicyResponse
-> Maybe VaultAccessPolicy -> GetVaultAccessPolicyResponse)
-> Lens
GetVaultAccessPolicyResponse
GetVaultAccessPolicyResponse
(Maybe VaultAccessPolicy)
(Maybe VaultAccessPolicy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVaultAccessPolicyResponse' {Maybe VaultAccessPolicy
policy :: Maybe VaultAccessPolicy
$sel:policy:GetVaultAccessPolicyResponse' :: GetVaultAccessPolicyResponse -> Maybe VaultAccessPolicy
policy} -> Maybe VaultAccessPolicy
policy) (\s :: GetVaultAccessPolicyResponse
s@GetVaultAccessPolicyResponse' {} Maybe VaultAccessPolicy
a -> GetVaultAccessPolicyResponse
s {$sel:policy:GetVaultAccessPolicyResponse' :: Maybe VaultAccessPolicy
policy = Maybe VaultAccessPolicy
a} :: GetVaultAccessPolicyResponse)
getVaultAccessPolicyResponse_httpStatus :: Lens.Lens' GetVaultAccessPolicyResponse Prelude.Int
getVaultAccessPolicyResponse_httpStatus :: (Int -> f Int)
-> GetVaultAccessPolicyResponse -> f GetVaultAccessPolicyResponse
getVaultAccessPolicyResponse_httpStatus = (GetVaultAccessPolicyResponse -> Int)
-> (GetVaultAccessPolicyResponse
-> Int -> GetVaultAccessPolicyResponse)
-> Lens
GetVaultAccessPolicyResponse GetVaultAccessPolicyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVaultAccessPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetVaultAccessPolicyResponse' :: GetVaultAccessPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetVaultAccessPolicyResponse
s@GetVaultAccessPolicyResponse' {} Int
a -> GetVaultAccessPolicyResponse
s {$sel:httpStatus:GetVaultAccessPolicyResponse' :: Int
httpStatus = Int
a} :: GetVaultAccessPolicyResponse)
instance Prelude.NFData GetVaultAccessPolicyResponse