{-# 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.AlexaBusiness.GetGateway
(
GetGateway (..),
newGetGateway,
getGateway_gatewayArn,
GetGatewayResponse (..),
newGetGatewayResponse,
getGatewayResponse_gateway,
getGatewayResponse_httpStatus,
)
where
import Amazonka.AlexaBusiness.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetGateway = GetGateway'
{
GetGateway -> Text
gatewayArn :: Prelude.Text
}
deriving (GetGateway -> GetGateway -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetGateway -> GetGateway -> Bool
$c/= :: GetGateway -> GetGateway -> Bool
== :: GetGateway -> GetGateway -> Bool
$c== :: GetGateway -> GetGateway -> Bool
Prelude.Eq, ReadPrec [GetGateway]
ReadPrec GetGateway
Int -> ReadS GetGateway
ReadS [GetGateway]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetGateway]
$creadListPrec :: ReadPrec [GetGateway]
readPrec :: ReadPrec GetGateway
$creadPrec :: ReadPrec GetGateway
readList :: ReadS [GetGateway]
$creadList :: ReadS [GetGateway]
readsPrec :: Int -> ReadS GetGateway
$creadsPrec :: Int -> ReadS GetGateway
Prelude.Read, Int -> GetGateway -> ShowS
[GetGateway] -> ShowS
GetGateway -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetGateway] -> ShowS
$cshowList :: [GetGateway] -> ShowS
show :: GetGateway -> String
$cshow :: GetGateway -> String
showsPrec :: Int -> GetGateway -> ShowS
$cshowsPrec :: Int -> GetGateway -> ShowS
Prelude.Show, forall x. Rep GetGateway x -> GetGateway
forall x. GetGateway -> Rep GetGateway x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetGateway x -> GetGateway
$cfrom :: forall x. GetGateway -> Rep GetGateway x
Prelude.Generic)
newGetGateway ::
Prelude.Text ->
GetGateway
newGetGateway :: Text -> GetGateway
newGetGateway Text
pGatewayArn_ =
GetGateway' {$sel:gatewayArn:GetGateway' :: Text
gatewayArn = Text
pGatewayArn_}
getGateway_gatewayArn :: Lens.Lens' GetGateway Prelude.Text
getGateway_gatewayArn :: Lens' GetGateway Text
getGateway_gatewayArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGateway' {Text
gatewayArn :: Text
$sel:gatewayArn:GetGateway' :: GetGateway -> Text
gatewayArn} -> Text
gatewayArn) (\s :: GetGateway
s@GetGateway' {} Text
a -> GetGateway
s {$sel:gatewayArn:GetGateway' :: Text
gatewayArn = Text
a} :: GetGateway)
instance Core.AWSRequest GetGateway where
type AWSResponse GetGateway = GetGatewayResponse
request :: (Service -> Service) -> GetGateway -> Request GetGateway
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetGateway
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetGateway)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Gateway -> Int -> GetGatewayResponse
GetGatewayResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Gateway")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetGateway where
hashWithSalt :: Int -> GetGateway -> Int
hashWithSalt Int
_salt GetGateway' {Text
gatewayArn :: Text
$sel:gatewayArn:GetGateway' :: GetGateway -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
gatewayArn
instance Prelude.NFData GetGateway where
rnf :: GetGateway -> ()
rnf GetGateway' {Text
gatewayArn :: Text
$sel:gatewayArn:GetGateway' :: GetGateway -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
gatewayArn
instance Data.ToHeaders GetGateway where
toHeaders :: GetGateway -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AlexaForBusiness.GetGateway" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetGateway where
toJSON :: GetGateway -> Value
toJSON GetGateway' {Text
gatewayArn :: Text
$sel:gatewayArn:GetGateway' :: GetGateway -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"GatewayArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
gatewayArn)]
)
instance Data.ToPath GetGateway where
toPath :: GetGateway -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetGateway where
toQuery :: GetGateway -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetGatewayResponse = GetGatewayResponse'
{
GetGatewayResponse -> Maybe Gateway
gateway :: Prelude.Maybe Gateway,
GetGatewayResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetGatewayResponse -> GetGatewayResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetGatewayResponse -> GetGatewayResponse -> Bool
$c/= :: GetGatewayResponse -> GetGatewayResponse -> Bool
== :: GetGatewayResponse -> GetGatewayResponse -> Bool
$c== :: GetGatewayResponse -> GetGatewayResponse -> Bool
Prelude.Eq, ReadPrec [GetGatewayResponse]
ReadPrec GetGatewayResponse
Int -> ReadS GetGatewayResponse
ReadS [GetGatewayResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetGatewayResponse]
$creadListPrec :: ReadPrec [GetGatewayResponse]
readPrec :: ReadPrec GetGatewayResponse
$creadPrec :: ReadPrec GetGatewayResponse
readList :: ReadS [GetGatewayResponse]
$creadList :: ReadS [GetGatewayResponse]
readsPrec :: Int -> ReadS GetGatewayResponse
$creadsPrec :: Int -> ReadS GetGatewayResponse
Prelude.Read, Int -> GetGatewayResponse -> ShowS
[GetGatewayResponse] -> ShowS
GetGatewayResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetGatewayResponse] -> ShowS
$cshowList :: [GetGatewayResponse] -> ShowS
show :: GetGatewayResponse -> String
$cshow :: GetGatewayResponse -> String
showsPrec :: Int -> GetGatewayResponse -> ShowS
$cshowsPrec :: Int -> GetGatewayResponse -> ShowS
Prelude.Show, forall x. Rep GetGatewayResponse x -> GetGatewayResponse
forall x. GetGatewayResponse -> Rep GetGatewayResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetGatewayResponse x -> GetGatewayResponse
$cfrom :: forall x. GetGatewayResponse -> Rep GetGatewayResponse x
Prelude.Generic)
newGetGatewayResponse ::
Prelude.Int ->
GetGatewayResponse
newGetGatewayResponse :: Int -> GetGatewayResponse
newGetGatewayResponse Int
pHttpStatus_ =
GetGatewayResponse'
{ $sel:gateway:GetGatewayResponse' :: Maybe Gateway
gateway = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetGatewayResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getGatewayResponse_gateway :: Lens.Lens' GetGatewayResponse (Prelude.Maybe Gateway)
getGatewayResponse_gateway :: Lens' GetGatewayResponse (Maybe Gateway)
getGatewayResponse_gateway = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGatewayResponse' {Maybe Gateway
gateway :: Maybe Gateway
$sel:gateway:GetGatewayResponse' :: GetGatewayResponse -> Maybe Gateway
gateway} -> Maybe Gateway
gateway) (\s :: GetGatewayResponse
s@GetGatewayResponse' {} Maybe Gateway
a -> GetGatewayResponse
s {$sel:gateway:GetGatewayResponse' :: Maybe Gateway
gateway = Maybe Gateway
a} :: GetGatewayResponse)
getGatewayResponse_httpStatus :: Lens.Lens' GetGatewayResponse Prelude.Int
getGatewayResponse_httpStatus :: Lens' GetGatewayResponse Int
getGatewayResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGatewayResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetGatewayResponse' :: GetGatewayResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetGatewayResponse
s@GetGatewayResponse' {} Int
a -> GetGatewayResponse
s {$sel:httpStatus:GetGatewayResponse' :: Int
httpStatus = Int
a} :: GetGatewayResponse)
instance Prelude.NFData GetGatewayResponse where
rnf :: GetGatewayResponse -> ()
rnf GetGatewayResponse' {Int
Maybe Gateway
httpStatus :: Int
gateway :: Maybe Gateway
$sel:httpStatus:GetGatewayResponse' :: GetGatewayResponse -> Int
$sel:gateway:GetGatewayResponse' :: GetGatewayResponse -> Maybe Gateway
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Gateway
gateway
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus