{-# 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.Lens as Lens
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
(GetGateway -> GetGateway -> Bool)
-> (GetGateway -> GetGateway -> Bool) -> Eq GetGateway
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]
(Int -> ReadS GetGateway)
-> ReadS [GetGateway]
-> ReadPrec GetGateway
-> ReadPrec [GetGateway]
-> Read 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
(Int -> GetGateway -> ShowS)
-> (GetGateway -> String)
-> ([GetGateway] -> ShowS)
-> Show GetGateway
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. GetGateway -> Rep GetGateway x)
-> (forall x. Rep GetGateway x -> GetGateway) -> Generic GetGateway
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' :: Text -> GetGateway
GetGateway' {$sel:gatewayArn:GetGateway' :: Text
gatewayArn = Text
pGatewayArn_}
getGateway_gatewayArn :: Lens.Lens' GetGateway Prelude.Text
getGateway_gatewayArn :: (Text -> f Text) -> GetGateway -> f GetGateway
getGateway_gatewayArn = (GetGateway -> Text)
-> (GetGateway -> Text -> GetGateway)
-> Lens GetGateway GetGateway Text Text
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 :: GetGateway -> Request GetGateway
request = Service -> GetGateway -> Request GetGateway
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetGateway
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetGateway)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetGateway))
-> Logger
-> Service
-> Proxy GetGateway
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetGateway)))
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 Gateway -> Int -> GetGatewayResponse
GetGatewayResponse'
(Maybe Gateway -> Int -> GetGatewayResponse)
-> Either String (Maybe Gateway)
-> Either String (Int -> GetGatewayResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Gateway)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Gateway")
Either String (Int -> GetGatewayResponse)
-> Either String Int -> Either String GetGatewayResponse
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 GetGateway
instance Prelude.NFData GetGateway
instance Core.ToHeaders GetGateway where
toHeaders :: GetGateway -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetGateway -> 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
"AlexaForBusiness.GetGateway" ::
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 GetGateway where
toJSON :: GetGateway -> Value
toJSON GetGateway' {Text
gatewayArn :: Text
$sel:gatewayArn:GetGateway' :: GetGateway -> 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 GetGateway where
toPath :: GetGateway -> ByteString
toPath = ByteString -> GetGateway -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetGateway where
toQuery :: GetGateway -> QueryString
toQuery = QueryString -> GetGateway -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetGatewayResponse -> GetGatewayResponse -> Bool)
-> (GetGatewayResponse -> GetGatewayResponse -> Bool)
-> Eq GetGatewayResponse
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]
(Int -> ReadS GetGatewayResponse)
-> ReadS [GetGatewayResponse]
-> ReadPrec GetGatewayResponse
-> ReadPrec [GetGatewayResponse]
-> Read 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
(Int -> GetGatewayResponse -> ShowS)
-> (GetGatewayResponse -> String)
-> ([GetGatewayResponse] -> ShowS)
-> Show GetGatewayResponse
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. GetGatewayResponse -> Rep GetGatewayResponse x)
-> (forall x. Rep GetGatewayResponse x -> GetGatewayResponse)
-> Generic GetGatewayResponse
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' :: Maybe Gateway -> Int -> GetGatewayResponse
GetGatewayResponse'
{ $sel:gateway:GetGatewayResponse' :: Maybe Gateway
gateway = Maybe Gateway
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetGatewayResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getGatewayResponse_gateway :: Lens.Lens' GetGatewayResponse (Prelude.Maybe Gateway)
getGatewayResponse_gateway :: (Maybe Gateway -> f (Maybe Gateway))
-> GetGatewayResponse -> f GetGatewayResponse
getGatewayResponse_gateway = (GetGatewayResponse -> Maybe Gateway)
-> (GetGatewayResponse -> Maybe Gateway -> GetGatewayResponse)
-> Lens
GetGatewayResponse
GetGatewayResponse
(Maybe Gateway)
(Maybe 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 :: (Int -> f Int) -> GetGatewayResponse -> f GetGatewayResponse
getGatewayResponse_httpStatus = (GetGatewayResponse -> Int)
-> (GetGatewayResponse -> Int -> GetGatewayResponse)
-> Lens GetGatewayResponse GetGatewayResponse Int Int
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