{-# 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.Route53AutoNaming.ListNamespaces
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists summary information about the namespaces that were created by the
-- current account.
--
-- This operation returns paginated results.
module Amazonka.Route53AutoNaming.ListNamespaces
  ( -- * Creating a Request
    ListNamespaces (..),
    newListNamespaces,

    -- * Request Lenses
    listNamespaces_filters,
    listNamespaces_nextToken,
    listNamespaces_maxResults,

    -- * Destructuring the Response
    ListNamespacesResponse (..),
    newListNamespacesResponse,

    -- * Response Lenses
    listNamespacesResponse_namespaces,
    listNamespacesResponse_nextToken,
    listNamespacesResponse_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.Route53AutoNaming.Types

-- | /See:/ 'newListNamespaces' smart constructor.
data ListNamespaces = ListNamespaces'
  { -- | A complex type that contains specifications for the namespaces that you
    -- want to list.
    --
    -- If you specify more than one filter, a namespace must match all filters
    -- to be returned by @ListNamespaces@.
    ListNamespaces -> Maybe [NamespaceFilter]
filters :: Prelude.Maybe [NamespaceFilter],
    -- | For the first @ListNamespaces@ request, omit this value.
    --
    -- If the response contains @NextToken@, submit another @ListNamespaces@
    -- request to get the next group of results. Specify the value of
    -- @NextToken@ from the previous response in the next request.
    --
    -- Cloud Map gets @MaxResults@ namespaces and then filters them based on
    -- the specified criteria. It\'s possible that no namespaces in the first
    -- @MaxResults@ namespaces matched the specified criteria but that
    -- subsequent groups of @MaxResults@ namespaces do contain namespaces that
    -- match the criteria.
    ListNamespaces -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of namespaces that you want Cloud Map to return in
    -- the response to a @ListNamespaces@ request. If you don\'t specify a
    -- value for @MaxResults@, Cloud Map returns up to 100 namespaces.
    ListNamespaces -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListNamespaces -> ListNamespaces -> Bool
(ListNamespaces -> ListNamespaces -> Bool)
-> (ListNamespaces -> ListNamespaces -> Bool) -> Eq ListNamespaces
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListNamespaces -> ListNamespaces -> Bool
$c/= :: ListNamespaces -> ListNamespaces -> Bool
== :: ListNamespaces -> ListNamespaces -> Bool
$c== :: ListNamespaces -> ListNamespaces -> Bool
Prelude.Eq, ReadPrec [ListNamespaces]
ReadPrec ListNamespaces
Int -> ReadS ListNamespaces
ReadS [ListNamespaces]
(Int -> ReadS ListNamespaces)
-> ReadS [ListNamespaces]
-> ReadPrec ListNamespaces
-> ReadPrec [ListNamespaces]
-> Read ListNamespaces
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListNamespaces]
$creadListPrec :: ReadPrec [ListNamespaces]
readPrec :: ReadPrec ListNamespaces
$creadPrec :: ReadPrec ListNamespaces
readList :: ReadS [ListNamespaces]
$creadList :: ReadS [ListNamespaces]
readsPrec :: Int -> ReadS ListNamespaces
$creadsPrec :: Int -> ReadS ListNamespaces
Prelude.Read, Int -> ListNamespaces -> ShowS
[ListNamespaces] -> ShowS
ListNamespaces -> String
(Int -> ListNamespaces -> ShowS)
-> (ListNamespaces -> String)
-> ([ListNamespaces] -> ShowS)
-> Show ListNamespaces
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListNamespaces] -> ShowS
$cshowList :: [ListNamespaces] -> ShowS
show :: ListNamespaces -> String
$cshow :: ListNamespaces -> String
showsPrec :: Int -> ListNamespaces -> ShowS
$cshowsPrec :: Int -> ListNamespaces -> ShowS
Prelude.Show, (forall x. ListNamespaces -> Rep ListNamespaces x)
-> (forall x. Rep ListNamespaces x -> ListNamespaces)
-> Generic ListNamespaces
forall x. Rep ListNamespaces x -> ListNamespaces
forall x. ListNamespaces -> Rep ListNamespaces x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListNamespaces x -> ListNamespaces
$cfrom :: forall x. ListNamespaces -> Rep ListNamespaces x
Prelude.Generic)

