{-# 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.DescribeJob
(
DescribeJob (..),
newDescribeJob,
describeJob_accountId,
describeJob_vaultName,
describeJob_jobId,
GlacierJobDescription (..),
newGlacierJobDescription,
glacierJobDescription_sHA256TreeHash,
glacierJobDescription_archiveId,
glacierJobDescription_selectParameters,
glacierJobDescription_jobId,
glacierJobDescription_jobOutputPath,
glacierJobDescription_retrievalByteRange,
glacierJobDescription_inventoryRetrievalParameters,
glacierJobDescription_action,
glacierJobDescription_jobDescription,
glacierJobDescription_sNSTopic,
glacierJobDescription_statusMessage,
glacierJobDescription_vaultARN,
glacierJobDescription_outputLocation,
glacierJobDescription_tier,
glacierJobDescription_archiveSHA256TreeHash,
glacierJobDescription_creationDate,
glacierJobDescription_completed,
glacierJobDescription_completionDate,
glacierJobDescription_inventorySizeInBytes,
glacierJobDescription_archiveSizeInBytes,
glacierJobDescription_statusCode,
)
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 DescribeJob = DescribeJob'
{
DescribeJob -> Text
accountId :: Prelude.Text,
DescribeJob -> Text
vaultName :: Prelude.Text,
DescribeJob -> Text
jobId :: Prelude.Text
}
deriving (DescribeJob -> DescribeJob -> Bool
(DescribeJob -> DescribeJob -> Bool)
-> (DescribeJob -> DescribeJob -> Bool) -> Eq DescribeJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeJob -> DescribeJob -> Bool
$c/= :: DescribeJob -> DescribeJob -> Bool
== :: DescribeJob -> DescribeJob -> Bool
$c== :: DescribeJob -> DescribeJob -> Bool
Prelude.Eq, ReadPrec [DescribeJob]
ReadPrec DescribeJob
Int -> ReadS DescribeJob
ReadS [DescribeJob]
(Int -> ReadS DescribeJob)
-> ReadS [DescribeJob]
-> ReadPrec DescribeJob
-> ReadPrec [DescribeJob]
-> Read DescribeJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeJob]
$creadListPrec :: ReadPrec [DescribeJob]
readPrec :: ReadPrec DescribeJob
$creadPrec :: ReadPrec DescribeJob
readList :: ReadS [DescribeJob]
$creadList :: ReadS [DescribeJob]
readsPrec :: Int -> ReadS DescribeJob
$creadsPrec :: Int -> ReadS DescribeJob
Prelude.Read, Int -> DescribeJob -> ShowS
[DescribeJob] -> ShowS
DescribeJob -> String
(Int -> DescribeJob -> ShowS)
-> (DescribeJob -> String)
-> ([DescribeJob] -> ShowS)
-> Show DescribeJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeJob] -> ShowS
$cshowList :: [DescribeJob] -> ShowS
show :: DescribeJob -> String
$cshow :: DescribeJob -> String
showsPrec :: Int -> DescribeJob -> ShowS
$cshowsPrec :: Int -> DescribeJob -> ShowS
Prelude.Show, (forall x. DescribeJob -> Rep DescribeJob x)
-> (forall x. Rep DescribeJob x -> DescribeJob)
-> Generic DescribeJob
forall x. Rep DescribeJob x -> DescribeJob
forall x. DescribeJob -> Rep DescribeJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeJob x -> DescribeJob
$cfrom :: forall x. DescribeJob -> Rep DescribeJob x
Prelude.Generic)
newDescribeJob ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
DescribeJob
newDescribeJob :: Text -> Text -> Text -> DescribeJob
newDescribeJob Text
pAccountId_ Text
pVaultName_ Text
pJobId_ =
DescribeJob' :: Text -> Text -> Text -> DescribeJob
DescribeJob'
{ $sel:accountId:DescribeJob' :: Text
accountId = Text
pAccountId_,
$sel:vaultName:DescribeJob' :: Text
vaultName = Text
pVaultName_,
$sel:jobId:DescribeJob' :: Text
jobId = Text
pJobId_
}
describeJob_accountId :: Lens.Lens' DescribeJob Prelude.Text
describeJob_accountId :: (Text -> f Text) -> DescribeJob -> f DescribeJob
describeJob_accountId = (DescribeJob -> Text)
-> (DescribeJob -> Text -> DescribeJob)
-> Lens DescribeJob DescribeJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJob' {Text
accountId :: Text
$sel:accountId:DescribeJob' :: DescribeJob -> Text
accountId} -> Text
accountId) (\s :: DescribeJob
s@DescribeJob' {} Text
a -> DescribeJob
s {$sel:accountId:DescribeJob' :: Text
accountId = Text
a} :: DescribeJob)
describeJob_vaultName :: Lens.Lens' DescribeJob Prelude.Text
describeJob_vaultName :: (Text -> f Text) -> DescribeJob -> f DescribeJob
describeJob_vaultName = (DescribeJob -> Text)
-> (DescribeJob -> Text -> DescribeJob)
-> Lens DescribeJob DescribeJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJob' {Text
vaultName :: Text
$sel:vaultName:DescribeJob' :: DescribeJob -> Text
vaultName} -> Text
vaultName) (\s :: DescribeJob
s@DescribeJob' {} Text
a -> DescribeJob
s {$sel:vaultName:DescribeJob' :: Text
vaultName = Text
a} :: DescribeJob)
describeJob_jobId :: Lens.Lens' DescribeJob Prelude.Text
describeJob_jobId :: (Text -> f Text) -> DescribeJob -> f DescribeJob
describeJob_jobId = (DescribeJob -> Text)
-> (DescribeJob -> Text -> DescribeJob)
-> Lens DescribeJob DescribeJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJob' {Text
jobId :: Text
$sel:jobId:DescribeJob' :: DescribeJob -> Text
jobId} -> Text
jobId) (\s :: DescribeJob
s@DescribeJob' {} Text
a -> DescribeJob
s {$sel:jobId:DescribeJob' :: Text
jobId = Text
a} :: DescribeJob)
instance Core.AWSRequest DescribeJob where
type AWSResponse DescribeJob = GlacierJobDescription
request :: DescribeJob -> Request DescribeJob
request =
ByteString -> Request DescribeJob -> Request DescribeJob
forall a. ByteString -> Request a -> Request a
Request.glacierVersionHeader (Service -> ByteString
Core._serviceVersion Service
defaultService)
(Request DescribeJob -> Request DescribeJob)
-> (DescribeJob -> Request DescribeJob)
-> DescribeJob
-> Request DescribeJob
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service -> DescribeJob -> Request DescribeJob
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeJob)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeJob))
-> Logger
-> Service
-> Proxy DescribeJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeJob)))
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 -> Object -> Either String GlacierJobDescription
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable DescribeJob
instance Prelude.NFData DescribeJob
instance Core.ToHeaders DescribeJob where
toHeaders :: DescribeJob -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeJob -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath DescribeJob where
toPath :: DescribeJob -> ByteString
toPath DescribeJob' {Text
jobId :: Text
vaultName :: Text
accountId :: Text
$sel:jobId:DescribeJob' :: DescribeJob -> Text
$sel:vaultName:DescribeJob' :: DescribeJob -> Text
$sel:accountId:DescribeJob' :: DescribeJob -> 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
"/jobs/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
jobId
]
instance Core.ToQuery DescribeJob where
toQuery :: DescribeJob -> QueryString
toQuery = QueryString -> DescribeJob -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty