{-# 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.ListServices
-- 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 for all the services that are associated with
-- one or more specified namespaces.
--
-- This operation returns paginated results.
module Amazonka.Route53AutoNaming.ListServices
  ( -- * Creating a Request
    ListServices (..),
    newListServices,

    -- * Request Lenses
    listServices_filters,
    listServices_nextToken,
    listServices_maxResults,

    -- * Destructuring the Response
    ListServicesResponse (..),
    newListServicesResponse,

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

-- |
-- Create a value of 'ListServices' 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', 'listServices_filters' - A complex type that contains specifications for the namespaces that you
-- want to list services for.
--
-- If you specify more than one filter, an operation must match all filters
-- to be returned by @ListServices@.
--
-- 'nextToken', 'listServices_nextToken' - For the first @ListServices@ request, omit this value.
--
-- If the response contains @NextToken@, submit another @ListServices@
-- 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@ services and then filters them based on the
-- specified criteria. It\'s possible that no services in the first
-- @MaxResults@ services matched the specified criteria but that subsequent
-- groups of @MaxResults@ services do contain services that match the
-- criteria.
--
-- 'maxResults', 'listServices_maxResults' - The maximum number of services that you want Cloud Map to return in the
-- response to a @ListServices@ request. If you don\'t specify a value for
-- @MaxResults@, Cloud Map returns up to 100 services.
newListServices ::
  ListServices
newListServices :: ListServices
newListServices =
  ListServices' :: Maybe [ServiceFilter]
-> Maybe Text -> Maybe Natural -> ListServices
ListServices'
    { $sel:filters:ListServices' :: Maybe [ServiceFilter]
filters = Maybe [ServiceFilter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListServices' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListServices' :: 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 services for.
--
-- If you specify more than one filter, an operation must match all filters
-- to be returned by @ListServices@.
listServices_filters :: Lens.Lens' ListServices (Prelude.Maybe [ServiceFilter])
listServices_filters :: (Maybe [ServiceFilter] -> f (Maybe [ServiceFilter]))
-> ListServices -> f ListServices
listServices_filters = (ListServices -> Maybe [ServiceFilter])
-> (ListServices -> Maybe [ServiceFilter] -> ListServices)
-> Lens
     ListServices
     ListServices
     (Maybe [ServiceFilter])
     (Maybe [ServiceFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServices' {Maybe [ServiceFilter]
filters :: Maybe [ServiceFilter]
$sel:filters:ListServices' :: ListServices -> Maybe [ServiceFilter]
filters} -> Maybe [ServiceFilter]
filters) (\s :: ListServices
s@ListServices' {} Maybe [ServiceFilter]
a -> ListServices
s {$sel:filters:ListServices' :: Maybe [ServiceFilter]
filters = Maybe [ServiceFilter]
a} :: ListServices) ((Maybe [ServiceFilter] -> f (Maybe [ServiceFilter]))
 -> ListServices -> f ListServices)
-> ((Maybe [ServiceFilter] -> f (Maybe [ServiceFilter]))
    -> Maybe [ServiceFilter] -> f (Maybe [ServiceFilter]))
-> (Maybe [ServiceFilter] -> f (Maybe [ServiceFilter]))
-> ListServices
-> f ListServices
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ServiceFilter] [ServiceFilter] [ServiceFilter] [ServiceFilter]
-> Iso
     (Maybe [ServiceFilter])
     (Maybe [ServiceFilter])
     (Maybe [ServiceFilter])
     (Maybe [ServiceFilter])
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
  [ServiceFilter] [ServiceFilter] [ServiceFilter] [ServiceFilter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | For the first @ListServices@ request, omit this value.
--
-- If the response contains @NextToken@, submit another @ListServices@
-- 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@ services and then filters them based on the
-- specified criteria. It\'s possible that no services in the first
-- @MaxResults@ services matched the specified criteria but that subsequent
-- groups of @MaxResults@ services do contain services that match the
-- criteria.
listServices_nextToken :: Lens.Lens' ListServices (Prelude.Maybe Prelude.Text)
listServices_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListServices -> f ListServices
listServices_nextToken = (ListServices -> Maybe Text)
-> (ListServices -> Maybe Text -> ListServices)
-> Lens ListServices ListServices (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServices' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListServices' :: ListServices -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListServices
s@ListServices' {} Maybe Text
a -> ListServices
s {$sel:nextToken:ListServices' :: Maybe Text
nextToken = Maybe Text
a} :: ListServices)

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

instance Core.AWSPager ListServices where
  page :: ListServices -> AWSResponse ListServices -> Maybe ListServices
page ListServices
rq AWSResponse ListServices
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListServices
ListServicesResponse
rs
            ListServicesResponse
-> Getting (First Text) ListServicesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListServicesResponse -> Const (First Text) ListServicesResponse
Lens' ListServicesResponse (Maybe Text)
listServicesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListServicesResponse -> Const (First Text) ListServicesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListServicesResponse 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 ListServices
forall a. Maybe a
Prelude.Nothing
    | Maybe [ServiceSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListServices
ListServicesResponse
rs
            ListServicesResponse
-> Getting
     (First [ServiceSummary]) ListServicesResponse [ServiceSummary]
-> Maybe [ServiceSummary]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ServiceSummary]
 -> Const (First [ServiceSummary]) (Maybe [ServiceSummary]))
-> ListServicesResponse
-> Const (First [ServiceSummary]) ListServicesResponse
Lens' ListServicesResponse (Maybe [ServiceSummary])
listServicesResponse_services ((Maybe [ServiceSummary]
  -> Const (First [ServiceSummary]) (Maybe [ServiceSummary]))
 -> ListServicesResponse
 -> Const (First [ServiceSummary]) ListServicesResponse)
-> (([ServiceSummary]
     -> Const (First [ServiceSummary]) [ServiceSummary])
    -> Maybe [ServiceSummary]
    -> Const (First [ServiceSummary]) (Maybe [ServiceSummary]))
-> Getting
     (First [ServiceSummary]) ListServicesResponse [ServiceSummary]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ServiceSummary]
 -> Const (First [ServiceSummary]) [ServiceSummary])
-> Maybe [ServiceSummary]
-> Const (First [ServiceSummary]) (Maybe [ServiceSummary])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListServices
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListServices -> Maybe ListServices
forall a. a -> Maybe a
Prelude.Just (ListServices -> Maybe ListServices)
-> ListServices -> Maybe ListServices
forall a b. (a -> b) -> a -> b
Prelude.$
        ListServices
rq
          ListServices -> (ListServices -> ListServices) -> ListServices
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListServices -> Identity ListServices
Lens ListServices ListServices (Maybe Text) (Maybe Text)
listServices_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListServices -> Identity ListServices)
-> Maybe Text -> ListServices -> ListServices
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListServices
ListServicesResponse
rs
          ListServicesResponse
