{-# 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.StorageGateway.AddUploadBuffer
(
AddUploadBuffer (..),
newAddUploadBuffer,
addUploadBuffer_gatewayARN,
addUploadBuffer_diskIds,
AddUploadBufferResponse (..),
newAddUploadBufferResponse,
addUploadBufferResponse_gatewayARN,
addUploadBufferResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.StorageGateway.Types
data AddUploadBuffer = AddUploadBuffer'
{ AddUploadBuffer -> Text
gatewayARN :: Prelude.Text,
AddUploadBuffer -> [Text]
diskIds :: [Prelude.Text]
}
deriving (AddUploadBuffer -> AddUploadBuffer -> Bool
(AddUploadBuffer -> AddUploadBuffer -> Bool)
-> (AddUploadBuffer -> AddUploadBuffer -> Bool)
-> Eq AddUploadBuffer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddUploadBuffer -> AddUploadBuffer -> Bool
$c/= :: AddUploadBuffer -> AddUploadBuffer -> Bool
== :: AddUploadBuffer -> AddUploadBuffer -> Bool
$c== :: AddUploadBuffer -> AddUploadBuffer -> Bool
Prelude.Eq, ReadPrec [AddUploadBuffer]
ReadPrec AddUploadBuffer
Int -> ReadS AddUploadBuffer
ReadS [AddUploadBuffer]
(Int -> ReadS AddUploadBuffer)
-> ReadS [AddUploadBuffer]
-> ReadPrec AddUploadBuffer
-> ReadPrec [AddUploadBuffer]
-> Read AddUploadBuffer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddUploadBuffer]
$creadListPrec :: ReadPrec [AddUploadBuffer]
readPrec :: ReadPrec AddUploadBuffer
$creadPrec :: ReadPrec AddUploadBuffer
readList :: ReadS [AddUploadBuffer]
$creadList :: ReadS [AddUploadBuffer]
readsPrec :: Int -> ReadS AddUploadBuffer
$creadsPrec :: Int -> ReadS AddUploadBuffer
Prelude.Read, Int -> AddUploadBuffer -> ShowS
[AddUploadBuffer] -> ShowS
AddUploadBuffer -> String
(Int -> AddUploadBuffer -> ShowS)
-> (AddUploadBuffer -> String)
-> ([AddUploadBuffer] -> ShowS)
-> Show AddUploadBuffer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddUploadBuffer] -> ShowS
$cshowList :: [AddUploadBuffer] -> ShowS
show :: AddUploadBuffer -> String
$cshow :: AddUploadBuffer -> String
showsPrec :: Int -> AddUploadBuffer -> ShowS
$cshowsPrec :: Int -> AddUploadBuffer -> ShowS
Prelude.Show, (forall x. AddUploadBuffer -> Rep AddUploadBuffer x)
-> (forall x. Rep AddUploadBuffer x -> AddUploadBuffer)
-> Generic AddUploadBuffer
forall x. Rep AddUploadBuffer x -> AddUploadBuffer
forall x. AddUploadBuffer -> Rep AddUploadBuffer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddUploadBuffer x -> AddUploadBuffer
$cfrom :: forall x. AddUploadBuffer -> Rep AddUploadBuffer x
Prelude.Generic)
newAddUploadBuffer ::
Prelude.Text ->
AddUploadBuffer
newAddUploadBuffer :: Text -> AddUploadBuffer
newAddUploadBuffer Text
pGatewayARN_ =
AddUploadBuffer' :: Text -> [Text] -> AddUploadBuffer
AddUploadBuffer'
{ $sel:gatewayARN:AddUploadBuffer' :: Text
gatewayARN = Text
pGatewayARN_,
$sel:diskIds:AddUploadBuffer' :: [Text]
diskIds = [Text]
forall a. Monoid a => a
Prelude.mempty
}
addUploadBuffer_gatewayARN :: Lens.Lens' AddUploadBuffer Prelude.Text
addUploadBuffer_gatewayARN :: (Text -> f Text) -> AddUploadBuffer -> f AddUploadBuffer
addUploadBuffer_gatewayARN = (AddUploadBuffer -> Text)
-> (AddUploadBuffer -> Text -> AddUploadBuffer)
-> Lens AddUploadBuffer AddUploadBuffer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddUploadBuffer' {Text
gatewayARN :: Text
$sel:gatewayARN:AddUploadBuffer' :: AddUploadBuffer -> Text
gatewayARN} -> Text
gatewayARN) (\s :: AddUploadBuffer
s@AddUploadBuffer' {} Text
a -> AddUploadBuffer
s {$sel:gatewayARN:AddUploadBuffer' :: Text
gatewayARN = Text
a} :: AddUploadBuffer)
addUploadBuffer_diskIds :: Lens.Lens' AddUploadBuffer [Prelude.Text]
addUploadBuffer_diskIds :: ([Text] -> f [Text]) -> AddUploadBuffer -> f AddUploadBuffer
addUploadBuffer_diskIds = (AddUploadBuffer -> [Text])
-> (AddUploadBuffer -> [Text] -> AddUploadBuffer)
-> Lens AddUploadBuffer AddUploadBuffer [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddUploadBuffer' {[Text]
diskIds :: [Text]
$sel:diskIds:AddUploadBuffer' :: AddUploadBuffer -> [Text]
diskIds} -> [Text]
diskIds) (\s :: AddUploadBuffer
s@AddUploadBuffer' {} [Text]
a -> AddUploadBuffer
s {$sel:diskIds:AddUploadBuffer' :: [Text]
diskIds = [Text]
a} :: AddUploadBuffer) (([Text] -> f [Text]) -> AddUploadBuffer -> f AddUploadBuffer)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> AddUploadBuffer
-> f AddUploadBuffer
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest AddUploadBuffer where
type
AWSResponse AddUploadBuffer =
AddUploadBufferResponse
request :: AddUploadBuffer -> Request AddUploadBuffer
request = Service -> AddUploadBuffer -> Request AddUploadBuffer
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AddUploadBuffer
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AddUploadBuffer)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AddUploadBuffer))
-> Logger
-> Service
-> Proxy AddUploadBuffer
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AddUploadBuffer)))
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 -> Int -> AddUploadBufferResponse
AddUploadBufferResponse'
(Maybe Text -> Int -> AddUploadBufferResponse)
-> Either String (Maybe Text)
-> Either String (Int -> AddUploadBufferResponse)
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
"GatewayARN")
Either String (Int -> AddUploadBufferResponse)
-> Either String Int -> Either String AddUploadBufferResponse
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 AddUploadBuffer
instance Prelude.NFData AddUploadBuffer
instance Core.ToHeaders AddUploadBuffer where
toHeaders :: AddUploadBuffer -> ResponseHeaders
toHeaders =
ResponseHeaders -> AddUploadBuffer -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"StorageGateway_20130630.AddUploadBuffer" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON AddUploadBuffer where
toJSON :: AddUploadBuffer -> Value
toJSON AddUploadBuffer' {[Text]
Text
diskIds :: [Text]
gatewayARN :: Text
$sel:diskIds:AddUploadBuffer' :: AddUploadBuffer -> [Text]
$sel:gatewayARN:AddUploadBuffer' :: AddUploadBuffer -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"GatewayARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
gatewayARN),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DiskIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
diskIds)
]
)
instance Core.ToPath AddUploadBuffer where
toPath :: AddUploadBuffer -> ByteString
toPath = ByteString -> AddUploadBuffer -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AddUploadBuffer where
toQuery :: AddUploadBuffer -> QueryString
toQuery = QueryString -> AddUploadBuffer -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AddUploadBufferResponse = AddUploadBufferResponse'
{ AddUploadBufferResponse -> Maybe Text
gatewayARN :: Prelude.Maybe Prelude.Text,
AddUploadBufferResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AddUploadBufferResponse -> AddUploadBufferResponse -> Bool
(AddUploadBufferResponse -> AddUploadBufferResponse -> Bool)
-> (AddUploadBufferResponse -> AddUploadBufferResponse -> Bool)
-> Eq AddUploadBufferResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddUploadBufferResponse -> AddUploadBufferResponse -> Bool
$c/= :: AddUploadBufferResponse -> AddUploadBufferResponse -> Bool
== :: AddUploadBufferResponse -> AddUploadBufferResponse -> Bool
$c== :: AddUploadBufferResponse -> AddUploadBufferResponse -> Bool
Prelude.Eq, ReadPrec [AddUploadBufferResponse]
ReadPrec AddUploadBufferResponse
Int -> ReadS AddUploadBufferResponse
ReadS [AddUploadBufferResponse]
(Int -> ReadS AddUploadBufferResponse)
-> ReadS [AddUploadBufferResponse]
-> ReadPrec AddUploadBufferResponse
-> ReadPrec [AddUploadBufferResponse]
-> Read AddUploadBufferResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddUploadBufferResponse]
$creadListPrec :: ReadPrec [AddUploadBufferResponse]
readPrec :: ReadPrec AddUploadBufferResponse
$creadPrec :: ReadPrec AddUploadBufferResponse
readList :: ReadS [AddUploadBufferResponse]
$creadList :: ReadS [AddUploadBufferResponse]
readsPrec :: Int -> ReadS AddUploadBufferResponse
$creadsPrec :: Int -> ReadS AddUploadBufferResponse
Prelude.Read, Int -> AddUploadBufferResponse -> ShowS
[AddUploadBufferResponse] -> ShowS
AddUploadBufferResponse -> String
(Int -> AddUploadBufferResponse -> ShowS)
-> (AddUploadBufferResponse -> String)
-> ([AddUploadBufferResponse] -> ShowS)
-> Show AddUploadBufferResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddUploadBufferResponse] -> ShowS
$cshowList :: [AddUploadBufferResponse] -> ShowS
show :: AddUploadBufferResponse -> String
$cshow :: AddUploadBufferResponse -> String
showsPrec :: Int -> AddUploadBufferResponse -> ShowS
$cshowsPrec :: Int -> AddUploadBufferResponse -> ShowS
Prelude.Show, (forall x.
AddUploadBufferResponse -> Rep AddUploadBufferResponse x)
-> (forall x.
Rep AddUploadBufferResponse x -> AddUploadBufferResponse)
-> Generic AddUploadBufferResponse
forall x. Rep AddUploadBufferResponse x -> AddUploadBufferResponse
forall x. AddUploadBufferResponse -> Rep AddUploadBufferResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddUploadBufferResponse x -> AddUploadBufferResponse
$cfrom :: forall x. AddUploadBufferResponse -> Rep AddUploadBufferResponse x
Prelude.Generic)
newAddUploadBufferResponse ::
Prelude.Int ->
AddUploadBufferResponse
newAddUploadBufferResponse :: Int -> AddUploadBufferResponse
newAddUploadBufferResponse Int
pHttpStatus_ =
AddUploadBufferResponse' :: Maybe Text -> Int -> AddUploadBufferResponse
AddUploadBufferResponse'
{ $sel:gatewayARN:AddUploadBufferResponse' :: Maybe Text
gatewayARN =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AddUploadBufferResponse' :: Int
httpStatus = Int
pHttpStatus_
}
addUploadBufferResponse_gatewayARN :: Lens.Lens' AddUploadBufferResponse (Prelude.Maybe Prelude.Text)
addUploadBufferResponse_gatewayARN :: (Maybe Text -> f (Maybe Text))
-> AddUploadBufferResponse -> f AddUploadBufferResponse
addUploadBufferResponse_gatewayARN = (AddUploadBufferResponse -> Maybe Text)
-> (AddUploadBufferResponse
-> Maybe Text -> AddUploadBufferResponse)
-> Lens
AddUploadBufferResponse
AddUploadBufferResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddUploadBufferResponse' {Maybe Text
gatewayARN :: Maybe Text
$sel:gatewayARN:AddUploadBufferResponse' :: AddUploadBufferResponse -> Maybe Text
gatewayARN} -> Maybe Text
gatewayARN) (\s :: AddUploadBufferResponse
s@AddUploadBufferResponse' {} Maybe Text
a -> AddUploadBufferResponse
s {$sel:gatewayARN:AddUploadBufferResponse' :: Maybe Text
gatewayARN = Maybe Text
a} :: AddUploadBufferResponse)
addUploadBufferResponse_httpStatus :: Lens.Lens' AddUploadBufferResponse Prelude.Int
addUploadBufferResponse_httpStatus :: (Int -> f Int)
-> AddUploadBufferResponse -> f AddUploadBufferResponse
addUploadBufferResponse_httpStatus = (AddUploadBufferResponse -> Int)
-> (AddUploadBufferResponse -> Int -> AddUploadBufferResponse)
-> Lens AddUploadBufferResponse AddUploadBufferResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddUploadBufferResponse' {Int
httpStatus :: Int
$sel:httpStatus:AddUploadBufferResponse' :: AddUploadBufferResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AddUploadBufferResponse
s@AddUploadBufferResponse' {} Int
a -> AddUploadBufferResponse
s {$sel:httpStatus:AddUploadBufferResponse' :: Int
httpStatus = Int
a} :: AddUploadBufferResponse)
instance Prelude.NFData AddUploadBufferResponse