-- |
-- Create a value of 'ListNamespaces' 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:
--
-- 'filters', 'listNamespaces_filters' - A complex type that contains specifications for the namespaces that you
-- want to list.
--
-- If you specify more than one filter, a namespace must match all filters
-- to be returned by @ListNamespaces@.
--
-- 'nextToken', 'listNamespaces_nextToken' - For the first @ListNamespaces@ request, omit this value.
--
-- If the response contains @NextToken@, submit another @ListNamespaces@
-- request to get the next group of results. Specify the value of
-- @NextToken@ from the previous response in the next request.
--
-- Cloud Map gets @MaxResults@ namespaces and then filters them based on
-- the specified criteria. It\'s possible that no namespaces in the first
-- @MaxResults@ namespaces matched the specified criteria but that
-- subsequent groups of @MaxResults@ namespaces do contain namespaces that
-- match the criteria.
--
-- 'maxResults', 'listNamespaces_maxResults' - The maximum number of namespaces that you want Cloud Map to return in
-- the response to a @ListNamespaces@ request. If you don\'t specify a
-- value for @MaxResults@, Cloud Map returns up to 100 namespaces.
newListNamespaces ::
  ListNamespaces
newListNamespaces :: ListNamespaces
newListNamespaces =
  ListNamespaces' :: Maybe [NamespaceFilter]
-> Maybe Text -> Maybe Natural -> ListNamespaces
ListNamespaces'
    { $sel:filters:ListNamespaces' :: Maybe [NamespaceFilter]
filters = Maybe [NamespaceFilter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListNamespaces' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListNamespaces' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | A complex type that contains specifications for the namespaces that you
-- want to list.
--
-- If you specify more than one filter, a namespace must match all filters
-- to be returned by @ListNamespaces@.
listNamespaces_filters :: Lens.Lens' ListNamespaces (Prelude.Maybe [NamespaceFilter])
listNamespaces_filters :: (Maybe [NamespaceFilter] -> f (Maybe [NamespaceFilter]))
-> ListNamespaces -> f ListNamespaces
listNamespaces_filters = (ListNamespaces -> Maybe [NamespaceFilter])
-> (ListNamespaces -> Maybe [NamespaceFilter] -> ListNamespaces)
-> Lens
     ListNamespaces
     ListNamespaces
     (Maybe [NamespaceFilter])
     (Maybe [NamespaceFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNamespaces' {Maybe [NamespaceFilter]
filters :: Maybe [NamespaceFilter]
$sel:filters:ListNamespaces' :: ListNamespaces -> Maybe [NamespaceFilter]
filters} -> Maybe [NamespaceFilter]
filters) (\s :: ListNamespaces
s@ListNamespaces' {} Maybe [NamespaceFilter]
a -> ListNamespaces
s {$sel:filters:ListNamespaces' :: Maybe [NamespaceFilter]
filters = Maybe [NamespaceFilter]
a} :: ListNamespaces) ((Maybe [NamespaceFilter] -> f (Maybe [NamespaceFilter]))
 -> ListNamespaces -> f ListNamespaces)
-> ((Maybe [NamespaceFilter] -> f (Maybe [NamespaceFilter]))
    -> Maybe [NamespaceFilter] -> f (Maybe [NamespaceFilter]))
-> (Maybe [NamespaceFilter] -> f (Maybe [NamespaceFilter]))
-> ListNamespaces
-> f ListNamespaces
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [NamespaceFilter]
  [NamespaceFilter]
  [NamespaceFilter]
  [NamespaceFilter]
-> Iso
     (Maybe [NamespaceFilter])
     (Maybe [NamespaceFilter])
     (Maybe [NamespaceFilter])
     (Maybe [NamespaceFilter])
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
  [NamespaceFilter]
  [NamespaceFilter]
  [NamespaceFilter]
  [NamespaceFilter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | For the first @ListNamespaces@ request, omit this value.
--
-- If the response contains @NextToken@, submit another @ListNamespaces@
-- request to get the next group of results. Specify the value of
-- @NextToken@ from the previous response in the next request.
--
-- Cloud Map gets @MaxResults@ namespaces and then filters them based on
-- the specified criteria. It\'s possible that no namespaces in the first
-- @MaxResults@ namespaces matched the specified criteria but that
-- subsequent groups of @MaxResults@ namespaces do contain namespaces that
-- match the criteria.
listNamespaces_nextToken :: Lens.Lens' ListNamespaces (Prelude.Maybe Prelude.Text)
listNamespaces_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListNamespaces -> f ListNamespaces
listNamespaces_nextToken = (ListNamespaces -> Maybe Text)
-> (ListNamespaces -> Maybe Text -> ListNamespaces)
-> Lens ListNamespaces ListNamespaces (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNamespaces' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListNamespaces' :: ListNamespaces -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListNamespaces
s@ListNamespaces' {} Maybe Text
a -> ListNamespaces
s {$sel:nextToken:ListNamespaces' :: Maybe Text
nextToken = Maybe Text
a} :: ListNamespaces)

-- | The maximum number of namespaces that you want Cloud Map to return in
-- the response to a @ListNamespaces@ request. If you don\'t specify a
-- value for @MaxResults@, Cloud Map returns up to 100 namespaces.
listNamespaces_maxResults :: Lens.Lens' ListNamespaces (Prelude.Maybe Prelude.Natural)
listNamespaces_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListNamespaces -> f ListNamespaces
listNamespaces_maxResults = (ListNamespaces -> Maybe Natural)
-> (ListNamespaces -> Maybe Natural -> ListNamespaces)
-> Lens
     ListNamespaces ListNamespaces (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNamespaces' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListNamespaces' :: ListNamespaces -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListNamespaces
s@ListNamespaces' {} Maybe Natural
a -> ListNamespaces
s {$sel:maxResults:ListNamespaces' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListNamespaces)

instance Core.AWSPager ListNamespaces where
  page :: ListNamespaces
-> AWSResponse ListNamespaces -> Maybe ListNamespaces
page ListNamespaces
rq AWSResponse ListNamespaces
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListNamespaces
ListNamespacesResponse
rs
            ListNamespacesResponse
-> Getting (First Text) ListNamespacesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListNamespacesResponse
-> Const (First Text) ListNamespacesResponse
Lens' ListNamespacesResponse (Maybe Text)
listNamespacesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListNamespacesResponse
 -> Const (First Text) ListNamespacesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListNamespacesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListNamespaces
forall a. Maybe a
Prelude.Nothing
    | Maybe [NamespaceSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListNamespaces
ListNamespacesResponse
rs
            ListNamespacesResponse
-> Getting
     (First [NamespaceSummary])
     ListNamespacesResponse
     [NamespaceSummary]
-> Maybe [NamespaceSummary]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [NamespaceSummary]
 -> Const (First [NamespaceSummary]) (Maybe [NamespaceSummary]))
-> ListNamespacesResponse
-> Const (First [NamespaceSummary]) ListNamespacesResponse
Lens' ListNamespacesResponse (Maybe [NamespaceSummary])
listNamespacesResponse_namespaces
              ((Maybe [NamespaceSummary]
  -> Const (First [NamespaceSummary]) (Maybe [NamespaceSummary]))
 -> ListNamespacesResponse
 -> Const (First [NamespaceSummary]) ListNamespacesResponse)
-> (([NamespaceSummary]
     -> Const (First [NamespaceSummary]) [NamespaceSummary])
    -> Maybe [NamespaceSummary]
    -> Const (First [NamespaceSummary]) (Maybe [NamespaceSummary]))
-> Getting
     (First [NamespaceSummary])
     ListNamespacesResponse
     [NamespaceSummary]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([NamespaceSummary]
 -> Const (First [NamespaceSummary]) [NamespaceSummary])
-> Maybe [NamespaceSummary]
-> Const (First [NamespaceSummary]) (Maybe [NamespaceSummary])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListNamespaces
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListNamespaces -> Maybe ListNamespaces
forall a. a -> Maybe a
Prelude.Just (ListNamespaces -> Maybe ListNamespaces)
-> ListNamespaces -> Maybe ListNamespaces
forall a b. (a -> b) -> a -> b
Prelude.$
        ListNamespaces
rq
          ListNamespaces
-> (ListNamespaces -> ListNamespaces) -> ListNamespaces
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListNamespaces -> Identity ListNamespaces
Lens ListNamespaces ListNamespaces (Maybe Text) (Maybe Text)
listNamespaces_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListNamespaces -> Identity ListNamespaces)
-> Maybe Text -> ListNamespaces -> ListNamespaces
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListNamespaces
ListNamespacesResponse
rs
          ListNamespacesResponse
-> Getting (First Text) ListNamespacesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListNamespacesResponse
-> Const (First Text) ListNamespacesResponse
Lens' ListNamespacesResponse (Maybe Text)
listNamespacesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListNamespacesResponse
 -> Const (First Text) ListNamespacesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListNamespacesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListNamespaces where
  type
    AWSResponse ListNamespaces =
      ListNamespacesResponse
  request :: ListNamespaces -> Request ListNamespaces
request = Service -> ListNamespaces -> Request ListNamespaces
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListNamespaces
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListNamespaces)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListNamespaces))
-> Logger
-> Service
-> Proxy ListNamespaces
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListNamespaces)))
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 [NamespaceSummary]
-> Maybe Text -> Int -> ListNamespacesResponse
ListNamespacesResponse'
            (Maybe [NamespaceSummary]
 -> Maybe Text -> Int -> ListNamespacesResponse)
-> Either String (Maybe [NamespaceSummary])
-> Either String (Maybe Text -> Int -> ListNamespacesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [NamespaceSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Namespaces" Either String (Maybe (Maybe [NamespaceSummary]))
-> Maybe [NamespaceSummary]
-> Either String (Maybe [NamespaceSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [NamespaceSummary]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> ListNamespacesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListNamespacesResponse)
forall (f :: * -> *) a b. Applicative f => 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 (Int -> ListNamespacesResponse)
-> Either String Int -> Either String ListNamespacesResponse
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 ListNamespaces

instance Prelude.NFData ListNamespaces

instance Core.ToHeaders ListNamespaces where
  toHeaders :: ListNamespaces -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListNamespaces -> 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
"Route53AutoNaming_v20170314.ListNamespaces" ::
                          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 ListNamespaces where
  toJSON :: ListNamespaces -> Value
toJSON ListNamespaces' {Maybe Natural
Maybe [NamespaceFilter]
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
filters :: Maybe [NamespaceFilter]
$sel:maxResults:ListNamespaces' :: ListNamespaces -> Maybe Natural
$sel:nextToken:ListNamespaces' :: ListNamespaces -> Maybe Text
$sel:filters:ListNamespaces' :: ListNamespaces -> Maybe [NamespaceFilter]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Filters" Text -> [NamespaceFilter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([NamespaceFilter] -> Pair)
-> Maybe [NamespaceFilter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [NamespaceFilter]
filters,
            (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
"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 ListNamespaces where
  toPath :: ListNamespaces -> ByteString
toPath = ByteString -> ListNamespaces -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newListNamespacesResponse' smart constructor.
data ListNamespacesResponse = ListNamespacesResponse'
  { -- | An array that contains one @NamespaceSummary@ object for each namespace
    -- that matches the specified filter criteria.
    ListNamespacesResponse -> Maybe [NamespaceSummary]
namespaces :: Prelude.Maybe [NamespaceSummary],
    -- | If the response contains @NextToken@, submit another @ListNamespaces@
    -- request to get the next group of results. Specify the value of
    -- @NextToken@ from the previous response in the next request.
    --
    -- Cloud Map gets @MaxResults@ namespaces and then filters them based on
    -- the specified criteria. It\'s possible that no namespaces in the first
    -- @MaxResults@ namespaces matched the specified criteria but that
    -- subsequent groups of @MaxResults@ namespaces do contain namespaces that
    -- match the criteria.
    ListNamespacesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListNamespacesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListNamespacesResponse -> ListNamespacesResponse -> Bool
(ListNamespacesResponse -> ListNamespacesResponse -> Bool)
-> (ListNamespacesResponse -> ListNamespacesResponse -> Bool)
-> Eq ListNamespacesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListNamespacesResponse -> ListNamespacesResponse -> Bool
$c/= :: ListNamespacesResponse -> ListNamespacesResponse -> Bool
== :: ListNamespacesResponse -> ListNamespacesResponse -> Bool
$c== :: ListNamespacesResponse -> ListNamespacesResponse -> Bool
Prelude.Eq, ReadPrec [ListNamespacesResponse]
ReadPrec ListNamespacesResponse
Int -> ReadS ListNamespacesResponse
ReadS [ListNamespacesResponse]
(Int -> ReadS ListNamespacesResponse)
-> ReadS [ListNamespacesResponse]
-> ReadPrec ListNamespacesResponse
-> ReadPrec [ListNamespacesResponse]
-> Read ListNamespacesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListNamespacesResponse]
$creadListPrec :: ReadPrec [ListNamespacesResponse]
readPrec :: ReadPrec ListNamespacesResponse
$creadPrec :: ReadPrec ListNamespacesResponse
readList :: ReadS [ListNamespacesResponse]
$creadList :: ReadS [ListNamespacesResponse]
readsPrec :: Int -> ReadS ListNamespacesResponse
$creadsPrec :: Int -> ReadS ListNamespacesResponse
Prelude.Read, Int -> ListNamespacesResponse -> ShowS
[ListNamespacesResponse] -> ShowS
ListNamespacesResponse -> String
(Int -> ListNamespacesResponse -> ShowS)
-> (ListNamespacesResponse -> String)
-> ([ListNamespacesResponse] -> ShowS)
-> Show ListNamespacesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListNamespacesResponse] -> ShowS
$cshowList :: [ListNamespacesResponse] -> ShowS
show :: ListNamespacesResponse -> String
$cshow :: ListNamespacesResponse -> String
showsPrec :: Int -> ListNamespacesResponse -> ShowS
$cshowsPrec :: Int -> ListNamespacesResponse -> ShowS
Prelude.Show, (forall x. ListNamespacesResponse -> Rep ListNamespacesResponse x)
-> (forall x.
    Rep ListNamespacesResponse x -> ListNamespacesResponse)
-> Generic ListNamespacesResponse
forall x. Rep ListNamespacesResponse x -> ListNamespacesResponse
forall x. ListNamespacesResponse -> Rep ListNamespacesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListNamespacesResponse x -> ListNamespacesResponse
$cfrom :: forall x. ListNamespacesResponse -> Rep ListNamespacesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListNamespacesResponse' 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:
--
-- 'namespaces', 'listNamespacesResponse_namespaces' - An array that contains one @NamespaceSummary@ object for each namespace
-- that matches the specified filter criteria.
--
-- 'nextToken', 'listNamespacesResponse_nextToken' - If the response contains @NextToken@, submit another @ListNamespaces@
-- request to get the next group of results. Specify the value of
-- @NextToken@ from the previous response in the next request.
--
-- Cloud Map gets @MaxResults@ namespaces and then filters them based on
-- the specified criteria. It\'s possible that no namespaces in the first
-- @MaxResults@ namespaces matched the specified criteria but that
-- subsequent groups of @MaxResults@ namespaces do contain namespaces that
-- match the criteria.
--
-- 'httpStatus', 'listNamespacesResponse_httpStatus' - The response's http status code.
newListNamespacesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListNamespacesResponse
newListNamespacesResponse :: Int -> ListNamespacesResponse
newListNamespacesResponse Int
pHttpStatus_ =
  ListNamespacesResponse' :: Maybe [NamespaceSummary]
-> Maybe Text -> Int -> ListNamespacesResponse
ListNamespacesResponse'
    { $sel:namespaces:ListNamespacesResponse' :: Maybe [NamespaceSummary]
namespaces =
        Maybe [NamespaceSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListNamespacesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListNamespacesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array that contains one @NamespaceSummary@ object for each namespace
-- that matches the specified filter criteria.
listNamespacesResponse_namespaces :: Lens.Lens' ListNamespacesResponse (Prelude.Maybe [NamespaceSummary])
listNamespacesResponse_namespaces :: (Maybe [NamespaceSummary] -> f (Maybe [NamespaceSummary]))
-> ListNamespacesResponse -> f ListNamespacesResponse
listNamespacesResponse_namespaces = (ListNamespacesResponse -> Maybe [NamespaceSummary])
-> (ListNamespacesResponse
    -> Maybe [NamespaceSummary] -> ListNamespacesResponse)
-> Lens' ListNamespacesResponse (Maybe [NamespaceSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNamespacesResponse' {Maybe [NamespaceSummary]
namespaces :: Maybe [NamespaceSummary]
$sel:namespaces:ListNamespacesResponse' :: ListNamespacesResponse -> Maybe [NamespaceSummary]
namespaces} -> Maybe [NamespaceSummary]
namespaces) (\s :: ListNamespacesResponse
s@ListNamespacesResponse' {} Maybe [NamespaceSummary]
a -> ListNamespacesResponse
s {$sel:namespaces:ListNamespacesResponse' :: Maybe [NamespaceSummary]
namespaces = Maybe [NamespaceSummary]
a} :: ListNamespacesResponse) ((Maybe [NamespaceSummary] -> f (Maybe [NamespaceSummary]))
 -> ListNamespacesResponse -> f ListNamespacesResponse)
-> ((Maybe [NamespaceSummary] -> f (Maybe [NamespaceSummary]))
    -> Maybe [NamespaceSummary] -> f (Maybe [NamespaceSummary]))
-> (Maybe [NamespaceSummary] -> f (Maybe [NamespaceSummary]))
-> ListNamespacesResponse
-> f ListNamespacesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [NamespaceSummary]
  [NamespaceSummary]
  [NamespaceSummary]
  [NamespaceSummary]
-> Iso
     (Maybe [NamespaceSummary])
     (Maybe [NamespaceSummary])
     (Maybe [NamespaceSummary])
     (Maybe [NamespaceSummary])
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
  [NamespaceSummary]
  [NamespaceSummary]
  [NamespaceSummary]
  [NamespaceSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If the response contains @NextToken@, submit another @ListNamespaces@
-- request to get the next group of results. Specify the value of
-- @NextToken@ from the previous response in the next request.
--
-- Cloud Map gets @MaxResults@ namespaces and then filters them based on
-- the specified criteria. It\'s possible that no namespaces in the first
-- @MaxResults@ namespaces matched the specified criteria but that
-- subsequent groups of @MaxResults@ namespaces do contain namespaces that
-- match the criteria.
listNamespacesResponse_nextToken :: Lens.Lens' ListNamespacesResponse (Prelude.Maybe Prelude.Text)
listNamespacesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListNamespacesResponse -> f ListNamespacesResponse
listNamespacesResponse_nextToken = (ListNamespacesResponse -> Maybe Text)
-> (ListNamespacesResponse -> Maybe Text -> ListNamespacesResponse)
-> Lens' ListNamespacesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNamespacesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListNamespacesResponse' :: ListNamespacesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListNamespacesResponse
s@ListNamespacesResponse' {} Maybe Text
a -> ListNamespacesResponse
s {$sel:nextToken:ListNamespacesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListNamespacesResponse)

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

instance Prelude.NFData ListNamespacesResponse