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