{-# 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.UploadMultipartPart
(
UploadMultipartPart (..),
newUploadMultipartPart,
uploadMultipartPart_accountId,
uploadMultipartPart_vaultName,
uploadMultipartPart_uploadId,
uploadMultipartPart_range,
uploadMultipartPart_checksum,
uploadMultipartPart_body,
UploadMultipartPartResponse (..),
newUploadMultipartPartResponse,
uploadMultipartPartResponse_checksum,
uploadMultipartPartResponse_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 UploadMultipartPart = UploadMultipartPart'
{
UploadMultipartPart -> Text
accountId :: Prelude.Text,
UploadMultipartPart -> Text
vaultName :: Prelude.Text,
UploadMultipartPart -> Text
uploadId :: Prelude.Text,
UploadMultipartPart -> Text
range :: Prelude.Text,
UploadMultipartPart -> Text
checksum :: Prelude.Text,
UploadMultipartPart -> HashedBody
body :: Core.HashedBody
}
deriving (Int -> UploadMultipartPart -> ShowS
[UploadMultipartPart] -> ShowS
UploadMultipartPart -> String
(Int -> UploadMultipartPart -> ShowS)
-> (UploadMultipartPart -> String)
-> ([UploadMultipartPart] -> ShowS)
-> Show UploadMultipartPart
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UploadMultipartPart] -> ShowS
$cshowList :: [UploadMultipartPart] -> ShowS
show :: UploadMultipartPart -> String
$cshow :: UploadMultipartPart -> String
showsPrec :: Int -> UploadMultipartPart -> ShowS
$cshowsPrec :: Int -> UploadMultipartPart -> ShowS
Prelude.Show, (forall x. UploadMultipartPart -> Rep UploadMultipartPart x)
-> (forall x. Rep UploadMultipartPart x -> UploadMultipartPart)
-> Generic UploadMultipartPart
forall x. Rep UploadMultipartPart x -> UploadMultipartPart
forall x. UploadMultipartPart -> Rep UploadMultipartPart x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UploadMultipartPart x -> UploadMultipartPart
$cfrom :: forall x. UploadMultipartPart -> Rep UploadMultipartPart x
Prelude.Generic)
newUploadMultipartPart ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Core.HashedBody ->
UploadMultipartPart
newUploadMultipartPart :: Text
-> Text
-> Text
-> Text
-> Text
-> HashedBody
-> UploadMultipartPart
newUploadMultipartPart
Text
pAccountId_
Text
pVaultName_
Text
pUploadId_
Text
pRange_
Text
pChecksum_
HashedBody
pBody_ =
UploadMultipartPart' :: Text
-> Text
-> Text
-> Text
-> Text
-> HashedBody
-> UploadMultipartPart
UploadMultipartPart'
{ $sel:accountId:UploadMultipartPart' :: Text
accountId = Text
pAccountId_,
$sel:vaultName:UploadMultipartPart' :: Text
vaultName = Text
pVaultName_,
$sel:uploadId:UploadMultipartPart' :: Text
uploadId = Text
pUploadId_,
$sel:range:UploadMultipartPart' :: Text
range = Text
pRange_,
$sel:checksum:UploadMultipartPart' :: Text
checksum = Text
pChecksum_,
$sel:body:UploadMultipartPart' :: HashedBody
body = HashedBody
pBody_
}
uploadMultipartPart_accountId :: Lens.Lens' UploadMultipartPart Prelude.Text
uploadMultipartPart_accountId :: (Text -> f Text) -> UploadMultipartPart -> f UploadMultipartPart
uploadMultipartPart_accountId = (UploadMultipartPart -> Text)
-> (UploadMultipartPart -> Text -> UploadMultipartPart)
-> Lens UploadMultipartPart UploadMultipartPart Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadMultipartPart' {Text
accountId :: Text
$sel:accountId:UploadMultipartPart' :: UploadMultipartPart -> Text
accountId} -> Text
accountId) (\s :: UploadMultipartPart
s@UploadMultipartPart' {} Text
a -> UploadMultipartPart
s {$sel:accountId:UploadMultipartPart' :: Text
accountId = Text
a} :: UploadMultipartPart)
uploadMultipartPart_vaultName :: Lens.Lens' UploadMultipartPart Prelude.Text
uploadMultipartPart_vaultName :: (Text -> f Text) -> UploadMultipartPart -> f UploadMultipartPart
uploadMultipartPart_vaultName = (UploadMultipartPart -> Text)
-> (UploadMultipartPart -> Text -> UploadMultipartPart)
-> Lens UploadMultipartPart UploadMultipartPart Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadMultipartPart' {Text
vaultName :: Text
$sel:vaultName:UploadMultipartPart' :: UploadMultipartPart -> Text
vaultName} -> Text
vaultName) (\s :: UploadMultipartPart
s@UploadMultipartPart' {} Text
a -> UploadMultipartPart
s {$sel:vaultName:UploadMultipartPart' :: Text
vaultName = Text
a} :: UploadMultipartPart)
uploadMultipartPart_uploadId :: Lens.Lens' UploadMultipartPart Prelude.Text
uploadMultipartPart_uploadId :: (Text -> f Text) -> UploadMultipartPart -> f UploadMultipartPart
uploadMultipartPart_uploadId = (UploadMultipartPart -> Text)
-> (UploadMultipartPart -> Text -> UploadMultipartPart)
-> Lens UploadMultipartPart UploadMultipartPart Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadMultipartPart' {Text
uploadId :: Text
$sel:uploadId:UploadMultipartPart' :: UploadMultipartPart -> Text
uploadId} -> Text
uploadId) (\s :: UploadMultipartPart
s@UploadMultipartPart' {} Text
a -> UploadMultipartPart
s {$sel:uploadId:UploadMultipartPart' :: Text
uploadId = Text
a} :: UploadMultipartPart)
uploadMultipartPart_range :: Lens.Lens' UploadMultipartPart Prelude.Text
uploadMultipartPart_range :: (Text -> f Text) -> UploadMultipartPart -> f UploadMultipartPart
uploadMultipartPart_range = (UploadMultipartPart -> Text)
-> (UploadMultipartPart -> Text -> UploadMultipartPart)
-> Lens UploadMultipartPart UploadMultipartPart Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadMultipartPart' {Text
range :: Text
$sel:range:UploadMultipartPart' :: UploadMultipartPart -> Text
range} -> Text
range) (\s :: UploadMultipartPart
s@UploadMultipartPart' {} Text
a -> UploadMultipartPart
s {$sel:range:UploadMultipartPart' :: Text
range = Text
a} :: UploadMultipartPart)
uploadMultipartPart_checksum :: Lens.Lens' UploadMultipartPart Prelude.Text
uploadMultipartPart_checksum :: (Text -> f Text) -> UploadMultipartPart -> f UploadMultipartPart
uploadMultipartPart_checksum = (UploadMultipartPart -> Text)
-> (UploadMultipartPart -> Text -> UploadMultipartPart)
-> Lens UploadMultipartPart UploadMultipartPart Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadMultipartPart' {Text
checksum :: Text
$sel:checksum:UploadMultipartPart' :: UploadMultipartPart -> Text
checksum} -> Text
checksum) (\s :: UploadMultipartPart
s@UploadMultipartPart' {} Text
a -> UploadMultipartPart
s {$sel:checksum:UploadMultipartPart' :: Text
checksum = Text
a} :: UploadMultipartPart)
uploadMultipartPart_body :: Lens.Lens' UploadMultipartPart Core.HashedBody
uploadMultipartPart_body :: (HashedBody -> f HashedBody)
-> UploadMultipartPart -> f UploadMultipartPart
uploadMultipartPart_body = (UploadMultipartPart -> HashedBody)
-> (UploadMultipartPart -> HashedBody -> UploadMultipartPart)
-> Lens
UploadMultipartPart UploadMultipartPart HashedBody HashedBody
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadMultipartPart' {HashedBody
body :: HashedBody
$sel:body:UploadMultipartPart' :: UploadMultipartPart -> HashedBody
body} -> HashedBody
body) (\s :: UploadMultipartPart
s@UploadMultipartPart' {} HashedBody
a -> UploadMultipartPart
s {$sel:body:UploadMultipartPart' :: HashedBody
body = HashedBody
a} :: UploadMultipartPart)
instance Core.AWSRequest UploadMultipartPart where
type
AWSResponse UploadMultipartPart =
UploadMultipartPartResponse
request :: UploadMultipartPart -> Request UploadMultipartPart
request =
ByteString
-> Request UploadMultipartPart -> Request UploadMultipartPart
forall a. ByteString -> Request a -> Request a
Request.glacierVersionHeader (Service -> ByteString
Core._serviceVersion Service
defaultService)
(Request UploadMultipartPart -> Request UploadMultipartPart)
-> (UploadMultipartPart -> Request UploadMultipartPart)
-> UploadMultipartPart
-> Request UploadMultipartPart
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service -> UploadMultipartPart -> Request UploadMultipartPart
forall a. (ToRequest a, ToBody a) => Service -> a -> Request a
Request.putBody Service
defaultService
response :: Logger
-> Service
-> Proxy UploadMultipartPart
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UploadMultipartPart)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UploadMultipartPart))
-> Logger
-> Service
-> Proxy UploadMultipartPart
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UploadMultipartPart)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Maybe Text -> Int -> UploadMultipartPartResponse
UploadMultipartPartResponse'
(Maybe Text -> Int -> UploadMultipartPartResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UploadMultipartPartResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (ResponseHeaders
h ResponseHeaders -> HeaderName -> Either String (Maybe Text)
forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Core..#? HeaderName
"x-amz-sha256-tree-hash")
Either String (Int -> UploadMultipartPartResponse)
-> Either String Int -> Either String UploadMultipartPartResponse
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 Core.ToBody UploadMultipartPart where
toBody :: UploadMultipartPart -> RequestBody
toBody UploadMultipartPart' {Text
HashedBody
body :: HashedBody
checksum :: Text
range :: Text
uploadId :: Text
vaultName :: Text
accountId :: Text
$sel:body:UploadMultipartPart' :: UploadMultipartPart -> HashedBody
$sel:checksum:UploadMultipartPart' :: UploadMultipartPart -> Text
$sel:range:UploadMultipartPart' :: UploadMultipartPart -> Text
$sel:uploadId:UploadMultipartPart' :: UploadMultipartPart -> Text
$sel:vaultName:UploadMultipartPart' :: UploadMultipartPart -> Text
$sel:accountId:UploadMultipartPart' :: UploadMultipartPart -> Text
..} = HashedBody -> RequestBody
forall a. ToBody a => a -> RequestBody
Core.toBody HashedBody
body
instance Core.ToHeaders UploadMultipartPart where
toHeaders :: UploadMultipartPart -> ResponseHeaders
toHeaders UploadMultipartPart' {Text
HashedBody
body :: HashedBody
checksum :: Text
range :: Text
uploadId :: Text
vaultName :: Text
accountId :: Text
$sel:body:UploadMultipartPart' :: UploadMultipartPart -> HashedBody
$sel:checksum:UploadMultipartPart' :: UploadMultipartPart -> Text
$sel:range:UploadMultipartPart' :: UploadMultipartPart -> Text
$sel:uploadId:UploadMultipartPart' :: UploadMultipartPart -> Text
$sel:vaultName:UploadMultipartPart' :: UploadMultipartPart -> Text
$sel:accountId:UploadMultipartPart' :: UploadMultipartPart -> Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Range" HeaderName -> Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Text
range,
HeaderName
"x-amz-sha256-tree-hash" HeaderName -> Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Text
checksum
]
instance Core.ToPath UploadMultipartPart where
toPath :: UploadMultipartPart -> ByteString
toPath UploadMultipartPart' {Text
HashedBody
body :: HashedBody
checksum :: Text
range :: Text
uploadId :: Text
vaultName :: Text
accountId :: Text
$sel:body:UploadMultipartPart' :: UploadMultipartPart -> HashedBody
$sel:checksum:UploadMultipartPart' :: UploadMultipartPart -> Text
$sel:range:UploadMultipartPart' :: UploadMultipartPart -> Text
$sel:uploadId:UploadMultipartPart' :: UploadMultipartPart -> Text
$sel:vaultName:UploadMultipartPart' :: UploadMultipartPart -> Text
$sel:accountId:UploadMultipartPart' :: UploadMultipartPart -> 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
"/multipart-uploads/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
uploadId
]
instance Core.ToQuery UploadMultipartPart where
toQuery :: UploadMultipartPart -> QueryString
toQuery = QueryString -> UploadMultipartPart -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UploadMultipartPartResponse = UploadMultipartPartResponse'
{
UploadMultipartPartResponse -> Maybe Text
checksum :: Prelude.Maybe Prelude.Text,
UploadMultipartPartResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UploadMultipartPartResponse -> UploadMultipartPartResponse -> Bool
(UploadMultipartPartResponse
-> UploadMultipartPartResponse -> Bool)
-> (UploadMultipartPartResponse
-> UploadMultipartPartResponse -> Bool)
-> Eq UploadMultipartPartResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UploadMultipartPartResponse -> UploadMultipartPartResponse -> Bool
$c/= :: UploadMultipartPartResponse -> UploadMultipartPartResponse -> Bool
== :: UploadMultipartPartResponse -> UploadMultipartPartResponse -> Bool
$c== :: UploadMultipartPartResponse -> UploadMultipartPartResponse -> Bool
Prelude.Eq, ReadPrec [UploadMultipartPartResponse]
ReadPrec UploadMultipartPartResponse
Int -> ReadS UploadMultipartPartResponse
ReadS [UploadMultipartPartResponse]
(Int -> ReadS UploadMultipartPartResponse)
-> ReadS [UploadMultipartPartResponse]
-> ReadPrec UploadMultipartPartResponse
-> ReadPrec [UploadMultipartPartResponse]
-> Read UploadMultipartPartResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UploadMultipartPartResponse]
$creadListPrec :: ReadPrec [UploadMultipartPartResponse]
readPrec :: ReadPrec UploadMultipartPartResponse
$creadPrec :: ReadPrec UploadMultipartPartResponse
readList :: ReadS [UploadMultipartPartResponse]
$creadList :: ReadS [UploadMultipartPartResponse]
readsPrec :: Int -> ReadS UploadMultipartPartResponse
$creadsPrec :: Int -> ReadS UploadMultipartPartResponse
Prelude.Read, Int -> UploadMultipartPartResponse -> ShowS
[UploadMultipartPartResponse] -> ShowS
UploadMultipartPartResponse -> String
(Int -> UploadMultipartPartResponse -> ShowS)
-> (UploadMultipartPartResponse -> String)
-> ([UploadMultipartPartResponse] -> ShowS)
-> Show UploadMultipartPartResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UploadMultipartPartResponse] -> ShowS
$cshowList :: [UploadMultipartPartResponse] -> ShowS
show :: UploadMultipartPartResponse -> String
$cshow :: UploadMultipartPartResponse -> String
showsPrec :: Int -> UploadMultipartPartResponse -> ShowS
$cshowsPrec :: Int -> UploadMultipartPartResponse -> ShowS
Prelude.Show, (forall x.
UploadMultipartPartResponse -> Rep UploadMultipartPartResponse x)
-> (forall x.
Rep UploadMultipartPartResponse x -> UploadMultipartPartResponse)
-> Generic UploadMultipartPartResponse
forall x.
Rep UploadMultipartPartResponse x -> UploadMultipartPartResponse
forall x.
UploadMultipartPartResponse -> Rep UploadMultipartPartResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UploadMultipartPartResponse x -> UploadMultipartPartResponse
$cfrom :: forall x.
UploadMultipartPartResponse -> Rep UploadMultipartPartResponse x
Prelude.Generic)
newUploadMultipartPartResponse ::
Prelude.Int ->
UploadMultipartPartResponse
newUploadMultipartPartResponse :: Int -> UploadMultipartPartResponse
newUploadMultipartPartResponse Int
pHttpStatus_ =
UploadMultipartPartResponse' :: Maybe Text -> Int -> UploadMultipartPartResponse
UploadMultipartPartResponse'
{ $sel:checksum:UploadMultipartPartResponse' :: Maybe Text
checksum =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UploadMultipartPartResponse' :: Int
httpStatus = Int
pHttpStatus_
}
uploadMultipartPartResponse_checksum :: Lens.Lens' UploadMultipartPartResponse (Prelude.Maybe Prelude.Text)
uploadMultipartPartResponse_checksum :: (Maybe Text -> f (Maybe Text))
-> UploadMultipartPartResponse -> f UploadMultipartPartResponse
uploadMultipartPartResponse_checksum = (UploadMultipartPartResponse -> Maybe Text)
-> (UploadMultipartPartResponse
-> Maybe Text -> UploadMultipartPartResponse)
-> Lens
UploadMultipartPartResponse
UploadMultipartPartResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadMultipartPartResponse' {Maybe Text
checksum :: Maybe Text
$sel:checksum:UploadMultipartPartResponse' :: UploadMultipartPartResponse -> Maybe Text
checksum} -> Maybe Text
checksum) (\s :: UploadMultipartPartResponse
s@UploadMultipartPartResponse' {} Maybe Text
a -> UploadMultipartPartResponse
s {$sel:checksum:UploadMultipartPartResponse' :: Maybe Text
checksum = Maybe Text
a} :: UploadMultipartPartResponse)
uploadMultipartPartResponse_httpStatus :: Lens.Lens' UploadMultipartPartResponse Prelude.Int
uploadMultipartPartResponse_httpStatus :: (Int -> f Int)
-> UploadMultipartPartResponse -> f UploadMultipartPartResponse
uploadMultipartPartResponse_httpStatus = (UploadMultipartPartResponse -> Int)
-> (UploadMultipartPartResponse
-> Int -> UploadMultipartPartResponse)
-> Lens
UploadMultipartPartResponse UploadMultipartPartResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadMultipartPartResponse' {Int
httpStatus :: Int
$sel:httpStatus:UploadMultipartPartResponse' :: UploadMultipartPartResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UploadMultipartPartResponse
s@UploadMultipartPartResponse' {} Int
a -> UploadMultipartPartResponse
s {$sel:httpStatus:UploadMultipartPartResponse' :: Int
httpStatus = Int
a} :: UploadMultipartPartResponse)
instance Prelude.NFData UploadMultipartPartResponse