{-# 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.ListGateways
(
ListGateways (..),
newListGateways,
listGateways_nextToken,
listGateways_gatewayGroupArn,
listGateways_maxResults,
ListGatewaysResponse (..),
newListGatewaysResponse,
listGatewaysResponse_nextToken,
listGatewaysResponse_gateways,
listGatewaysResponse_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 ListGateways = ListGateways'
{
ListGateways -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListGateways -> Maybe Text
gatewayGroupArn :: Prelude.Maybe Prelude.Text,
ListGateways -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListGateways -> ListGateways -> Bool
(ListGateways -> ListGateways -> Bool)
-> (ListGateways -> ListGateways -> Bool) -> Eq ListGateways
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListGateways -> ListGateways -> Bool
$c/= :: ListGateways -> ListGateways -> Bool
== :: ListGateways -> ListGateways -> Bool
$c== :: ListGateways -> ListGateways -> Bool
Prelude.Eq, ReadPrec [ListGateways]
ReadPrec ListGateways
Int -> ReadS ListGateways
ReadS [ListGateways]
(Int -> ReadS ListGateways)
-> ReadS [ListGateways]
-> ReadPrec ListGateways
-> ReadPrec [ListGateways]
-> Read ListGateways
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListGateways]
$creadListPrec :: ReadPrec [ListGateways]
readPrec :: ReadPrec ListGateways
$creadPrec :: ReadPrec ListGateways
readList :: ReadS [ListGateways]
$creadList :: ReadS [ListGateways]
readsPrec :: Int -> ReadS ListGateways
$creadsPrec :: Int -> ReadS ListGateways
Prelude.Read, Int -> ListGateways -> ShowS
[ListGateways] -> ShowS
ListGateways -> String
(Int -> ListGateways -> ShowS)
-> (ListGateways -> String)
-> ([ListGateways] -> ShowS)
-> Show ListGateways
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListGateways] -> ShowS
$cshowList :: [ListGateways] -> ShowS
show :: ListGateways -> String
$cshow :: ListGateways -> String
showsPrec :: Int -> ListGateways -> ShowS
$cshowsPrec :: Int -> ListGateways -> ShowS
Prelude.Show, (forall x. ListGateways -> Rep ListGateways x)
-> (forall x. Rep ListGateways x -> ListGateways)
-> Generic ListGateways
forall x. Rep ListGateways x -> ListGateways
forall x. ListGateways -> Rep ListGateways x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListGateways x -> ListGateways
$cfrom :: forall x. ListGateways -> Rep ListGateways x
Prelude.Generic)
newListGateways ::
ListGateways
newListGateways :: ListGateways
newListGateways =
ListGateways' :: Maybe Text -> Maybe Text -> Maybe Natural -> ListGateways
ListGateways'
{ $sel:nextToken:ListGateways' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:gatewayGroupArn:ListGateways' :: Maybe Text
gatewayGroupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListGateways' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listGateways_nextToken :: Lens.Lens' ListGateways (Prelude.Maybe Prelude.Text)
listGateways_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListGateways -> f ListGateways
listGateways_nextToken = (ListGateways -> Maybe Text)
-> (ListGateways -> Maybe Text -> ListGateways)
-> Lens ListGateways ListGateways (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGateways' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListGateways' :: ListGateways -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListGateways
s@ListGateways' {} Maybe Text
a -> ListGateways
s {$sel:nextToken:ListGateways' :: Maybe Text
nextToken = Maybe Text
a} :: ListGateways)
listGateways_gatewayGroupArn :: Lens.Lens' ListGateways (Prelude.Maybe Prelude.Text)
listGateways_gatewayGroupArn :: (Maybe Text -> f (Maybe Text)) -> ListGateways -> f ListGateways
listGateways_gatewayGroupArn = (ListGateways -> Maybe Text)
-> (ListGateways -> Maybe Text -> ListGateways)
-> Lens ListGateways ListGateways (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGateways' {Maybe Text
gatewayGroupArn :: Maybe Text
$sel:gatewayGroupArn:ListGateways' :: ListGateways -> Maybe Text
gatewayGroupArn} -> Maybe Text
gatewayGroupArn) (\s :: ListGateways
s@ListGateways' {} Maybe Text
a -> ListGateways
s {$sel:gatewayGroupArn:ListGateways' :: Maybe Text
gatewayGroupArn = Maybe Text
a} :: ListGateways)
listGateways_maxResults :: Lens.Lens' ListGateways (Prelude.Maybe Prelude.Natural)
listGateways_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListGateways -> f ListGateways
listGateways_maxResults = (ListGateways -> Maybe Natural)
-> (ListGateways -> Maybe Natural -> ListGateways)
-> Lens ListGateways ListGateways (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGateways' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListGateways' :: ListGateways -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListGateways
s@ListGateways' {} Maybe Natural
a -> ListGateways
s {$sel:maxResults:ListGateways' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListGateways)
instance Core.AWSRequest ListGateways where
type AWSResponse ListGateways = ListGatewaysResponse
request :: ListGateways -> Request ListGateways
request = Service -> ListGateways -> Request ListGateways
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListGateways
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListGateways)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListGateways))
-> Logger
-> Service
-> Proxy ListGateways
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListGateways)))
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 -> Maybe [GatewaySummary] -> Int -> ListGatewaysResponse
ListGatewaysResponse'
(Maybe Text
-> Maybe [GatewaySummary] -> Int -> ListGatewaysResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe [GatewaySummary] -> Int -> ListGatewaysResponse)
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
"NextToken")
Either
String (Maybe [GatewaySummary] -> Int -> ListGatewaysResponse)
-> Either String (Maybe [GatewaySummary])
-> Either String (Int -> ListGatewaysResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [GatewaySummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Gateways" Either String (Maybe (Maybe [GatewaySummary]))
-> Maybe [GatewaySummary] -> Either String (Maybe [GatewaySummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [GatewaySummary]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> ListGatewaysResponse)
-> Either String Int -> Either String ListGatewaysResponse
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 ListGateways
instance Prelude.NFData ListGateways
instance Core.ToHeaders ListGateways where
toHeaders :: ListGateways -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListGateways -> 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.ListGateways" ::
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 ListGateways where
toJSON :: ListGateways -> Value
toJSON ListGateways' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
gatewayGroupArn :: Maybe Text
nextToken :: Maybe Text
$sel:maxResults:ListGateways' :: ListGateways -> Maybe Natural
$sel:gatewayGroupArn:ListGateways' :: ListGateways -> Maybe Text
$sel:nextToken:ListGateways' :: ListGateways -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
(Text
"GatewayGroupArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
gatewayGroupArn,
(Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
]
)
instance Core.ToPath ListGateways where
toPath :: ListGateways -> ByteString
toPath = ByteString -> ListGateways -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListGateways where
toQuery :: ListGateways -> QueryString
toQuery = QueryString -> ListGateways -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListGatewaysResponse = ListGatewaysResponse'
{
ListGatewaysResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListGatewaysResponse -> Maybe [GatewaySummary]
gateways :: Prelude.Maybe [GatewaySummary],
ListGatewaysResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListGatewaysResponse -> ListGatewaysResponse -> Bool
(ListGatewaysResponse -> ListGatewaysResponse -> Bool)
-> (ListGatewaysResponse -> ListGatewaysResponse -> Bool)
-> Eq ListGatewaysResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListGatewaysResponse -> ListGatewaysResponse -> Bool
$c/= :: ListGatewaysResponse -> ListGatewaysResponse -> Bool
== :: ListGatewaysResponse -> ListGatewaysResponse -> Bool
$c== :: ListGatewaysResponse -> ListGatewaysResponse -> Bool
Prelude.Eq, ReadPrec [ListGatewaysResponse]
ReadPrec ListGatewaysResponse
Int -> ReadS ListGatewaysResponse
ReadS [ListGatewaysResponse]
(Int -> ReadS ListGatewaysResponse)
-> ReadS [ListGatewaysResponse]
-> ReadPrec ListGatewaysResponse
-> ReadPrec [ListGatewaysResponse]
-> Read ListGatewaysResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListGatewaysResponse]
$creadListPrec :: ReadPrec [ListGatewaysResponse]
readPrec :: ReadPrec ListGatewaysResponse
$creadPrec :: ReadPrec ListGatewaysResponse
readList :: ReadS [ListGatewaysResponse]
$creadList :: ReadS [ListGatewaysResponse]
readsPrec :: Int -> ReadS ListGatewaysResponse
$creadsPrec :: Int -> ReadS ListGatewaysResponse
Prelude.Read, Int -> ListGatewaysResponse -> ShowS
[ListGatewaysResponse] -> ShowS
ListGatewaysResponse -> String
(Int -> ListGatewaysResponse -> ShowS)
-> (ListGatewaysResponse -> String)
-> ([ListGatewaysResponse] -> ShowS)
-> Show ListGatewaysResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListGatewaysResponse] -> ShowS
$cshowList :: [ListGatewaysResponse] -> ShowS
show :: ListGatewaysResponse -> String
$cshow :: ListGatewaysResponse -> String
showsPrec :: Int -> ListGatewaysResponse -> ShowS
$cshowsPrec :: Int -> ListGatewaysResponse -> ShowS
Prelude.Show, (forall x. ListGatewaysResponse -> Rep ListGatewaysResponse x)
-> (forall x. Rep ListGatewaysResponse x -> ListGatewaysResponse)
-> Generic ListGatewaysResponse
forall x. Rep ListGatewaysResponse x -> ListGatewaysResponse
forall x. ListGatewaysResponse -> Rep ListGatewaysResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListGatewaysResponse x -> ListGatewaysResponse
$cfrom :: forall x. ListGatewaysResponse -> Rep ListGatewaysResponse x
Prelude.Generic)
newListGatewaysResponse ::
Prelude.Int ->
ListGatewaysResponse
newListGatewaysResponse :: Int -> ListGatewaysResponse
newListGatewaysResponse Int
pHttpStatus_ =
ListGatewaysResponse' :: Maybe Text -> Maybe [GatewaySummary] -> Int -> ListGatewaysResponse
ListGatewaysResponse'
{ $sel:nextToken:ListGatewaysResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:gateways:ListGatewaysResponse' :: Maybe [GatewaySummary]
gateways = Maybe [GatewaySummary]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListGatewaysResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listGatewaysResponse_nextToken :: Lens.Lens' ListGatewaysResponse (Prelude.Maybe Prelude.Text)
listGatewaysResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListGatewaysResponse -> f ListGatewaysResponse
listGatewaysResponse_nextToken = (ListGatewaysResponse -> Maybe Text)
-> (ListGatewaysResponse -> Maybe Text -> ListGatewaysResponse)
-> Lens
ListGatewaysResponse ListGatewaysResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGatewaysResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListGatewaysResponse' :: ListGatewaysResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListGatewaysResponse
s@ListGatewaysResponse' {} Maybe Text
a -> ListGatewaysResponse
s {$sel:nextToken:ListGatewaysResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListGatewaysResponse)
listGatewaysResponse_gateways :: Lens.Lens' ListGatewaysResponse (Prelude.Maybe [GatewaySummary])
listGatewaysResponse_gateways :: (Maybe [GatewaySummary] -> f (Maybe [GatewaySummary]))
-> ListGatewaysResponse -> f ListGatewaysResponse
listGatewaysResponse_gateways = (ListGatewaysResponse -> Maybe [GatewaySummary])
-> (ListGatewaysResponse
-> Maybe [GatewaySummary] -> ListGatewaysResponse)
-> Lens
ListGatewaysResponse
ListGatewaysResponse
(Maybe [GatewaySummary])
(Maybe [GatewaySummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGatewaysResponse' {Maybe [GatewaySummary]
gateways :: Maybe [GatewaySummary]
$sel:gateways:ListGatewaysResponse' :: ListGatewaysResponse -> Maybe [GatewaySummary]
gateways} -> Maybe [GatewaySummary]
gateways) (\s :: ListGatewaysResponse
s@ListGatewaysResponse' {} Maybe [GatewaySummary]
a -> ListGatewaysResponse
s {$sel:gateways:ListGatewaysResponse' :: Maybe [GatewaySummary]
gateways = Maybe [GatewaySummary]
a} :: ListGatewaysResponse) ((Maybe [GatewaySummary] -> f (Maybe [GatewaySummary]))
-> ListGatewaysResponse -> f ListGatewaysResponse)
-> ((Maybe [GatewaySummary] -> f (Maybe [GatewaySummary]))
-> Maybe [GatewaySummary] -> f (Maybe [GatewaySummary]))
-> (Maybe [GatewaySummary] -> f (Maybe [GatewaySummary]))
-> ListGatewaysResponse
-> f ListGatewaysResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[GatewaySummary] [GatewaySummary] [GatewaySummary] [GatewaySummary]
-> Iso
(Maybe [GatewaySummary])
(Maybe [GatewaySummary])
(Maybe [GatewaySummary])
(Maybe [GatewaySummary])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[GatewaySummary] [GatewaySummary] [GatewaySummary] [GatewaySummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listGatewaysResponse_httpStatus :: Lens.Lens' ListGatewaysResponse Prelude.Int
listGatewaysResponse_httpStatus :: (Int -> f Int) -> ListGatewaysResponse -> f ListGatewaysResponse
listGatewaysResponse_httpStatus = (ListGatewaysResponse -> Int)
-> (ListGatewaysResponse -> Int -> ListGatewaysResponse)
-> Lens ListGatewaysResponse ListGatewaysResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGatewaysResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListGatewaysResponse' :: ListGatewaysResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListGatewaysResponse
s@ListGatewaysResponse' {} Int
a -> ListGatewaysResponse
s {$sel:httpStatus:ListGatewaysResponse' :: Int
httpStatus = Int
a} :: ListGatewaysResponse)
instance Prelude.NFData ListGatewaysResponse