-> Getting (First Text) ListServicesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListServicesResponse -> Const (First Text) ListServicesResponse
Lens' ListServicesResponse (Maybe Text)
listServicesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListServicesResponse -> Const (First Text) ListServicesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListServicesResponse 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 ListServices where
  type AWSResponse ListServices = ListServicesResponse
  request :: ListServices -> Request ListServices
request = Service -> ListServices -> Request ListServices
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListServices
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListServices)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListServices))
-> Logger
-> Service
-> Proxy ListServices
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListServices)))
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 [ServiceSummary] -> Int -> ListServicesResponse
ListServicesResponse'
            (Maybe Text
 -> Maybe [ServiceSummary] -> Int -> ListServicesResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe [ServiceSummary] -> Int -> ListServicesResponse)
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 [ServiceSummary] -> Int -> ListServicesResponse)
-> Either String (Maybe [ServiceSummary])
-> Either String (Int -> ListServicesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [ServiceSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Services" Either String (Maybe (Maybe [ServiceSummary]))
-> Maybe [ServiceSummary] -> Either String (Maybe [ServiceSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ServiceSummary]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> ListServicesResponse)
-> Either String Int -> Either String ListServicesResponse
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 ListServices

instance Prelude.NFData ListServices

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

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

-- | /See:/ 'newListServicesResponse' smart constructor.
data ListServicesResponse = ListServicesResponse'
  { -- | If the response contains @NextToken@, submit another @ListServices@
    -- 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@ services and then filters them based on the
    -- specified criteria. It\'s possible that no services in the first
    -- @MaxResults@ services matched the specified criteria but that subsequent
    -- groups of @MaxResults@ services do contain services that match the
    -- criteria.
    ListServicesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An array that contains one @ServiceSummary@ object for each service that
    -- matches the specified filter criteria.
    ListServicesResponse -> Maybe [ServiceSummary]
services :: Prelude.Maybe [ServiceSummary],
    -- | The response's http status code.
    ListServicesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListServicesResponse -> ListServicesResponse -> Bool
(ListServicesResponse -> ListServicesResponse -> Bool)
-> (ListServicesResponse -> ListServicesResponse -> Bool)
-> Eq ListServicesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListServicesResponse -> ListServicesResponse -> Bool
$c/= :: ListServicesResponse -> ListServicesResponse -> Bool
== :: ListServicesResponse -> ListServicesResponse -> Bool
$c== :: ListServicesResponse -> ListServicesResponse -> Bool
Prelude.Eq, ReadPrec [ListServicesResponse]
ReadPrec ListServicesResponse
Int -> ReadS ListServicesResponse
ReadS [ListServicesResponse]
(Int -> ReadS ListServicesResponse)
-> ReadS [ListServicesResponse]
-> ReadPrec ListServicesResponse
-> ReadPrec [ListServicesResponse]
-> Read ListServicesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListServicesResponse]
$creadListPrec :: ReadPrec [ListServicesResponse]
readPrec :: ReadPrec ListServicesResponse
$creadPrec :: ReadPrec ListServicesResponse
readList :: ReadS [ListServicesResponse]
$creadList :: ReadS [ListServicesResponse]
readsPrec :: Int -> ReadS ListServicesResponse
$creadsPrec :: Int -> ReadS ListServicesResponse
Prelude.Read, Int -> ListServicesResponse -> ShowS
[ListServicesResponse] -> ShowS
ListServicesResponse -> String
(Int -> ListServicesResponse -> ShowS)
-> (ListServicesResponse -> String)
-> ([ListServicesResponse] -> ShowS)
-> Show ListServicesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListServicesResponse] -> ShowS
$cshowList :: [ListServicesResponse] -> ShowS
show :: ListServicesResponse -> String
$cshow :: ListServicesResponse -> String
showsPrec :: Int -> ListServicesResponse -> ShowS
$cshowsPrec :: Int -> ListServicesResponse -> ShowS
Prelude.Show, (forall x. ListServicesResponse -> Rep ListServicesResponse x)
-> (forall x. Rep ListServicesResponse x -> ListServicesResponse)
-> Generic ListServicesResponse
forall x. Rep ListServicesResponse x -> ListServicesResponse
forall x. ListServicesResponse -> Rep ListServicesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListServicesResponse x -> ListServicesResponse
$cfrom :: forall x. ListServicesResponse -> Rep ListServicesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListServicesResponse' 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:
--
-- 'nextToken', 'listServicesResponse_nextToken' - If the response contains @NextToken@, submit another @ListServices@
-- 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@ services and then filters them based on the
-- specified criteria. It\'s possible that no services in the first
-- @MaxResults@ services matched the specified criteria but that subsequent
-- groups of @MaxResults@ services do contain services that match the
-- criteria.
--
-- 'services', 'listServicesResponse_services' - An array that contains one @ServiceSummary@ object for each service that
-- matches the specified filter criteria.
--
-- 'httpStatus', 'listServicesResponse_httpStatus' - The response's http status code.
newListServicesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListServicesResponse
newListServicesResponse :: Int -> ListServicesResponse
newListServicesResponse Int
pHttpStatus_ =
  ListServicesResponse' :: Maybe Text -> Maybe [ServiceSummary] -> Int -> ListServicesResponse
ListServicesResponse'
    { $sel:nextToken:ListServicesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:services:ListServicesResponse' :: Maybe [ServiceSummary]
services = Maybe [ServiceSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListServicesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If the response contains @NextToken@, submit another @ListServices@
-- 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@ services and then filters them based on the
-- specified criteria. It\'s possible that no services in the first
-- @MaxResults@ services matched the specified criteria but that subsequent
-- groups of @MaxResults@ services do contain services that match the
-- criteria.
listServicesResponse_nextToken :: Lens.Lens' ListServicesResponse (Prelude.Maybe Prelude.Text)
listServicesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListServicesResponse -> f ListServicesResponse
listServicesResponse_nextToken = (ListServicesResponse -> Maybe Text)
-> (ListServicesResponse -> Maybe Text -> ListServicesResponse)
-> Lens' ListServicesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServicesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListServicesResponse' :: ListServicesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListServicesResponse
s@ListServicesResponse' {} Maybe Text
a -> ListServicesResponse
s {$sel:nextToken:ListServicesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListServicesResponse)

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

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

instance Prelude.NFData ListServicesResponse