{-# 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.CloudFormation.ListStackInstances
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns summary information about stack instances that are associated
-- with the specified stack set. You can filter for stack instances that
-- are associated with a specific Amazon Web Services account name or
-- Region, or that have a specific status.
--
-- This operation returns paginated results.
module Amazonka.CloudFormation.ListStackInstances
  ( -- * Creating a Request
    ListStackInstances (..),
    newListStackInstances,

    -- * Request Lenses
    listStackInstances_callAs,
    listStackInstances_filters,
    listStackInstances_maxResults,
    listStackInstances_nextToken,
    listStackInstances_stackInstanceAccount,
    listStackInstances_stackInstanceRegion,
    listStackInstances_stackSetName,

    -- * Destructuring the Response
    ListStackInstancesResponse (..),
    newListStackInstancesResponse,

    -- * Response Lenses
    listStackInstancesResponse_nextToken,
    listStackInstancesResponse_summaries,
    listStackInstancesResponse_httpStatus,
  )
where

import Amazonka.CloudFormation.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:/ 'newListStackInstances' smart constructor.
data ListStackInstances = ListStackInstances'
  { -- | [Service-managed permissions] Specifies whether you are acting as an
    -- account administrator in the organization\'s management account or as a
    -- delegated administrator in a member account.
    --
    -- By default, @SELF@ is specified. Use @SELF@ for stack sets with
    -- self-managed permissions.
    --
    -- -   If you are signed in to the management account, specify @SELF@.
    --
    -- -   If you are signed in to a delegated administrator account, specify
    --     @DELEGATED_ADMIN@.
    --
    --     Your Amazon Web Services account must be registered as a delegated
    --     administrator in the management account. For more information, see
    --     <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-orgs-delegated-admin.html Register a delegated administrator>
    --     in the /CloudFormation User Guide/.
    ListStackInstances -> Maybe CallAs
callAs :: Prelude.Maybe CallAs,
    -- | The filter to apply to stack instances
    ListStackInstances -> Maybe [StackInstanceFilter]
filters :: Prelude.Maybe [StackInstanceFilter],
    -- | The maximum number of results to be returned with a single call. If the
    -- number of available results exceeds this maximum, the response includes
    -- a @NextToken@ value that you can assign to the @NextToken@ request
    -- parameter to get the next set of results.
    ListStackInstances -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | If the previous request didn\'t return all the remaining results, the
    -- response\'s @NextToken@ parameter value is set to a token. To retrieve
    -- the next set of results, call @ListStackInstances@ again and assign that
    -- token to the request object\'s @NextToken@ parameter. If there are no
    -- remaining results, the previous response object\'s @NextToken@ parameter
    -- is set to @null@.
    ListStackInstances -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The name of the Amazon Web Services account that you want to list stack
    -- instances for.
    ListStackInstances -> Maybe Text
stackInstanceAccount :: Prelude.Maybe Prelude.Text,
    -- | The name of the Region where you want to list stack instances.
    ListStackInstances -> Maybe Text
stackInstanceRegion :: Prelude.Maybe Prelude.Text,
    -- | The name or unique ID of the stack set that you want to list stack
    -- instances for.
    ListStackInstances -> Text
stackSetName :: Prelude.Text
  }
  deriving (ListStackInstances -> ListStackInstances -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListStackInstances -> ListStackInstances -> Bool
$c/= :: ListStackInstances -> ListStackInstances -> Bool
== :: ListStackInstances -> ListStackInstances -> Bool
$c== :: ListStackInstances -> ListStackInstances -> Bool
Prelude.Eq, ReadPrec [ListStackInstances]
ReadPrec ListStackInstances
Int -> ReadS ListStackInstances
ReadS [ListStackInstances]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListStackInstances]
$creadListPrec :: ReadPrec [ListStackInstances]
readPrec :: ReadPrec ListStackInstances
$creadPrec :: ReadPrec ListStackInstances
readList :: ReadS [ListStackInstances]
$creadList :: ReadS [ListStackInstances]
readsPrec :: Int -> ReadS ListStackInstances
$creadsPrec :: Int -> ReadS ListStackInstances
Prelude.Read, Int -> ListStackInstances -> ShowS
[ListStackInstances] -> ShowS
ListStackInstances -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListStackInstances] -> ShowS
$cshowList :: [ListStackInstances] -> ShowS
show :: ListStackInstances -> String
$cshow :: ListStackInstances -> String
showsPrec :: Int -> ListStackInstances -> ShowS
$cshowsPrec :: Int -> ListStackInstances -> ShowS
Prelude.Show, forall x. Rep ListStackInstances x -> ListStackInstances
forall x. ListStackInstances -> Rep ListStackInstances x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListStackInstances x -> ListStackInstances
$cfrom :: forall x. ListStackInstances -> Rep ListStackInstances x
Prelude.Generic)

-- |
-- Create a value of 'ListStackInstances' 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:
--
-- 'callAs', 'listStackInstances_callAs' - [Service-managed permissions] Specifies whether you are acting as an
-- account administrator in the organization\'s management account or as a
-- delegated administrator in a member account.
--
-- By default, @SELF@ is specified. Use @SELF@ for stack sets with
-- self-managed permissions.
--
-- -   If you are signed in to the management account, specify @SELF@.
--
-- -   If you are signed in to a delegated administrator account, specify
--     @DELEGATED_ADMIN@.
--
--     Your Amazon Web Services account must be registered as a delegated
--     administrator in the management account. For more information, see
--     <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-orgs-delegated-admin.html Register a delegated administrator>
--     in the /CloudFormation User Guide/.
--
-- 'filters', 'listStackInstances_filters' - The filter to apply to stack instances
--
-- 'maxResults', 'listStackInstances_maxResults' - The maximum number of results to be returned with a single call. If the
-- number of available results exceeds this maximum, the response includes
-- a @NextToken@ value that you can assign to the @NextToken@ request
-- parameter to get the next set of results.
--
-- 'nextToken', 'listStackInstances_nextToken' - If the previous request didn\'t return all the remaining results, the
-- response\'s @NextToken@ parameter value is set to a token. To retrieve
-- the next set of results, call @ListStackInstances@ again and assign that
-- token to the request object\'s @NextToken@ parameter. If there are no
-- remaining results, the previous response object\'s @NextToken@ parameter
-- is set to @null@.
--
-- 'stackInstanceAccount', 'listStackInstances_stackInstanceAccount' - The name of the Amazon Web Services account that you want to list stack
-- instances for.
--
-- 'stackInstanceRegion', 'listStackInstances_stackInstanceRegion' - The name of the Region where you want to list stack instances.
--
-- 'stackSetName', 'listStackInstances_stackSetName' - The name or unique ID of the stack set that you want to list stack
-- instances for.
newListStackInstances ::
  -- | 'stackSetName'
  Prelude.Text ->
  ListStackInstances
newListStackInstances :: Text -> ListStackInstances
newListStackInstances Text
pStackSetName_ =
  ListStackInstances'
    { $sel:callAs:ListStackInstances' :: Maybe CallAs
callAs = forall a. Maybe a
Prelude.Nothing,
      $sel:filters:ListStackInstances' :: Maybe [StackInstanceFilter]
filters = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListStackInstances' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListStackInstances' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:stackInstanceAccount:ListStackInstances' :: Maybe Text
stackInstanceAccount = forall a. Maybe a
Prelude.Nothing,
      $sel:stackInstanceRegion:ListStackInstances' :: Maybe Text
stackInstanceRegion = forall a. Maybe a
Prelude.Nothing,
      $sel:stackSetName:ListStackInstances' :: Text
stackSetName = Text
pStackSetName_
    }

-- | [Service-managed permissions] Specifies whether you are acting as an
-- account administrator in the organization\'s management account or as a
-- delegated administrator in a member account.
--
-- By default, @SELF@ is specified. Use @SELF@ for stack sets with
-- self-managed permissions.
--
-- -   If you are signed in to the management account, specify @SELF@.
--
-- -   If you are signed in to a delegated administrator account, specify
--     @DELEGATED_ADMIN@.
--
--     Your Amazon Web Services account must be registered as a delegated
--     administrator in the management account. For more information, see
--     <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-orgs-delegated-admin.html Register a delegated administrator>
--     in the /CloudFormation User Guide/.
listStackInstances_callAs :: Lens.Lens' ListStackInstances (Prelude.Maybe CallAs)
listStackInstances_callAs :: Lens' ListStackInstances (Maybe CallAs)
listStackInstances_callAs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStackInstances' {Maybe CallAs
callAs :: Maybe CallAs
$sel:callAs:ListStackInstances' :: ListStackInstances -> Maybe CallAs
callAs} -> Maybe CallAs
callAs) (\s :: ListStackInstances
s@ListStackInstances' {} Maybe CallAs
a -> ListStackInstances
s {$sel:callAs:ListStackInstances' :: Maybe CallAs
callAs = Maybe CallAs
a} :: ListStackInstances)

-- | The filter to apply to stack instances
listStackInstances_filters :: Lens.Lens' ListStackInstances (Prelude.Maybe [StackInstanceFilter])
listStackInstances_filters :: Lens' ListStackInstances (Maybe [StackInstanceFilter])
listStackInstances_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStackInstances' {Maybe [StackInstanceFilter]
filters :: Maybe [StackInstanceFilter]
$sel:filters:ListStackInstances' :: ListStackInstances -> Maybe [StackInstanceFilter]
filters} -> Maybe [StackInstanceFilter]
filters) (\s :: ListStackInstances
s@ListStackInstances' {} Maybe [StackInstanceFilter]
a -> ListStackInstances
s {$sel:filters:ListStackInstances' :: Maybe [StackInstanceFilter]
filters = Maybe [StackInstanceFilter]
a} :: ListStackInstances) 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 maximum number of results to be returned with a single call. If the
-- number of available results exceeds this maximum, the response includes
-- a @NextToken@ value that you can assign to the @NextToken@ request
-- parameter to get the next set of results.
listStackInstances_maxResults :: Lens.Lens' ListStackInstances (Prelude.Maybe Prelude.Natural)
listStackInstances_maxResults :: Lens' ListStackInstances (Maybe Natural)
listStackInstances_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStackInstances' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListStackInstances' :: ListStackInstances -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListStackInstances
s@ListStackInstances' {} Maybe Natural
a -> ListStackInstances
s {$sel:maxResults:ListStackInstances' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListStackInstances)

-- | If the previous request didn\'t return all the remaining results, the
-- response\'s @NextToken@ parameter value is set to a token. To retrieve
-- the next set of results, call @ListStackInstances@ again and assign that
-- token to the request object\'s @NextToken@ parameter. If there are no
-- remaining results, the previous response object\'s @NextToken@ parameter
-- is set to @null@.
listStackInstances_nextToken :: Lens.Lens' ListStackInstances (Prelude.Maybe Prelude.Text)
listStackInstances_nextToken :: Lens' ListStackInstances (Maybe Text)
listStackInstances_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStackInstances' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListStackInstances' :: ListStackInstances -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListStackInstances
s@ListStackInstances' {} Maybe Text
a -> ListStackInstances
s {$sel:nextToken:ListStackInstances' :: Maybe Text
nextToken = Maybe Text
a} :: ListStackInstances)

-- | The name of the Amazon Web Services account that you want to list stack
-- instances for.
listStackInstances_stackInstanceAccount :: Lens.Lens' ListStackInstances (Prelude.Maybe Prelude.Text)
listStackInstances_stackInstanceAccount :: Lens' ListStackInstances (Maybe Text)
listStackInstances_stackInstanceAccount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStackInstances' {Maybe Text
stackInstanceAccount :: Maybe Text
$sel:stackInstanceAccount:ListStackInstances' :: ListStackInstances -> Maybe Text
stackInstanceAccount} -> Maybe Text
stackInstanceAccount) (\s :: ListStackInstances
s@ListStackInstances' {} Maybe Text
a -> ListStackInstances
s {$sel:stackInstanceAccount:ListStackInstances' :: Maybe Text
stackInstanceAccount = Maybe Text
a} :: ListStackInstances)

-- | The name of the Region where you want to list stack instances.
listStackInstances_stackInstanceRegion :: Lens.Lens' ListStackInstances (Prelude.Maybe Prelude.Text)
listStackInstances_stackInstanceRegion :: Lens' ListStackInstances (Maybe Text)
listStackInstances_stackInstanceRegion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStackInstances' {Maybe Text
stackInstanceRegion :: Maybe Text
$sel:stackInstanceRegion:ListStackInstances' :: ListStackInstances -> Maybe Text
stackInstanceRegion} -> Maybe Text
stackInstanceRegion) (\s :: ListStackInstances
s@ListStackInstances' {} Maybe Text
a -> ListStackInstances
s {$sel:stackInstanceRegion:ListStackInstances' :: Maybe Text
stackInstanceRegion = Maybe Text
a} :: ListStackInstances)

-- | The name or unique ID of the stack set that you want to list stack
-- instances for.
listStackInstances_stackSetName :: Lens.Lens' ListStackInstances Prelude.Text
listStackInstances_stackSetName :: Lens' ListStackInstances Text
listStackInstances_stackSetName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStackInstances' {Text
stackSetName :: Text
$sel:stackSetName:ListStackInstances' :: ListStackInstances -> Text
stackSetName} -> Text
stackSetName) (\s :: ListStackInstances
s@ListStackInstances' {} Text
a -> ListStackInstances
s {$sel:stackSetName:ListStackInstances' :: Text
stackSetName = Text
a} :: ListStackInstances)

instance Core.AWSPager ListStackInstances where
  page :: ListStackInstances
-> AWSResponse ListStackInstances -> Maybe ListStackInstances
page ListStackInstances
rq AWSResponse ListStackInstances
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListStackInstances
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListStackInstancesResponse (Maybe Text)
listStackInstancesResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListStackInstances
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListStackInstancesResponse (Maybe [StackInstanceSummary])
listStackInstancesResponse_summaries
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListStackInstances
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListStackInstances (Maybe Text)
listStackInstances_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListStackInstances
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListStackInstancesResponse (Maybe Text)
listStackInstancesResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListStackInstances where
  type
    AWSResponse ListStackInstances =
      ListStackInstancesResponse
  request :: (Service -> Service)
-> ListStackInstances -> Request ListStackInstances
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListStackInstances
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListStackInstances)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"ListStackInstancesResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text
-> Maybe [StackInstanceSummary]
-> Int
-> ListStackInstancesResponse
ListStackInstancesResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"NextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
                            forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Summaries"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                            forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
                        )
            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 ListStackInstances where
  hashWithSalt :: Int -> ListStackInstances -> Int
hashWithSalt Int
_salt ListStackInstances' {Maybe Natural
Maybe [StackInstanceFilter]
Maybe Text
Maybe CallAs
Text
stackSetName :: Text
stackInstanceRegion :: Maybe Text
stackInstanceAccount :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [StackInstanceFilter]
callAs :: Maybe CallAs
$sel:stackSetName:ListStackInstances' :: ListStackInstances -> Text
$sel:stackInstanceRegion:ListStackInstances' :: ListStackInstances -> Maybe Text
$sel:stackInstanceAccount:ListStackInstances' :: ListStackInstances -> Maybe Text
$sel:nextToken:ListStackInstances' :: ListStackInstances -> Maybe Text
$sel:maxResults:ListStackInstances' :: ListStackInstances -> Maybe Natural
$sel:filters:ListStackInstances' :: ListStackInstances -> Maybe [StackInstanceFilter]
$sel:callAs:ListStackInstances' :: ListStackInstances -> Maybe CallAs
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CallAs
callAs
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [StackInstanceFilter]
filters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
stackInstanceAccount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
stackInstanceRegion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
stackSetName

instance Prelude.NFData ListStackInstances where
  rnf :: ListStackInstances -> ()
rnf ListStackInstances' {Maybe Natural
Maybe [StackInstanceFilter]
Maybe Text
Maybe CallAs
Text
stackSetName :: Text
stackInstanceRegion :: Maybe Text
stackInstanceAccount :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [StackInstanceFilter]
callAs :: Maybe CallAs
$sel:stackSetName:ListStackInstances' :: ListStackInstances -> Text
$sel:stackInstanceRegion:ListStackInstances' :: ListStackInstances -> Maybe Text
$sel:stackInstanceAccount:ListStackInstances' :: ListStackInstances -> Maybe Text
$sel:nextToken:ListStackInstances' :: ListStackInstances -> Maybe Text
$sel:maxResults:ListStackInstances' :: ListStackInstances -> Maybe Natural
$sel:filters:ListStackInstances' :: ListStackInstances -> Maybe [StackInstanceFilter]
$sel:callAs:ListStackInstances' :: ListStackInstances -> Maybe CallAs
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CallAs
callAs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [StackInstanceFilter]
filters
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
stackInstanceAccount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
stackInstanceRegion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
stackSetName

instance Data.ToHeaders ListStackInstances where
  toHeaders :: ListStackInstances -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

instance Data.ToQuery ListStackInstances where
  toQuery :: ListStackInstances -> QueryString
toQuery ListStackInstances' {Maybe Natural
Maybe [StackInstanceFilter]
Maybe Text
Maybe CallAs
Text
stackSetName :: Text
stackInstanceRegion :: Maybe Text
stackInstanceAccount :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [StackInstanceFilter]
callAs :: Maybe CallAs
$sel:stackSetName:ListStackInstances' :: ListStackInstances -> Text
$sel:stackInstanceRegion:ListStackInstances' :: ListStackInstances -> Maybe Text
$sel:stackInstanceAccount:ListStackInstances' :: ListStackInstances -> Maybe Text
$sel:nextToken:ListStackInstances' :: ListStackInstances -> Maybe Text
$sel:maxResults:ListStackInstances' :: ListStackInstances -> Maybe Natural
$sel:filters:ListStackInstances' :: ListStackInstances -> Maybe [StackInstanceFilter]
$sel:callAs:ListStackInstances' :: ListStackInstances -> Maybe CallAs
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"ListStackInstances" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-05-15" :: Prelude.ByteString),
        ByteString
"CallAs" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe CallAs
callAs,
        ByteString
"Filters"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a. ToQuery a => a -> QueryString
Data.toQuery
            (forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"member" forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [StackInstanceFilter]
filters),
        ByteString
"MaxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
        ByteString
"NextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken,
        ByteString
"StackInstanceAccount" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
stackInstanceAccount,
        ByteString
"StackInstanceRegion" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
stackInstanceRegion,
        ByteString
"StackSetName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
stackSetName
      ]

-- | /See:/ 'newListStackInstancesResponse' smart constructor.
data ListStackInstancesResponse = ListStackInstancesResponse'
  { -- | If the request doesn\'t return all the remaining results, @NextToken@ is
    -- set to a token. To retrieve the next set of results, call
    -- @ListStackInstances@ again and assign that token to the request
    -- object\'s @NextToken@ parameter. If the request returns all results,
    -- @NextToken@ is set to @null@.
    ListStackInstancesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of @StackInstanceSummary@ structures that contain information
    -- about the specified stack instances.
    ListStackInstancesResponse -> Maybe [StackInstanceSummary]
summaries :: Prelude.Maybe [StackInstanceSummary],
    -- | The response's http status code.
    ListStackInstancesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListStackInstancesResponse -> ListStackInstancesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListStackInstancesResponse -> ListStackInstancesResponse -> Bool
$c/= :: ListStackInstancesResponse -> ListStackInstancesResponse -> Bool
== :: ListStackInstancesResponse -> ListStackInstancesResponse -> Bool
$c== :: ListStackInstancesResponse -> ListStackInstancesResponse -> Bool
Prelude.Eq, ReadPrec [ListStackInstancesResponse]
ReadPrec ListStackInstancesResponse
Int -> ReadS ListStackInstancesResponse
ReadS [ListStackInstancesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListStackInstancesResponse]
$creadListPrec :: ReadPrec [ListStackInstancesResponse]
readPrec :: ReadPrec ListStackInstancesResponse
$creadPrec :: ReadPrec ListStackInstancesResponse
readList :: ReadS [ListStackInstancesResponse]
$creadList :: ReadS [ListStackInstancesResponse]
readsPrec :: Int -> ReadS ListStackInstancesResponse
$creadsPrec :: Int -> ReadS ListStackInstancesResponse
Prelude.Read, Int -> ListStackInstancesResponse -> ShowS
[ListStackInstancesResponse] -> ShowS
ListStackInstancesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListStackInstancesResponse] -> ShowS
$cshowList :: [ListStackInstancesResponse] -> ShowS
show :: ListStackInstancesResponse -> String
$cshow :: ListStackInstancesResponse -> String
showsPrec :: Int -> ListStackInstancesResponse -> ShowS
$cshowsPrec :: Int -> ListStackInstancesResponse -> ShowS
Prelude.Show, forall x.
Rep ListStackInstancesResponse x -> ListStackInstancesResponse
forall x.
ListStackInstancesResponse -> Rep ListStackInstancesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListStackInstancesResponse x -> ListStackInstancesResponse
$cfrom :: forall x.
ListStackInstancesResponse -> Rep ListStackInstancesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListStackInstancesResponse' 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', 'listStackInstancesResponse_nextToken' - If the request doesn\'t return all the remaining results, @NextToken@ is
-- set to a token. To retrieve the next set of results, call
-- @ListStackInstances@ again and assign that token to the request
-- object\'s @NextToken@ parameter. If the request returns all results,
-- @NextToken@ is set to @null@.
--
-- 'summaries', 'listStackInstancesResponse_summaries' - A list of @StackInstanceSummary@ structures that contain information
-- about the specified stack instances.
--
-- 'httpStatus', 'listStackInstancesResponse_httpStatus' - The response's http status code.
newListStackInstancesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListStackInstancesResponse
newListStackInstancesResponse :: Int -> ListStackInstancesResponse
newListStackInstancesResponse Int
pHttpStatus_ =
  ListStackInstancesResponse'
    { $sel:nextToken:ListStackInstancesResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:summaries:ListStackInstancesResponse' :: Maybe [StackInstanceSummary]
summaries = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListStackInstancesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If the request doesn\'t return all the remaining results, @NextToken@ is
-- set to a token. To retrieve the next set of results, call
-- @ListStackInstances@ again and assign that token to the request
-- object\'s @NextToken@ parameter. If the request returns all results,
-- @NextToken@ is set to @null@.
listStackInstancesResponse_nextToken :: Lens.Lens' ListStackInstancesResponse (Prelude.Maybe Prelude.Text)
listStackInstancesResponse_nextToken :: Lens' ListStackInstancesResponse (Maybe Text)
listStackInstancesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStackInstancesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListStackInstancesResponse' :: ListStackInstancesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListStackInstancesResponse
s@ListStackInstancesResponse' {} Maybe Text
a -> ListStackInstancesResponse
s {$sel:nextToken:ListStackInstancesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListStackInstancesResponse)

-- | A list of @StackInstanceSummary@ structures that contain information
-- about the specified stack instances.
listStackInstancesResponse_summaries :: Lens.Lens' ListStackInstancesResponse (Prelude.Maybe [StackInstanceSummary])
listStackInstancesResponse_summaries :: Lens' ListStackInstancesResponse (Maybe [StackInstanceSummary])
listStackInstancesResponse_summaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStackInstancesResponse' {Maybe [StackInstanceSummary]
summaries :: Maybe [StackInstanceSummary]
$sel:summaries:ListStackInstancesResponse' :: ListStackInstancesResponse -> Maybe [StackInstanceSummary]
summaries} -> Maybe [StackInstanceSummary]
summaries) (\s :: ListStackInstancesResponse
s@ListStackInstancesResponse' {} Maybe [StackInstanceSummary]
a -> ListStackInstancesResponse
s {$sel:summaries:ListStackInstancesResponse' :: Maybe [StackInstanceSummary]
summaries = Maybe [StackInstanceSummary]
a} :: ListStackInstancesResponse) 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 response's http status code.
listStackInstancesResponse_httpStatus :: Lens.Lens' ListStackInstancesResponse Prelude.Int
listStackInstancesResponse_httpStatus :: Lens' ListStackInstancesResponse Int
listStackInstancesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStackInstancesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListStackInstancesResponse' :: ListStackInstancesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListStackInstancesResponse
s@ListStackInstancesResponse' {} Int
a -> ListStackInstancesResponse
s {$sel:httpStatus:ListStackInstancesResponse' :: Int
httpStatus = Int
a} :: ListStackInstancesResponse)

instance Prelude.NFData ListStackInstancesResponse where
  rnf :: ListStackInstancesResponse -> ()
rnf ListStackInstancesResponse' {Int
Maybe [StackInstanceSummary]
Maybe Text
httpStatus :: Int
summaries :: Maybe [StackInstanceSummary]
nextToken :: Maybe Text
$sel:httpStatus:ListStackInstancesResponse' :: ListStackInstancesResponse -> Int
$sel:summaries:ListStackInstancesResponse' :: ListStackInstancesResponse -> Maybe [StackInstanceSummary]
$sel:nextToken:ListStackInstancesResponse' :: ListStackInstancesResponse -> Maybe Text
..} =
    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 Maybe [StackInstanceSummary]
summaries
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus