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