{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.AlexaBusiness.ListGatewayGroups
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves a list of gateway group summaries. Use GetGatewayGroup to
-- retrieve details of a specific gateway group.
module Amazonka.AlexaBusiness.ListGatewayGroups
  ( -- * Creating a Request
    ListGatewayGroups (..),
    newListGatewayGroups,

    -- * Request Lenses
    listGatewayGroups_maxResults,
    listGatewayGroups_nextToken,

    -- * Destructuring the Response
    ListGatewayGroupsResponse (..),
    newListGatewayGroupsResponse,

    -- * Response Lenses
    listGatewayGroupsResponse_gatewayGroups,
    listGatewayGroupsResponse_nextToken,
    listGatewayGroupsResponse_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

-- | /See:/ 'newListGatewayGroups' smart constructor.
data ListGatewayGroups = ListGatewayGroups'
  { -- | The maximum number of gateway group summaries to return. The default is
    -- 50.
    ListGatewayGroups -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token used to paginate though multiple pages of gateway group
    -- summaries.
    ListGatewayGroups -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (ListGatewayGroups -> ListGatewayGroups -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListGatewayGroups -> ListGatewayGroups -> Bool
$c/= :: ListGatewayGroups -> ListGatewayGroups -> Bool
== :: ListGatewayGroups -> ListGatewayGroups -> Bool
$c== :: ListGatewayGroups -> ListGatewayGroups -> Bool
Prelude.Eq, ReadPrec [ListGatewayGroups]
ReadPrec ListGatewayGroups
Int -> ReadS ListGatewayGroups
ReadS [ListGatewayGroups]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListGatewayGroups]
$creadListPrec :: ReadPrec [ListGatewayGroups]
readPrec :: ReadPrec ListGatewayGroups
$creadPrec :: ReadPrec ListGatewayGroups
readList :: ReadS [ListGatewayGroups]
$creadList :: ReadS [ListGatewayGroups]
readsPrec :: Int -> ReadS ListGatewayGroups
$creadsPrec :: Int -> ReadS ListGatewayGroups
Prelude.Read, Int -> ListGatewayGroups -> ShowS
[ListGatewayGroups] -> ShowS
ListGatewayGroups -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListGatewayGroups] -> ShowS
$cshowList :: [ListGatewayGroups] -> ShowS
show :: ListGatewayGroups -> String
$cshow :: ListGatewayGroups -> String
showsPrec :: Int -> ListGatewayGroups -> ShowS
$cshowsPrec :: Int -> ListGatewayGroups -> ShowS
Prelude.Show, forall x. Rep ListGatewayGroups x -> ListGatewayGroups
forall x. ListGatewayGroups -> Rep ListGatewayGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListGatewayGroups x -> ListGatewayGroups
$cfrom :: forall x. ListGatewayGroups -> Rep ListGatewayGroups x
Prelude.Generic)

-- |
-- Create a value of 'ListGatewayGroups' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'maxResults', 'listGatewayGroups_maxResults' - The maximum number of gateway group summaries to return. The default is
-- 50.
--
-- 'nextToken', 'listGatewayGroups_nextToken' - The token used to paginate though multiple pages of gateway group
-- summaries.
newListGatewayGroups ::
  ListGatewayGroups
newListGatewayGroups :: ListGatewayGroups
newListGatewayGroups =
  ListGatewayGroups'
    { $sel:maxResults:ListGatewayGroups' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListGatewayGroups' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum number of gateway group summaries to return. The default is
-- 50.
listGatewayGroups_maxResults :: Lens.Lens' ListGatewayGroups (Prelude.Maybe Prelude.Natural)
listGatewayGroups_maxResults :: Lens' ListGatewayGroups (Maybe Natural)
listGatewayGroups_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGatewayGroups' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListGatewayGroups' :: ListGatewayGroups -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListGatewayGroups
s@ListGatewayGroups' {} Maybe Natural
a -> ListGatewayGroups
s {$sel:maxResults:ListGatewayGroups' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListGatewayGroups)

-- | The token used to paginate though multiple pages of gateway group
-- summaries.
listGatewayGroups_nextToken :: Lens.Lens' ListGatewayGroups (Prelude.Maybe Prelude.Text)
listGatewayGroups_nextToken :: Lens' ListGatewayGroups (Maybe Text)
listGatewayGroups_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGatewayGroups' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListGatewayGroups' :: ListGatewayGroups -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListGatewayGroups
s@ListGatewayGroups' {} Maybe Text
a -> ListGatewayGroups
s {$sel:nextToken:ListGatewayGroups' :: Maybe Text
nextToken = Maybe Text
a} :: ListGatewayGroups)

instance Core.AWSRequest ListGatewayGroups where
  type
    AWSResponse ListGatewayGroups =
      ListGatewayGroupsResponse
  request :: (Service -> Service)
-> ListGatewayGroups -> Request ListGatewayGroups
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 ListGatewayGroups
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListGatewayGroups)))
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 [GatewayGroupSummary]
-> Maybe Text -> Int -> ListGatewayGroupsResponse
ListGatewayGroupsResponse'
            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
"GatewayGroups" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
            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 ListGatewayGroups where
  hashWithSalt :: Int -> ListGatewayGroups -> Int
hashWithSalt Int
_salt ListGatewayGroups' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListGatewayGroups' :: ListGatewayGroups -> Maybe Text
$sel:maxResults:ListGatewayGroups' :: ListGatewayGroups -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken

instance Prelude.NFData ListGatewayGroups where
  rnf :: ListGatewayGroups -> ()
rnf ListGatewayGroups' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListGatewayGroups' :: ListGatewayGroups -> Maybe Text
$sel:maxResults:ListGatewayGroups' :: ListGatewayGroups -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken

instance Data.ToHeaders ListGatewayGroups where
  toHeaders :: ListGatewayGroups -> 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.ListGatewayGroups" ::
                          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 ListGatewayGroups where
  toJSON :: ListGatewayGroups -> Value
toJSON ListGatewayGroups' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListGatewayGroups' :: ListGatewayGroups -> Maybe Text
$sel:maxResults:ListGatewayGroups' :: ListGatewayGroups -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"MaxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken
          ]
      )

instance Data.ToPath ListGatewayGroups where
  toPath :: ListGatewayGroups -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery ListGatewayGroups where
  toQuery :: ListGatewayGroups -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newListGatewayGroupsResponse' smart constructor.
data ListGatewayGroupsResponse = ListGatewayGroupsResponse'
  { -- | The gateway groups in the list.
    ListGatewayGroupsResponse -> Maybe [GatewayGroupSummary]
gatewayGroups :: Prelude.Maybe [GatewayGroupSummary],
    -- | The token used to paginate though multiple pages of gateway group
    -- summaries.
    ListGatewayGroupsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListGatewayGroupsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListGatewayGroupsResponse -> ListGatewayGroupsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListGatewayGroupsResponse -> ListGatewayGroupsResponse -> Bool
$c/= :: ListGatewayGroupsResponse -> ListGatewayGroupsResponse -> Bool
== :: ListGatewayGroupsResponse -> ListGatewayGroupsResponse -> Bool
$c== :: ListGatewayGroupsResponse -> ListGatewayGroupsResponse -> Bool
Prelude.Eq, ReadPrec [ListGatewayGroupsResponse]
ReadPrec ListGatewayGroupsResponse
Int -> ReadS ListGatewayGroupsResponse
ReadS [ListGatewayGroupsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListGatewayGroupsResponse]
$creadListPrec :: ReadPrec [ListGatewayGroupsResponse]
readPrec :: ReadPrec ListGatewayGroupsResponse
$creadPrec :: ReadPrec ListGatewayGroupsResponse
readList :: ReadS [ListGatewayGroupsResponse]
$creadList :: ReadS [ListGatewayGroupsResponse]
readsPrec :: Int -> ReadS ListGatewayGroupsResponse
$creadsPrec :: Int -> ReadS ListGatewayGroupsResponse
Prelude.Read, Int -> ListGatewayGroupsResponse -> ShowS
[ListGatewayGroupsResponse] -> ShowS
ListGatewayGroupsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListGatewayGroupsResponse] -> ShowS
$cshowList :: [ListGatewayGroupsResponse] -> ShowS
show :: ListGatewayGroupsResponse -> String
$cshow :: ListGatewayGroupsResponse -> String
showsPrec :: Int -> ListGatewayGroupsResponse -> ShowS
$cshowsPrec :: Int -> ListGatewayGroupsResponse -> ShowS
Prelude.Show, forall x.
Rep ListGatewayGroupsResponse x -> ListGatewayGroupsResponse
forall x.
ListGatewayGroupsResponse -> Rep ListGatewayGroupsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListGatewayGroupsResponse x -> ListGatewayGroupsResponse
$cfrom :: forall x.
ListGatewayGroupsResponse -> Rep ListGatewayGroupsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListGatewayGroupsResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'gatewayGroups', 'listGatewayGroupsResponse_gatewayGroups' - The gateway groups in the list.
--
-- 'nextToken', 'listGatewayGroupsResponse_nextToken' - The token used to paginate though multiple pages of gateway group
-- summaries.
--
-- 'httpStatus', 'listGatewayGroupsResponse_httpStatus' - The response's http status code.
newListGatewayGroupsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListGatewayGroupsResponse
newListGatewayGroupsResponse :: Int -> ListGatewayGroupsResponse
newListGatewayGroupsResponse Int
pHttpStatus_ =
  ListGatewayGroupsResponse'
    { $sel:gatewayGroups:ListGatewayGroupsResponse' :: Maybe [GatewayGroupSummary]
gatewayGroups =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListGatewayGroupsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListGatewayGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The gateway groups in the list.
listGatewayGroupsResponse_gatewayGroups :: Lens.Lens' ListGatewayGroupsResponse (Prelude.Maybe [GatewayGroupSummary])
listGatewayGroupsResponse_gatewayGroups :: Lens' ListGatewayGroupsResponse (Maybe [GatewayGroupSummary])
listGatewayGroupsResponse_gatewayGroups = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGatewayGroupsResponse' {Maybe [GatewayGroupSummary]
gatewayGroups :: Maybe [GatewayGroupSummary]
$sel:gatewayGroups:ListGatewayGroupsResponse' :: ListGatewayGroupsResponse -> Maybe [GatewayGroupSummary]
gatewayGroups} -> Maybe [GatewayGroupSummary]
gatewayGroups) (\s :: ListGatewayGroupsResponse
s@ListGatewayGroupsResponse' {} Maybe [GatewayGroupSummary]
a -> ListGatewayGroupsResponse
s {$sel:gatewayGroups:ListGatewayGroupsResponse' :: Maybe [GatewayGroupSummary]
gatewayGroups = Maybe [GatewayGroupSummary]
a} :: ListGatewayGroupsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token used to paginate though multiple pages of gateway group
-- summaries.
listGatewayGroupsResponse_nextToken :: Lens.Lens' ListGatewayGroupsResponse (Prelude.Maybe Prelude.Text)
listGatewayGroupsResponse_nextToken :: Lens' ListGatewayGroupsResponse (Maybe Text)
listGatewayGroupsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGatewayGroupsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListGatewayGroupsResponse' :: ListGatewayGroupsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListGatewayGroupsResponse
s@ListGatewayGroupsResponse' {} Maybe Text
a -> ListGatewayGroupsResponse
s {$sel:nextToken:ListGatewayGroupsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListGatewayGroupsResponse)

-- | The response's http status code.
listGatewayGroupsResponse_httpStatus :: Lens.Lens' ListGatewayGroupsResponse Prelude.Int
listGatewayGroupsResponse_httpStatus :: Lens' ListGatewayGroupsResponse Int
listGatewayGroupsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGatewayGroupsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListGatewayGroupsResponse' :: ListGatewayGroupsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListGatewayGroupsResponse
s@ListGatewayGroupsResponse' {} Int
a -> ListGatewayGroupsResponse
s {$sel:httpStatus:ListGatewayGroupsResponse' :: Int
httpStatus = Int
a} :: ListGatewayGroupsResponse)

instance Prelude.NFData ListGatewayGroupsResponse where
  rnf :: ListGatewayGroupsResponse -> ()
rnf ListGatewayGroupsResponse' {Int
Maybe [GatewayGroupSummary]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
gatewayGroups :: Maybe [GatewayGroupSummary]
$sel:httpStatus:ListGatewayGroupsResponse' :: ListGatewayGroupsResponse -> Int
$sel:nextToken:ListGatewayGroupsResponse' :: ListGatewayGroupsResponse -> Maybe Text
$sel:gatewayGroups:ListGatewayGroupsResponse' :: ListGatewayGroupsResponse -> Maybe [GatewayGroupSummary]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [GatewayGroupSummary]
gatewayGroups
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus