{-# 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.GetVaultLock
(
GetVaultLock (..),
newGetVaultLock,
getVaultLock_accountId,
getVaultLock_vaultName,
GetVaultLockResponse (..),
newGetVaultLockResponse,
getVaultLockResponse_state,
getVaultLockResponse_expirationDate,
getVaultLockResponse_creationDate,
getVaultLockResponse_policy,
getVaultLockResponse_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 GetVaultLock = GetVaultLock'
{
GetVaultLock -> Text
accountId :: Prelude.Text,
GetVaultLock -> Text
vaultName :: Prelude.Text
}
deriving (GetVaultLock -> GetVaultLock -> Bool
(GetVaultLock -> GetVaultLock -> Bool)
-> (GetVaultLock -> GetVaultLock -> Bool) -> Eq GetVaultLock
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetVaultLock -> GetVaultLock -> Bool
$c/= :: GetVaultLock -> GetVaultLock -> Bool
== :: GetVaultLock -> GetVaultLock -> Bool
$c== :: GetVaultLock -> GetVaultLock -> Bool
Prelude.Eq, ReadPrec [GetVaultLock]
ReadPrec GetVaultLock
Int -> ReadS GetVaultLock
ReadS [GetVaultLock]
(Int -> ReadS GetVaultLock)
-> ReadS [GetVaultLock]
-> ReadPrec GetVaultLock
-> ReadPrec [GetVaultLock]
-> Read GetVaultLock
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetVaultLock]
$creadListPrec :: ReadPrec [GetVaultLock]
readPrec :: ReadPrec GetVaultLock
$creadPrec :: ReadPrec GetVaultLock
readList :: ReadS [GetVaultLock]
$creadList :: ReadS [GetVaultLock]
readsPrec :: Int -> ReadS GetVaultLock
$creadsPrec :: Int -> ReadS GetVaultLock
Prelude.Read, Int -> GetVaultLock -> ShowS
[GetVaultLock] -> ShowS
GetVaultLock -> String
(Int -> GetVaultLock -> ShowS)
-> (GetVaultLock -> String)
-> ([GetVaultLock] -> ShowS)
-> Show GetVaultLock
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetVaultLock] -> ShowS
$cshowList :: [GetVaultLock] -> ShowS
show :: GetVaultLock -> String
$cshow :: GetVaultLock -> String
showsPrec :: Int -> GetVaultLock -> ShowS
$cshowsPrec :: Int -> GetVaultLock -> ShowS
Prelude.Show, (forall x. GetVaultLock -> Rep GetVaultLock x)
-> (forall x. Rep GetVaultLock x -> GetVaultLock)
-> Generic GetVaultLock
forall x. Rep GetVaultLock x -> GetVaultLock
forall x. GetVaultLock -> Rep GetVaultLock x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetVaultLock x -> GetVaultLock
$cfrom :: forall x. GetVaultLock -> Rep GetVaultLock x
Prelude.Generic)
newGetVaultLock ::
Prelude.Text ->
Prelude.Text ->
GetVaultLock
newGetVaultLock :: Text -> Text -> GetVaultLock
newGetVaultLock Text
pAccountId_ Text
pVaultName_ =
GetVaultLock' :: Text -> Text -> GetVaultLock
GetVaultLock'
{ $sel:accountId:GetVaultLock' :: Text
accountId = Text
pAccountId_,
$sel:vaultName:GetVaultLock' :: Text
vaultName = Text
pVaultName_
}
getVaultLock_accountId :: Lens.Lens' GetVaultLock Prelude.Text
getVaultLock_accountId :: (Text -> f Text) -> GetVaultLock -> f GetVaultLock
getVaultLock_accountId = (GetVaultLock -> Text)
-> (GetVaultLock -> Text -> GetVaultLock)
-> Lens GetVaultLock GetVaultLock Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVaultLock' {Text
accountId :: Text
$sel:accountId:GetVaultLock' :: GetVaultLock -> Text
accountId} -> Text
accountId) (\s :: GetVaultLock
s@GetVaultLock' {} Text
a -> GetVaultLock
s {$sel:accountId:GetVaultLock' :: Text
accountId = Text
a} :: GetVaultLock)
getVaultLock_vaultName :: Lens.Lens' GetVaultLock Prelude.Text
getVaultLock_vaultName :: (Text -> f Text) -> GetVaultLock -> f GetVaultLock
getVaultLock_vaultName = (GetVaultLock -> Text)
-> (GetVaultLock -> Text -> GetVaultLock)
-> Lens GetVaultLock GetVaultLock Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVaultLock' {Text
vaultName :: Text
$sel:vaultName:GetVaultLock' :: GetVaultLock -> Text
vaultName} -> Text
vaultName) (\s :: GetVaultLock
s@GetVaultLock' {} Text
a -> GetVaultLock
s {$sel:vaultName:GetVaultLock' :: Text
vaultName = Text
a} :: GetVaultLock)
instance Core.AWSRequest GetVaultLock where
type AWSResponse GetVaultLock = GetVaultLockResponse
request :: GetVaultLock -> Request GetVaultLock
request =
ByteString -> Request GetVaultLock -> Request GetVaultLock
forall a. ByteString -> Request a -> Request a
Request.glacierVersionHeader (Service -> ByteString
Core._serviceVersion Service
defaultService)
(Request GetVaultLock -> Request GetVaultLock)
-> (GetVaultLock -> Request GetVaultLock)
-> GetVaultLock
-> Request GetVaultLock
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service -> GetVaultLock -> Request GetVaultLock
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetVaultLock
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetVaultLock)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetVaultLock))
-> Logger
-> Service
-> Proxy GetVaultLock
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetVaultLock)))
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 Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> GetVaultLockResponse
GetVaultLockResponse'
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> GetVaultLockResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe Text
-> Maybe Text -> Maybe Text -> Int -> GetVaultLockResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"State")
Either
String
(Maybe Text
-> Maybe Text -> Maybe Text -> Int -> GetVaultLockResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe Text -> Maybe Text -> Int -> GetVaultLockResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ExpirationDate")
Either
String (Maybe Text -> Maybe Text -> Int -> GetVaultLockResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> GetVaultLockResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CreationDate")
Either String (Maybe Text -> Int -> GetVaultLockResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetVaultLockResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Policy")
Either String (Int -> GetVaultLockResponse)
-> Either String Int -> Either String GetVaultLockResponse
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 GetVaultLock
instance Prelude.NFData GetVaultLock
instance Core.ToHeaders GetVaultLock where
toHeaders :: GetVaultLock -> ResponseHeaders
toHeaders = ResponseHeaders -> GetVaultLock -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetVaultLock where
toPath :: GetVaultLock -> ByteString
toPath GetVaultLock' {Text
vaultName :: Text
accountId :: Text
$sel:vaultName:GetVaultLock' :: GetVaultLock -> Text
$sel:accountId:GetVaultLock' :: GetVaultLock -> 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
"/lock-policy"
]
instance Core.ToQuery GetVaultLock where
toQuery :: GetVaultLock -> QueryString
toQuery = QueryString -> GetVaultLock -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetVaultLockResponse = GetVaultLockResponse'
{
GetVaultLockResponse -> Maybe Text
state :: Prelude.Maybe Prelude.Text,
GetVaultLockResponse -> Maybe Text
expirationDate :: Prelude.Maybe Prelude.Text,
GetVaultLockResponse -> Maybe Text
creationDate :: Prelude.Maybe Prelude.Text,
GetVaultLockResponse -> Maybe Text
policy :: Prelude.Maybe Prelude.Text,
GetVaultLockResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetVaultLockResponse -> GetVaultLockResponse -> Bool
(GetVaultLockResponse -> GetVaultLockResponse -> Bool)
-> (GetVaultLockResponse -> GetVaultLockResponse -> Bool)
-> Eq GetVaultLockResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetVaultLockResponse -> GetVaultLockResponse -> Bool
$c/= :: GetVaultLockResponse -> GetVaultLockResponse -> Bool
== :: GetVaultLockResponse -> GetVaultLockResponse -> Bool
$c== :: GetVaultLockResponse -> GetVaultLockResponse -> Bool
Prelude.Eq, ReadPrec [GetVaultLockResponse]
ReadPrec GetVaultLockResponse
Int -> ReadS GetVaultLockResponse
ReadS [GetVaultLockResponse]
(Int -> ReadS GetVaultLockResponse)
-> ReadS [GetVaultLockResponse]
-> ReadPrec GetVaultLockResponse
-> ReadPrec [GetVaultLockResponse]
-> Read GetVaultLockResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetVaultLockResponse]
$creadListPrec :: ReadPrec [GetVaultLockResponse]
readPrec :: ReadPrec GetVaultLockResponse
$creadPrec :: ReadPrec GetVaultLockResponse
readList :: ReadS [GetVaultLockResponse]
$creadList :: ReadS [GetVaultLockResponse]
readsPrec :: Int -> ReadS GetVaultLockResponse
$creadsPrec :: Int -> ReadS GetVaultLockResponse
Prelude.Read, Int -> GetVaultLockResponse -> ShowS
[GetVaultLockResponse] -> ShowS
GetVaultLockResponse -> String
(Int -> GetVaultLockResponse -> ShowS)
-> (GetVaultLockResponse -> String)
-> ([GetVaultLockResponse] -> ShowS)
-> Show GetVaultLockResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetVaultLockResponse] -> ShowS
$cshowList :: [GetVaultLockResponse] -> ShowS
show :: GetVaultLockResponse -> String
$cshow :: GetVaultLockResponse -> String
showsPrec :: Int -> GetVaultLockResponse -> ShowS
$cshowsPrec :: Int -> GetVaultLockResponse -> ShowS
Prelude.Show, (forall x. GetVaultLockResponse -> Rep GetVaultLockResponse x)
-> (forall x. Rep GetVaultLockResponse x -> GetVaultLockResponse)
-> Generic GetVaultLockResponse
forall x. Rep GetVaultLockResponse x -> GetVaultLockResponse
forall x. GetVaultLockResponse -> Rep GetVaultLockResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetVaultLockResponse x -> GetVaultLockResponse
$cfrom :: forall x. GetVaultLockResponse -> Rep GetVaultLockResponse x
Prelude.Generic)
newGetVaultLockResponse ::
Prelude.Int ->
GetVaultLockResponse
newGetVaultLockResponse :: Int -> GetVaultLockResponse
newGetVaultLockResponse Int
pHttpStatus_ =
GetVaultLockResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> GetVaultLockResponse
GetVaultLockResponse'
{ $sel:state:GetVaultLockResponse' :: Maybe Text
state = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:expirationDate:GetVaultLockResponse' :: Maybe Text
expirationDate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:creationDate:GetVaultLockResponse' :: Maybe Text
creationDate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:policy:GetVaultLockResponse' :: Maybe Text
policy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetVaultLockResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getVaultLockResponse_state :: Lens.Lens' GetVaultLockResponse (Prelude.Maybe Prelude.Text)
getVaultLockResponse_state :: (Maybe Text -> f (Maybe Text))
-> GetVaultLockResponse -> f GetVaultLockResponse
getVaultLockResponse_state = (GetVaultLockResponse -> Maybe Text)
-> (GetVaultLockResponse -> Maybe Text -> GetVaultLockResponse)
-> Lens
GetVaultLockResponse GetVaultLockResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVaultLockResponse' {Maybe Text
state :: Maybe Text
$sel:state:GetVaultLockResponse' :: GetVaultLockResponse -> Maybe Text
state} -> Maybe Text
state) (\s :: GetVaultLockResponse
s@GetVaultLockResponse' {} Maybe Text
a -> GetVaultLockResponse
s {$sel:state:GetVaultLockResponse' :: Maybe Text
state = Maybe Text
a} :: GetVaultLockResponse)
getVaultLockResponse_expirationDate :: Lens.Lens' GetVaultLockResponse (Prelude.Maybe Prelude.Text)
getVaultLockResponse_expirationDate :: (Maybe Text -> f (Maybe Text))
-> GetVaultLockResponse -> f GetVaultLockResponse
getVaultLockResponse_expirationDate = (GetVaultLockResponse -> Maybe Text)
-> (GetVaultLockResponse -> Maybe Text -> GetVaultLockResponse)
-> Lens
GetVaultLockResponse GetVaultLockResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVaultLockResponse' {Maybe Text
expirationDate :: Maybe Text
$sel:expirationDate:GetVaultLockResponse' :: GetVaultLockResponse -> Maybe Text
expirationDate} -> Maybe Text
expirationDate) (\s :: GetVaultLockResponse
s@GetVaultLockResponse' {} Maybe Text
a -> GetVaultLockResponse
s {$sel:expirationDate:GetVaultLockResponse' :: Maybe Text
expirationDate = Maybe Text
a} :: GetVaultLockResponse)
getVaultLockResponse_creationDate :: Lens.Lens' GetVaultLockResponse (Prelude.Maybe Prelude.Text)
getVaultLockResponse_creationDate :: (Maybe Text -> f (Maybe Text))
-> GetVaultLockResponse -> f GetVaultLockResponse
getVaultLockResponse_creationDate = (GetVaultLockResponse -> Maybe Text)
-> (GetVaultLockResponse -> Maybe Text -> GetVaultLockResponse)
-> Lens
GetVaultLockResponse GetVaultLockResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVaultLockResponse' {Maybe Text
creationDate :: Maybe Text
$sel:creationDate:GetVaultLockResponse' :: GetVaultLockResponse -> Maybe Text
creationDate} -> Maybe Text
creationDate) (\s :: GetVaultLockResponse
s@GetVaultLockResponse' {} Maybe Text
a -> GetVaultLockResponse
s {$sel:creationDate:GetVaultLockResponse' :: Maybe Text
creationDate = Maybe Text
a} :: GetVaultLockResponse)
getVaultLockResponse_policy :: Lens.Lens' GetVaultLockResponse (Prelude.Maybe Prelude.Text)
getVaultLockResponse_policy :: (Maybe Text -> f (Maybe Text))
-> GetVaultLockResponse -> f GetVaultLockResponse
getVaultLockResponse_policy = (GetVaultLockResponse -> Maybe Text)
-> (GetVaultLockResponse -> Maybe Text -> GetVaultLockResponse)
-> Lens
GetVaultLockResponse GetVaultLockResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVaultLockResponse' {Maybe Text
policy :: Maybe Text
$sel:policy:GetVaultLockResponse' :: GetVaultLockResponse -> Maybe Text
policy} -> Maybe Text
policy) (\s :: GetVaultLockResponse
s@GetVaultLockResponse' {} Maybe Text
a -> GetVaultLockResponse
s {$sel:policy:GetVaultLockResponse' :: Maybe Text
policy = Maybe Text
a} :: GetVaultLockResponse)
getVaultLockResponse_httpStatus :: Lens.Lens' GetVaultLockResponse Prelude.Int
getVaultLockResponse_httpStatus :: (Int -> f Int) -> GetVaultLockResponse -> f GetVaultLockResponse
getVaultLockResponse_httpStatus = (GetVaultLockResponse -> Int)
-> (GetVaultLockResponse -> Int -> GetVaultLockResponse)
-> Lens GetVaultLockResponse GetVaultLockResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVaultLockResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetVaultLockResponse' :: GetVaultLockResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetVaultLockResponse
s@GetVaultLockResponse' {} Int
a -> GetVaultLockResponse
s {$sel:httpStatus:GetVaultLockResponse' :: Int
httpStatus = Int
a} :: GetVaultLockResponse)
instance Prelude.NFData GetVaultLockResponse