{-# 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.ListInstances
-- 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 instances that you registered by
-- using a specified service.
--
-- This operation returns paginated results.
module Amazonka.Route53AutoNaming.ListInstances
  ( -- * Creating a Request
    ListInstances (..),
    newListInstances,

    -- * Request Lenses
    listInstances_nextToken,
    listInstances_maxResults,
    listInstances_serviceId,

    -- * Destructuring the Response
    ListInstancesResponse (..),
    newListInstancesResponse,

    -- * Response Lenses
    listInstancesResponse_nextToken,
    listInstancesResponse_instances,
    listInstancesResponse_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:/ 'newListInstances' smart constructor.
data ListInstances = ListInstances'
  { -- | For the first @ListInstances@ request, omit this value.
    --
    -- If more than @MaxResults@ instances match the specified criteria, you
    -- can submit another @ListInstances@ request to get the next group of
    -- results. Specify the value of @NextToken@ from the previous response in
    -- the next request.
    ListInstances -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of instances that you want Cloud Map to return in the
    -- response to a @ListInstances@ request. If you don\'t specify a value for
    -- @MaxResults@, Cloud Map returns up to 100 instances.
    ListInstances -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ID of the service that you want to list instances for.
    ListInstances -> Text
serviceId :: Prelude.Text
  }
  deriving (ListInstances -> ListInstances -> Bool
(ListInstances -> ListInstances -> Bool)
-> (ListInstances -> ListInstances -> Bool) -> Eq ListInstances
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListInstances -> ListInstances -> Bool
$c/= :: ListInstances -> ListInstances -> Bool
== :: ListInstances -> ListInstances -> Bool
$c== :: ListInstances -> ListInstances -> Bool
Prelude.Eq, ReadPrec [ListInstances]
ReadPrec ListInstances
Int -> ReadS ListInstances
ReadS [ListInstances]
(Int -> ReadS ListInstances)
-> ReadS [ListInstances]
-> ReadPrec ListInstances
-> ReadPrec [ListInstances]
-> Read ListInstances
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListInstances]
$creadListPrec :: ReadPrec [ListInstances]
readPrec :: ReadPrec ListInstances
$creadPrec :: ReadPrec ListInstances
readList :: ReadS [ListInstances]
$creadList :: ReadS [ListInstances]
readsPrec :: Int -> ReadS ListInstances
$creadsPrec :: Int -> ReadS ListInstances
Prelude.Read, Int -> ListInstances -> ShowS
[ListInstances] -> ShowS
ListInstances -> String
(Int -> ListInstances -> ShowS)
-> (ListInstances -> String)
-> ([ListInstances] -> ShowS)
-> Show ListInstances
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListInstances] -> ShowS
$cshowList :: [ListInstances] -> ShowS
show :: ListInstances -> String
$cshow :: ListInstances -> String
showsPrec :: Int -> ListInstances -> ShowS
$cshowsPrec :: Int -> ListInstances -> ShowS
Prelude.Show, (forall x. ListInstances -> Rep ListInstances x)
-> (forall x. Rep ListInstances x -> ListInstances)
-> Generic ListInstances
forall x. Rep ListInstances x -> ListInstances
forall x. ListInstances -> Rep ListInstances x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListInstances x -> ListInstances
$cfrom :: forall x. ListInstances -> Rep ListInstances x
Prelude.Generic)

-- |
-- Create a value of 'ListInstances' 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', 'listInstances_nextToken' - For the first @ListInstances@ request, omit this value.
--
-- If more than @MaxResults@ instances match the specified criteria, you
-- can submit another @ListInstances@ request to get the next group of
-- results. Specify the value of @NextToken@ from the previous response in
-- the next request.
--
-- 'maxResults', 'listInstances_maxResults' - The maximum number of instances that you want Cloud Map to return in the
-- response to a @ListInstances@ request. If you don\'t specify a value for
-- @MaxResults@, Cloud Map returns up to 100 instances.
--
-- 'serviceId', 'listInstances_serviceId' - The ID of the service that you want to list instances for.
newListInstances ::
  -- | 'serviceId'
  Prelude.Text ->
  ListInstances
newListInstances :: Text -> ListInstances
newListInstances Text
pServiceId_ =
  ListInstances' :: Maybe Text -> Maybe Natural -> Text -> ListInstances
ListInstances'
    { $sel:nextToken:ListInstances' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListInstances' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceId:ListInstances' :: Text
serviceId = Text
pServiceId_
    }

