{-# 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.AddWorkingStorage
(
AddWorkingStorage (..),
newAddWorkingStorage,
addWorkingStorage_gatewayARN,
addWorkingStorage_diskIds,
AddWorkingStorageResponse (..),
newAddWorkingStorageResponse,
addWorkingStorageResponse_gatewayARN,
addWorkingStorageResponse_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 AddWorkingStorage = AddWorkingStorage'
{ AddWorkingStorage -> Text
gatewayARN :: Prelude.Text,
AddWorkingStorage -> [Text]
diskIds :: [Prelude.Text]
}
deriving (AddWorkingStorage -> AddWorkingStorage -> Bool
(AddWorkingStorage -> AddWorkingStorage -> Bool)
-> (AddWorkingStorage -> AddWorkingStorage -> Bool)
-> Eq AddWorkingStorage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddWorkingStorage -> AddWorkingStorage -> Bool
$c/= :: AddWorkingStorage -> AddWorkingStorage -> Bool
== :: AddWorkingStorage -> AddWorkingStorage -> Bool
$c== :: AddWorkingStorage -> AddWorkingStorage -> Bool
Prelude.Eq, ReadPrec [AddWorkingStorage]
ReadPrec AddWorkingStorage
Int -> ReadS AddWorkingStorage
ReadS [AddWorkingStorage]
(Int -> ReadS AddWorkingStorage)
-> ReadS [AddWorkingStorage]
-> ReadPrec AddWorkingStorage
-> ReadPrec [AddWorkingStorage]
-> Read AddWorkingStorage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddWorkingStorage]
$creadListPrec :: ReadPrec [AddWorkingStorage]
readPrec :: ReadPrec AddWorkingStorage
$creadPrec :: ReadPrec AddWorkingStorage
readList :: ReadS [AddWorkingStorage]
$creadList :: ReadS [AddWorkingStorage]
readsPrec :: Int -> ReadS AddWorkingStorage
$creadsPrec :: Int -> ReadS AddWorkingStorage
Prelude.Read, Int -> AddWorkingStorage -> ShowS
[AddWorkingStorage] -> ShowS
AddWorkingStorage -> String
(Int -> AddWorkingStorage -> ShowS)
-> (AddWorkingStorage -> String)
-> ([AddWorkingStorage] -> ShowS)
-> Show AddWorkingStorage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddWorkingStorage] -> ShowS
$cshowList :: [AddWorkingStorage] -> ShowS
show :: AddWorkingStorage -> String
$cshow :: AddWorkingStorage -> String
showsPrec :: Int -> AddWorkingStorage -> ShowS
$cshowsPrec :: Int -> AddWorkingStorage -> ShowS
Prelude.Show, (forall x. AddWorkingStorage -> Rep AddWorkingStorage x)
-> (forall x. Rep AddWorkingStorage x -> AddWorkingStorage)
-> Generic AddWorkingStorage
forall x. Rep AddWorkingStorage x -> AddWorkingStorage
forall x. AddWorkingStorage -> Rep AddWorkingStorage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddWorkingStorage x -> AddWorkingStorage
$cfrom :: forall x. AddWorkingStorage -> Rep AddWorkingStorage x
Prelude.Generic)
newAddWorkingStorage ::
Prelude.Text ->
AddWorkingStorage
newAddWorkingStorage :: Text -> AddWorkingStorage
newAddWorkingStorage Text
pGatewayARN_ =
AddWorkingStorage' :: Text -> [Text] -> AddWorkingStorage
AddWorkingStorage'
{ $sel:gatewayARN:AddWorkingStorage' :: Text
gatewayARN = Text
pGatewayARN_,
$sel:diskIds:AddWorkingStorage' :: [Text]
diskIds = [Text]
forall a. Monoid a => a
Prelude.mempty
}
addWorkingStorage_gatewayARN :: Lens.Lens' AddWorkingStorage Prelude.Text
addWorkingStorage_gatewayARN :: (Text -> f Text) -> AddWorkingStorage -> f AddWorkingStorage
addWorkingStorage_gatewayARN = (AddWorkingStorage -> Text)
-> (AddWorkingStorage -> Text -> AddWorkingStorage)
-> Lens AddWorkingStorage AddWorkingStorage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddWorkingStorage' {Text
gatewayARN :: Text
$sel:gatewayARN:AddWorkingStorage' :: AddWorkingStorage -> Text
gatewayARN} -> Text
gatewayARN) (\s :: AddWorkingStorage
s@AddWorkingStorage' {} Text
a -> AddWorkingStorage
s {$sel:gatewayARN:AddWorkingStorage' :: Text
gatewayARN = Text
a} :: AddWorkingStorage)
addWorkingStorage_diskIds :: Lens.Lens' AddWorkingStorage [Prelude.Text]
addWorkingStorage_diskIds :: ([Text] -> f [Text]) -> AddWorkingStorage -> f AddWorkingStorage
addWorkingStorage_diskIds = (AddWorkingStorage -> [Text])
-> (AddWorkingStorage -> [Text] -> AddWorkingStorage)
-> Lens AddWorkingStorage AddWorkingStorage [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddWorkingStorage' {[Text]
diskIds :: [Text]
$sel:diskIds:AddWorkingStorage' :: AddWorkingStorage -> [Text]
diskIds} -> [Text]
diskIds) (\s :: AddWorkingStorage
s@AddWorkingStorage' {} [Text]
a -> AddWorkingStorage
s {$sel:diskIds:AddWorkingStorage' :: [Text]
diskIds = [Text]
a} :: AddWorkingStorage) (([Text] -> f [Text]) -> AddWorkingStorage -> f AddWorkingStorage)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> AddWorkingStorage
-> f AddWorkingStorage
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 AddWorkingStorage where
type
AWSResponse AddWorkingStorage =
AddWorkingStorageResponse
request :: AddWorkingStorage -> Request AddWorkingStorage
request = Service -> AddWorkingStorage -> Request AddWorkingStorage
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AddWorkingStorage
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AddWorkingStorage)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AddWorkingStorage))
-> Logger
-> Service
-> Proxy AddWorkingStorage
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AddWorkingStorage)))
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 -> AddWorkingStorageResponse
AddWorkingStorageResponse'
(Maybe Text -> Int -> AddWorkingStorageResponse)
-> Either String (Maybe Text)
-> Either String (Int -> AddWorkingStorageResponse)
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 -> AddWorkingStorageResponse)
-> Either String Int -> Either String AddWorkingStorageResponse
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 AddWorkingStorage
instance Prelude.NFData AddWorkingStorage
instance Core.ToHeaders AddWorkingStorage where
toHeaders :: AddWorkingStorage -> ResponseHeaders
toHeaders =
ResponseHeaders -> AddWorkingStorage -> 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.AddWorkingStorage" ::
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 AddWorkingStorage where
toJSON :: AddWorkingStorage -> Value
toJSON AddWorkingStorage' {[Text]
Text
diskIds :: [Text]
gatewayARN :: Text
$sel:diskIds:AddWorkingStorage' :: AddWorkingStorage -> [Text]
$sel:gatewayARN:AddWorkingStorage' :: AddWorkingStorage -> 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 AddWorkingStorage where
toPath :: AddWorkingStorage -> ByteString
toPath = ByteString -> AddWorkingStorage -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AddWorkingStorage where
toQuery :: AddWorkingStorage -> QueryString
toQuery = QueryString -> AddWorkingStorage -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AddWorkingStorageResponse = AddWorkingStorageResponse'
{ AddWorkingStorageResponse -> Maybe Text
gatewayARN :: Prelude.Maybe Prelude.Text,
AddWorkingStorageResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AddWorkingStorageResponse -> AddWorkingStorageResponse -> Bool
(AddWorkingStorageResponse -> AddWorkingStorageResponse -> Bool)
-> (AddWorkingStorageResponse -> AddWorkingStorageResponse -> Bool)
-> Eq AddWorkingStorageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddWorkingStorageResponse -> AddWorkingStorageResponse -> Bool
$c/= :: AddWorkingStorageResponse -> AddWorkingStorageResponse -> Bool
== :: AddWorkingStorageResponse -> AddWorkingStorageResponse -> Bool
$c== :: AddWorkingStorageResponse -> AddWorkingStorageResponse -> Bool
Prelude.Eq, ReadPrec [AddWorkingStorageResponse]
ReadPrec AddWorkingStorageResponse
Int -> ReadS AddWorkingStorageResponse
ReadS [AddWorkingStorageResponse]
(Int -> ReadS AddWorkingStorageResponse)
-> ReadS [AddWorkingStorageResponse]
-> ReadPrec AddWorkingStorageResponse
-> ReadPrec [AddWorkingStorageResponse]
-> Read AddWorkingStorageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddWorkingStorageResponse]
$creadListPrec :: ReadPrec [AddWorkingStorageResponse]
readPrec :: ReadPrec AddWorkingStorageResponse
$creadPrec :: ReadPrec AddWorkingStorageResponse
readList :: ReadS [AddWorkingStorageResponse]
$creadList :: ReadS [AddWorkingStorageResponse]
readsPrec :: Int -> ReadS AddWorkingStorageResponse
$creadsPrec :: Int -> ReadS AddWorkingStorageResponse
Prelude.Read, Int -> AddWorkingStorageResponse -> ShowS
[AddWorkingStorageResponse] -> ShowS
AddWorkingStorageResponse -> String
(Int -> AddWorkingStorageResponse -> ShowS)
-> (AddWorkingStorageResponse -> String)
-> ([AddWorkingStorageResponse] -> ShowS)
-> Show AddWorkingStorageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddWorkingStorageResponse] -> ShowS
$cshowList :: [AddWorkingStorageResponse] -> ShowS
show :: AddWorkingStorageResponse -> String
$cshow :: AddWorkingStorageResponse -> String
showsPrec :: Int -> AddWorkingStorageResponse -> ShowS
$cshowsPrec :: Int -> AddWorkingStorageResponse -> ShowS
Prelude.Show, (forall x.
AddWorkingStorageResponse -> Rep AddWorkingStorageResponse x)
-> (forall x.
Rep AddWorkingStorageResponse x -> AddWorkingStorageResponse)
-> Generic AddWorkingStorageResponse
forall x.
Rep AddWorkingStorageResponse x -> AddWorkingStorageResponse
forall x.
AddWorkingStorageResponse -> Rep AddWorkingStorageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AddWorkingStorageResponse x -> AddWorkingStorageResponse
$cfrom :: forall x.
AddWorkingStorageResponse -> Rep AddWorkingStorageResponse x
Prelude.Generic)
newAddWorkingStorageResponse ::
Prelude.Int ->
AddWorkingStorageResponse
newAddWorkingStorageResponse :: Int -> AddWorkingStorageResponse
newAddWorkingStorageResponse Int
pHttpStatus_ =
AddWorkingStorageResponse' :: Maybe Text -> Int -> AddWorkingStorageResponse
AddWorkingStorageResponse'
{ $sel:gatewayARN:AddWorkingStorageResponse' :: Maybe Text
gatewayARN =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AddWorkingStorageResponse' :: Int
httpStatus = Int
pHttpStatus_
}
addWorkingStorageResponse_gatewayARN :: Lens.Lens' AddWorkingStorageResponse (Prelude.Maybe Prelude.Text)
addWorkingStorageResponse_gatewayARN :: (Maybe Text -> f (Maybe Text))
-> AddWorkingStorageResponse -> f AddWorkingStorageResponse
addWorkingStorageResponse_gatewayARN = (AddWorkingStorageResponse -> Maybe Text)
-> (AddWorkingStorageResponse
-> Maybe Text -> AddWorkingStorageResponse)
-> Lens
AddWorkingStorageResponse
AddWorkingStorageResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddWorkingStorageResponse' {Maybe Text
gatewayARN :: Maybe Text
$sel:gatewayARN:AddWorkingStorageResponse' :: AddWorkingStorageResponse -> Maybe Text
gatewayARN} -> Maybe Text
gatewayARN) (\s :: AddWorkingStorageResponse
s@AddWorkingStorageResponse' {} Maybe Text
a -> AddWorkingStorageResponse
s {$sel:gatewayARN:AddWorkingStorageResponse' :: Maybe Text
gatewayARN = Maybe Text
a} :: AddWorkingStorageResponse)
addWorkingStorageResponse_httpStatus :: Lens.Lens' AddWorkingStorageResponse Prelude.Int
addWorkingStorageResponse_httpStatus :: (Int -> f Int)
-> AddWorkingStorageResponse -> f AddWorkingStorageResponse
addWorkingStorageResponse_httpStatus = (AddWorkingStorageResponse -> Int)
-> (AddWorkingStorageResponse -> Int -> AddWorkingStorageResponse)
-> Lens AddWorkingStorageResponse AddWorkingStorageResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddWorkingStorageResponse' {Int
httpStatus :: Int
$sel:httpStatus:AddWorkingStorageResponse' :: AddWorkingStorageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AddWorkingStorageResponse
s@AddWorkingStorageResponse' {} Int
a -> AddWorkingStorageResponse
s {$sel:httpStatus:AddWorkingStorageResponse' :: Int
httpStatus = Int
a} :: AddWorkingStorageResponse)
instance Prelude.NFData AddWorkingStorageResponse