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