-- | For the first @ListInstances@ request, omit this value.
--
-- If more than @MaxResults@ instances match the specified criteria, you
-- can submit another @ListInstances@ request to get the next group of
-- results. Specify the value of @NextToken@ from the previous response in
-- the next request.
listInstances_nextToken :: Lens.Lens' ListInstances (Prelude.Maybe Prelude.Text)
listInstances_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListInstances -> f ListInstances
listInstances_nextToken = (ListInstances -> Maybe Text)
-> (ListInstances -> Maybe Text -> ListInstances)
-> Lens ListInstances ListInstances (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInstances' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListInstances' :: ListInstances -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListInstances
s@ListInstances' {} Maybe Text
a -> ListInstances
s {$sel:nextToken:ListInstances' :: Maybe Text
nextToken = Maybe Text
a} :: ListInstances)

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

-- | The ID of the service that you want to list instances for.
listInstances_serviceId :: Lens.Lens' ListInstances Prelude.Text
listInstances_serviceId :: (Text -> f Text) -> ListInstances -> f ListInstances
listInstances_serviceId = (ListInstances -> Text)
-> (ListInstances -> Text -> ListInstances)
-> Lens ListInstances ListInstances Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInstances' {Text
serviceId :: Text
$sel:serviceId:ListInstances' :: ListInstances -> Text
serviceId} -> Text
serviceId) (\s :: ListInstances
s@ListInstances' {} Text
a -> ListInstances
s {$sel:serviceId:ListInstances' :: Text
serviceId = Text
a} :: ListInstances)

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

instance Prelude.NFData ListInstances

instance Core.ToHeaders ListInstances where
  toHeaders :: ListInstances -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListInstances -> 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.ListInstances" ::
                          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 ListInstances where
  toJSON :: ListInstances -> Value
toJSON ListInstances' {Maybe Natural
Maybe Text
Text
serviceId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:serviceId:ListInstances' :: ListInstances -> Text
$sel:maxResults:ListInstances' :: ListInstances -> Maybe Natural
$sel:nextToken:ListInstances' :: ListInstances -> 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
"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,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ServiceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serviceId)
          ]
      )

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

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

-- | /See:/ 'newListInstancesResponse' smart constructor.
data ListInstancesResponse = ListInstancesResponse'
  { -- | If more than @MaxResults@ instances match the specified criteria, you
    -- can submit another @ListInstances@ request to get the next group of
    -- results. Specify the value of @NextToken@ from the previous response in
    -- the next request.
    ListInstancesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Summary information about the instances that are associated with the
    -- specified service.
    ListInstancesResponse -> Maybe [InstanceSummary]
instances :: Prelude.Maybe [InstanceSummary],
    -- | The response's http status code.
    ListInstancesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListInstancesResponse -> ListInstancesResponse -> Bool
(ListInstancesResponse -> ListInstancesResponse -> Bool)
-> (ListInstancesResponse -> ListInstancesResponse -> Bool)
-> Eq ListInstancesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListInstancesResponse -> ListInstancesResponse -> Bool
$c/= :: ListInstancesResponse -> ListInstancesResponse -> Bool
== :: ListInstancesResponse -> ListInstancesResponse -> Bool
$c== :: ListInstancesResponse -> ListInstancesResponse -> Bool
Prelude.Eq, ReadPrec [ListInstancesResponse]
ReadPrec ListInstancesResponse
Int -> ReadS ListInstancesResponse
ReadS [ListInstancesResponse]
(Int -> ReadS ListInstancesResponse)
-> ReadS [ListInstancesResponse]
-> ReadPrec ListInstancesResponse
-> ReadPrec [ListInstancesResponse]
-> Read ListInstancesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListInstancesResponse]
$creadListPrec :: ReadPrec [ListInstancesResponse]
readPrec :: ReadPrec ListInstancesResponse
$creadPrec :: ReadPrec ListInstancesResponse
readList :: ReadS [ListInstancesResponse]
$creadList :: ReadS [ListInstancesResponse]
readsPrec :: Int -> ReadS ListInstancesResponse
$creadsPrec :: Int -> ReadS ListInstancesResponse
Prelude.Read, Int -> ListInstancesResponse -> ShowS
[ListInstancesResponse] -> ShowS
ListInstancesResponse -> String
(Int -> ListInstancesResponse -> ShowS)
-> (ListInstancesResponse -> String)
-> ([ListInstancesResponse] -> ShowS)
-> Show ListInstancesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListInstancesResponse] -> ShowS
$cshowList :: [ListInstancesResponse] -> ShowS
show :: ListInstancesResponse -> String
$cshow :: ListInstancesResponse -> String
showsPrec :: Int -> ListInstancesResponse -> ShowS
$cshowsPrec :: Int -> ListInstancesResponse -> ShowS
Prelude.Show, (forall x. ListInstancesResponse -> Rep ListInstancesResponse x)
-> (forall x. Rep ListInstancesResponse x -> ListInstancesResponse)
-> Generic ListInstancesResponse
forall x. Rep ListInstancesResponse x -> ListInstancesResponse
forall x. ListInstancesResponse -> Rep ListInstancesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListInstancesResponse x -> ListInstancesResponse
$cfrom :: forall x. ListInstancesResponse -> Rep ListInstancesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListInstancesResponse' 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', 'listInstancesResponse_nextToken' - If more than @MaxResults@ instances match the specified criteria, you
-- can submit another @ListInstances@ request to get the next group of
-- results. Specify the value of @NextToken@ from the previous response in
-- the next request.
--
-- 'instances', 'listInstancesResponse_instances' - Summary information about the instances that are associated with the
-- specified service.
--
-- 'httpStatus', 'listInstancesResponse_httpStatus' - The response's http status code.
newListInstancesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListInstancesResponse
newListInstancesResponse :: Int -> ListInstancesResponse
newListInstancesResponse Int
pHttpStatus_ =
  ListInstancesResponse' :: Maybe Text
-> Maybe [InstanceSummary] -> Int -> ListInstancesResponse
ListInstancesResponse'
    { $sel:nextToken:ListInstancesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:instances:ListInstancesResponse' :: Maybe [InstanceSummary]
instances = Maybe [InstanceSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListInstancesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If more than @MaxResults@ instances match the specified criteria, you
-- can submit another @ListInstances@ request to get the next group of
-- results. Specify the value of @NextToken@ from the previous response in
-- the next request.
listInstancesResponse_nextToken :: Lens.Lens' ListInstancesResponse (Prelude.Maybe Prelude.Text)
listInstancesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListInstancesResponse -> f ListInstancesResponse
listInstancesResponse_nextToken = (ListInstancesResponse -> Maybe Text)
-> (ListInstancesResponse -> Maybe Text -> ListInstancesResponse)
-> Lens' ListInstancesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInstancesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListInstancesResponse' :: ListInstancesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListInstancesResponse
s@ListInstancesResponse' {} Maybe Text
a -> ListInstancesResponse
s {$sel:nextToken:ListInstancesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListInstancesResponse)

-- | Summary information about the instances that are associated with the
-- specified service.
listInstancesResponse_instances :: Lens.Lens' ListInstancesResponse (Prelude.Maybe [InstanceSummary])
listInstancesResponse_instances :: (Maybe [InstanceSummary] -> f (Maybe [InstanceSummary]))
-> ListInstancesResponse -> f ListInstancesResponse
listInstancesResponse_instances = (ListInstancesResponse -> Maybe [InstanceSummary])
-> (ListInstancesResponse
    -> Maybe [InstanceSummary] -> ListInstancesResponse)
-> Lens' ListInstancesResponse (Maybe [InstanceSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInstancesResponse' {Maybe [InstanceSummary]
instances :: Maybe [InstanceSummary]
$sel:instances:ListInstancesResponse' :: ListInstancesResponse -> Maybe [InstanceSummary]
instances} -> Maybe [InstanceSummary]
instances) (\s :: ListInstancesResponse
s@ListInstancesResponse' {} Maybe [InstanceSummary]
a -> ListInstancesResponse
s {$sel:instances:ListInstancesResponse' :: Maybe [InstanceSummary]
instances = Maybe [InstanceSummary]
a} :: ListInstancesResponse) ((Maybe [InstanceSummary] -> f (Maybe [InstanceSummary]))
 -> ListInstancesResponse -> f ListInstancesResponse)
-> ((Maybe [InstanceSummary] -> f (Maybe [InstanceSummary]))
    -> Maybe [InstanceSummary] -> f (Maybe [InstanceSummary]))
-> (Maybe [InstanceSummary] -> f (Maybe [InstanceSummary]))
-> ListInstancesResponse
-> f ListInstancesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [InstanceSummary]
  [InstanceSummary]
  [InstanceSummary]
  [InstanceSummary]
-> Iso
     (Maybe [InstanceSummary])
     (Maybe [InstanceSummary])
     (Maybe [InstanceSummary])
     (Maybe [InstanceSummary])
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
  [InstanceSummary]
  [InstanceSummary]
  [InstanceSummary]
  [InstanceSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListInstancesResponse