{-# 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.AppStream.DescribeUserStackAssociations
-- 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)
--
-- Retrieves a list that describes the UserStackAssociation objects. You
-- must specify either or both of the following:
--
-- -   The stack name
--
-- -   The user name (email address of the user associated with the stack)
--     and the authentication type for the user
--
-- This operation returns paginated results.
module Amazonka.AppStream.DescribeUserStackAssociations
  ( -- * Creating a Request
    DescribeUserStackAssociations (..),
    newDescribeUserStackAssociations,

    -- * Request Lenses
    describeUserStackAssociations_userName,
    describeUserStackAssociations_nextToken,
    describeUserStackAssociations_authenticationType,
    describeUserStackAssociations_maxResults,
    describeUserStackAssociations_stackName,

    -- * Destructuring the Response
    DescribeUserStackAssociationsResponse (..),
    newDescribeUserStackAssociationsResponse,

    -- * Response Lenses
    describeUserStackAssociationsResponse_userStackAssociations,
    describeUserStackAssociationsResponse_nextToken,
    describeUserStackAssociationsResponse_httpStatus,
  )
where

import Amazonka.AppStream.Types
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

-- | /See:/ 'newDescribeUserStackAssociations' smart constructor.
data DescribeUserStackAssociations = DescribeUserStackAssociations'
  { -- | The email address of the user who is associated with the stack.
    --
    -- Users\' email addresses are case-sensitive.
    DescribeUserStackAssociations -> Maybe (Sensitive Text)
userName :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The pagination token to use to retrieve the next page of results for
    -- this operation. If this value is null, it retrieves the first page.
    DescribeUserStackAssociations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The authentication type for the user who is associated with the stack.
    -- You must specify USERPOOL.
    DescribeUserStackAssociations -> Maybe AuthenticationType
authenticationType :: Prelude.Maybe AuthenticationType,
    -- | The maximum size of each page of results.
    DescribeUserStackAssociations -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The name of the stack that is associated with the user.
    DescribeUserStackAssociations -> Maybe Text
stackName :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeUserStackAssociations
-> DescribeUserStackAssociations -> Bool
(DescribeUserStackAssociations
 -> DescribeUserStackAssociations -> Bool)
-> (DescribeUserStackAssociations
    -> DescribeUserStackAssociations -> Bool)
-> Eq DescribeUserStackAssociations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeUserStackAssociations
-> DescribeUserStackAssociations -> Bool
$c/= :: DescribeUserStackAssociations
-> DescribeUserStackAssociations -> Bool
== :: DescribeUserStackAssociations
-> DescribeUserStackAssociations -> Bool
$c== :: DescribeUserStackAssociations
-> DescribeUserStackAssociations -> Bool
Prelude.Eq, Int -> DescribeUserStackAssociations -> ShowS
[DescribeUserStackAssociations] -> ShowS
DescribeUserStackAssociations -> String
(Int -> DescribeUserStackAssociations -> ShowS)
-> (DescribeUserStackAssociations -> String)
-> ([DescribeUserStackAssociations] -> ShowS)
-> Show DescribeUserStackAssociations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeUserStackAssociations] -> ShowS
$cshowList :: [DescribeUserStackAssociations] -> ShowS
show :: DescribeUserStackAssociations -> String
$cshow :: DescribeUserStackAssociations -> String
showsPrec :: Int -> DescribeUserStackAssociations -> ShowS
$cshowsPrec :: Int -> DescribeUserStackAssociations -> ShowS
Prelude.Show, (forall x.
 DescribeUserStackAssociations
 -> Rep DescribeUserStackAssociations x)
-> (forall x.
    Rep DescribeUserStackAssociations x
    -> DescribeUserStackAssociations)
-> Generic DescribeUserStackAssociations
forall x.
Rep DescribeUserStackAssociations x
-> DescribeUserStackAssociations
forall x.
DescribeUserStackAssociations
-> Rep DescribeUserStackAssociations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeUserStackAssociations x
-> DescribeUserStackAssociations
$cfrom :: forall x.
DescribeUserStackAssociations
-> Rep DescribeUserStackAssociations x
Prelude.Generic)

-- |
-- Create a value of 'DescribeUserStackAssociations' 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:
--
-- 'userName', 'describeUserStackAssociations_userName' - The email address of the user who is associated with the stack.
--
-- Users\' email addresses are case-sensitive.
--
-- 'nextToken', 'describeUserStackAssociations_nextToken' - The pagination token to use to retrieve the next page of results for
-- this operation. If this value is null, it retrieves the first page.
--
-- 'authenticationType', 'describeUserStackAssociations_authenticationType' - The authentication type for the user who is associated with the stack.
-- You must specify USERPOOL.
--
-- 'maxResults', 'describeUserStackAssociations_maxResults' - The maximum size of each page of results.
--
-- 'stackName', 'describeUserStackAssociations_stackName' - The name of the stack that is associated with the user.
newDescribeUserStackAssociations ::
  DescribeUserStackAssociations
newDescribeUserStackAssociations :: DescribeUserStackAssociations
newDescribeUserStackAssociations =
  DescribeUserStackAssociations' :: Maybe (Sensitive Text)
-> Maybe Text
-> Maybe AuthenticationType
-> Maybe Natural
-> Maybe Text
-> DescribeUserStackAssociations
DescribeUserStackAssociations'
    { $sel:userName:DescribeUserStackAssociations' :: Maybe (Sensitive Text)
userName =
        Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeUserStackAssociations' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:authenticationType:DescribeUserStackAssociations' :: Maybe AuthenticationType
authenticationType = Maybe AuthenticationType
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeUserStackAssociations' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:stackName:DescribeUserStackAssociations' :: Maybe Text
stackName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The email address of the user who is associated with the stack.
--
-- Users\' email addresses are case-sensitive.
describeUserStackAssociations_userName :: Lens.Lens' DescribeUserStackAssociations (Prelude.Maybe Prelude.Text)
describeUserStackAssociations_userName :: (Maybe Text -> f (Maybe Text))
-> DescribeUserStackAssociations -> f DescribeUserStackAssociations
describeUserStackAssociations_userName = (DescribeUserStackAssociations -> Maybe (Sensitive Text))
-> (DescribeUserStackAssociations
    -> Maybe (Sensitive Text) -> DescribeUserStackAssociations)
-> Lens
     DescribeUserStackAssociations
     DescribeUserStackAssociations
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeUserStackAssociations' {Maybe (Sensitive Text)
userName :: Maybe (Sensitive Text)
$sel:userName:DescribeUserStackAssociations' :: DescribeUserStackAssociations -> Maybe (Sensitive Text)
userName} -> Maybe (Sensitive Text)
userName) (\s :: DescribeUserStackAssociations
s@DescribeUserStackAssociations' {} Maybe (Sensitive Text)
a -> DescribeUserStackAssociations
s {$sel:userName:DescribeUserStackAssociations' :: Maybe (Sensitive Text)
userName = Maybe (Sensitive Text)
a} :: DescribeUserStackAssociations) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> DescribeUserStackAssociations
 -> f DescribeUserStackAssociations)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> DescribeUserStackAssociations
-> f DescribeUserStackAssociations
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The pagination token to use to retrieve the next page of results for
-- this operation. If this value is null, it retrieves the first page.
describeUserStackAssociations_nextToken :: Lens.Lens' DescribeUserStackAssociations (Prelude.Maybe Prelude.Text)
describeUserStackAssociations_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeUserStackAssociations -> f DescribeUserStackAssociations
describeUserStackAssociations_nextToken = (DescribeUserStackAssociations -> Maybe Text)
-> (DescribeUserStackAssociations
    -> Maybe Text -> DescribeUserStackAssociations)
-> Lens
     DescribeUserStackAssociations
     DescribeUserStackAssociations
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeUserStackAssociations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeUserStackAssociations' :: DescribeUserStackAssociations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeUserStackAssociations
s@DescribeUserStackAssociations' {} Maybe Text
a -> DescribeUserStackAssociations
s {$sel:nextToken:DescribeUserStackAssociations' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeUserStackAssociations)

-- | The authentication type for the user who is associated with the stack.
-- You must specify USERPOOL.
describeUserStackAssociations_authenticationType :: Lens.Lens' DescribeUserStackAssociations (Prelude.Maybe AuthenticationType)
describeUserStackAssociations_authenticationType :: (Maybe AuthenticationType -> f (Maybe AuthenticationType))
-> DescribeUserStackAssociations -> f DescribeUserStackAssociations
describeUserStackAssociations_authenticationType = (DescribeUserStackAssociations -> Maybe AuthenticationType)
-> (DescribeUserStackAssociations
    -> Maybe AuthenticationType -> DescribeUserStackAssociations)
-> Lens
     DescribeUserStackAssociations
     DescribeUserStackAssociations
     (Maybe AuthenticationType)
     (Maybe AuthenticationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeUserStackAssociations' {Maybe AuthenticationType
authenticationType :: Maybe AuthenticationType
$sel:authenticationType:DescribeUserStackAssociations' :: DescribeUserStackAssociations -> Maybe AuthenticationType
authenticationType} -> Maybe AuthenticationType
authenticationType) (\s :: DescribeUserStackAssociations
s@DescribeUserStackAssociations' {} Maybe AuthenticationType
a -> DescribeUserStackAssociations
s {$sel:authenticationType:DescribeUserStackAssociations' :: Maybe AuthenticationType
authenticationType = Maybe AuthenticationType
a} :: DescribeUserStackAssociations)

-- | The maximum size of each page of results.
describeUserStackAssociations_maxResults :: Lens.Lens' DescribeUserStackAssociations (Prelude.Maybe Prelude.Natural)
describeUserStackAssociations_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> DescribeUserStackAssociations -> f DescribeUserStackAssociations
describeUserStackAssociations_maxResults = (DescribeUserStackAssociations -> Maybe Natural)
-> (DescribeUserStackAssociations
    -> Maybe Natural -> DescribeUserStackAssociations)
-> Lens
     DescribeUserStackAssociations
     DescribeUserStackAssociations
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeUserStackAssociations' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeUserStackAssociations' :: DescribeUserStackAssociations -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeUserStackAssociations
s@DescribeUserStackAssociations' {} Maybe Natural
a -> DescribeUserStackAssociations
s {$sel:maxResults:DescribeUserStackAssociations' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeUserStackAssociations)

-- | The name of the stack that is associated with the user.
describeUserStackAssociations_stackName :: Lens.Lens' DescribeUserStackAssociations (Prelude.Maybe Prelude.Text)
describeUserStackAssociations_stackName :: (Maybe Text -> f (Maybe Text))
-> DescribeUserStackAssociations -> f DescribeUserStackAssociations
describeUserStackAssociations_stackName = (DescribeUserStackAssociations -> Maybe Text)
-> (DescribeUserStackAssociations
    -> Maybe Text -> DescribeUserStackAssociations)
-> Lens
     DescribeUserStackAssociations
     DescribeUserStackAssociations
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeUserStackAssociations' {Maybe Text
stackName :: Maybe Text
$sel:stackName:DescribeUserStackAssociations' :: DescribeUserStackAssociations -> Maybe Text
stackName} -> Maybe Text
stackName) (\s :: DescribeUserStackAssociations
s@DescribeUserStackAssociations' {} Maybe Text
a -> DescribeUserStackAssociations
s {$sel:stackName:DescribeUserStackAssociations' :: Maybe Text
stackName = Maybe Text
a} :: DescribeUserStackAssociations)

instance Core.AWSPager DescribeUserStackAssociations where
  page :: DescribeUserStackAssociations
-> AWSResponse DescribeUserStackAssociations
-> Maybe DescribeUserStackAssociations
page DescribeUserStackAssociations
rq AWSResponse DescribeUserStackAssociations
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeUserStackAssociations
DescribeUserStackAssociationsResponse
rs
            DescribeUserStackAssociationsResponse
-> Getting (First Text) DescribeUserStackAssociationsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeUserStackAssociationsResponse
-> Const (First Text) DescribeUserStackAssociationsResponse
Lens' DescribeUserStackAssociationsResponse (Maybe Text)
describeUserStackAssociationsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeUserStackAssociationsResponse
 -> Const (First Text) DescribeUserStackAssociationsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeUserStackAssociationsResponse 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 DescribeUserStackAssociations
forall a. Maybe a
Prelude.Nothing
    | Maybe [UserStackAssociation] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeUserStackAssociations
DescribeUserStackAssociationsResponse
rs
            DescribeUserStackAssociationsResponse
-> Getting
     (First [UserStackAssociation])
     DescribeUserStackAssociationsResponse
     [UserStackAssociation]
-> Maybe [UserStackAssociation]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe (NonEmpty UserStackAssociation)
 -> Const
      (First [UserStackAssociation])
      (Maybe (NonEmpty UserStackAssociation)))
-> DescribeUserStackAssociationsResponse
-> Const
     (First [UserStackAssociation])
     DescribeUserStackAssociationsResponse
Lens'
  DescribeUserStackAssociationsResponse
  (Maybe (NonEmpty UserStackAssociation))
describeUserStackAssociationsResponse_userStackAssociations
              ((Maybe (NonEmpty UserStackAssociation)
  -> Const
       (First [UserStackAssociation])
       (Maybe (NonEmpty UserStackAssociation)))
 -> DescribeUserStackAssociationsResponse
 -> Const
      (First [UserStackAssociation])
      DescribeUserStackAssociationsResponse)
-> (([UserStackAssociation]
     -> Const (First [UserStackAssociation]) [UserStackAssociation])
    -> Maybe (NonEmpty UserStackAssociation)
    -> Const
         (First [UserStackAssociation])
         (Maybe (NonEmpty UserStackAssociation)))
-> Getting
     (First [UserStackAssociation])
     DescribeUserStackAssociationsResponse
     [UserStackAssociation]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty UserStackAssociation
 -> Const
      (First [UserStackAssociation]) (NonEmpty UserStackAssociation))
-> Maybe (NonEmpty UserStackAssociation)
-> Const
     (First [UserStackAssociation])
     (Maybe (NonEmpty UserStackAssociation))
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
              ((NonEmpty UserStackAssociation
  -> Const
       (First [UserStackAssociation]) (NonEmpty UserStackAssociation))
 -> Maybe (NonEmpty UserStackAssociation)
 -> Const
      (First [UserStackAssociation])
      (Maybe (NonEmpty UserStackAssociation)))
-> (([UserStackAssociation]
     -> Const (First [UserStackAssociation]) [UserStackAssociation])
    -> NonEmpty UserStackAssociation
    -> Const
         (First [UserStackAssociation]) (NonEmpty UserStackAssociation))
-> ([UserStackAssociation]
    -> Const (First [UserStackAssociation]) [UserStackAssociation])
-> Maybe (NonEmpty UserStackAssociation)
-> Const
     (First [UserStackAssociation])
     (Maybe (NonEmpty UserStackAssociation))
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty UserStackAssociation -> [UserStackAssociation])
-> ([UserStackAssociation]
    -> Const (First [UserStackAssociation]) [UserStackAssociation])
-> NonEmpty UserStackAssociation
-> Const
     (First [UserStackAssociation]) (NonEmpty UserStackAssociation)
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to NonEmpty UserStackAssociation -> [UserStackAssociation]
forall l. IsList l => l -> [Item l]
Prelude.toList
        ) =
      Maybe DescribeUserStackAssociations
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeUserStackAssociations
-> Maybe DescribeUserStackAssociations
forall a. a -> Maybe a
Prelude.Just (DescribeUserStackAssociations
 -> Maybe DescribeUserStackAssociations)
-> DescribeUserStackAssociations
-> Maybe DescribeUserStackAssociations
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeUserStackAssociations
rq
          DescribeUserStackAssociations
-> (DescribeUserStackAssociations -> DescribeUserStackAssociations)
-> DescribeUserStackAssociations
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeUserStackAssociations
-> Identity DescribeUserStackAssociations
Lens
  DescribeUserStackAssociations
  DescribeUserStackAssociations
  (Maybe Text)
  (Maybe Text)
describeUserStackAssociations_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeUserStackAssociations
 -> Identity DescribeUserStackAssociations)
-> Maybe Text
-> DescribeUserStackAssociations
-> DescribeUserStackAssociations
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeUserStackAssociations
DescribeUserStackAssociationsResponse
rs
          DescribeUserStackAssociationsResponse
-> Getting (First Text) DescribeUserStackAssociationsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeUserStackAssociationsResponse
-> Const (First Text) DescribeUserStackAssociationsResponse
Lens' DescribeUserStackAssociationsResponse (Maybe Text)
describeUserStackAssociationsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeUserStackAssociationsResponse
 -> Const (First Text) DescribeUserStackAssociationsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeUserStackAssociationsResponse 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
    DescribeUserStackAssociations
  where
  type
    AWSResponse DescribeUserStackAssociations =
      DescribeUserStackAssociationsResponse
  request :: DescribeUserStackAssociations
-> Request DescribeUserStackAssociations
request = Service
-> DescribeUserStackAssociations
-> Request DescribeUserStackAssociations
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeUserStackAssociations
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeUserStackAssociations)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeUserStackAssociations))
-> Logger
-> Service
-> Proxy DescribeUserStackAssociations
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeUserStackAssociations)))
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 (NonEmpty UserStackAssociation)
-> Maybe Text -> Int -> DescribeUserStackAssociationsResponse
DescribeUserStackAssociationsResponse'
            (Maybe (NonEmpty UserStackAssociation)
 -> Maybe Text -> Int -> DescribeUserStackAssociationsResponse)
-> Either String (Maybe (NonEmpty UserStackAssociation))
-> Either
     String (Maybe Text -> Int -> DescribeUserStackAssociationsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Either String (Maybe (NonEmpty UserStackAssociation))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"UserStackAssociations")
            Either
  String (Maybe Text -> Int -> DescribeUserStackAssociationsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeUserStackAssociationsResponse)
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 -> DescribeUserStackAssociationsResponse)
-> Either String Int
-> Either String DescribeUserStackAssociationsResponse
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
    DescribeUserStackAssociations

instance Prelude.NFData DescribeUserStackAssociations

instance Core.ToHeaders DescribeUserStackAssociations where
  toHeaders :: DescribeUserStackAssociations -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeUserStackAssociations -> 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
"PhotonAdminProxyService.DescribeUserStackAssociations" ::
                          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 DescribeUserStackAssociations where
  toJSON :: DescribeUserStackAssociations -> Value
toJSON DescribeUserStackAssociations' {Maybe Natural
Maybe Text
Maybe (Sensitive Text)
Maybe AuthenticationType
stackName :: Maybe Text
maxResults :: Maybe Natural
authenticationType :: Maybe AuthenticationType
nextToken :: Maybe Text
userName :: Maybe (Sensitive Text)
$sel:stackName:DescribeUserStackAssociations' :: DescribeUserStackAssociations -> Maybe Text
$sel:maxResults:DescribeUserStackAssociations' :: DescribeUserStackAssociations -> Maybe Natural
$sel:authenticationType:DescribeUserStackAssociations' :: DescribeUserStackAssociations -> Maybe AuthenticationType
$sel:nextToken:DescribeUserStackAssociations' :: DescribeUserStackAssociations -> Maybe Text
$sel:userName:DescribeUserStackAssociations' :: DescribeUserStackAssociations -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"UserName" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
userName,
            (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
"AuthenticationType" Text -> AuthenticationType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AuthenticationType -> Pair)
-> Maybe AuthenticationType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AuthenticationType
authenticationType,
            (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,
            (Text
"StackName" 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
stackName
          ]
      )

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

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

-- | /See:/ 'newDescribeUserStackAssociationsResponse' smart constructor.
data DescribeUserStackAssociationsResponse = DescribeUserStackAssociationsResponse'
  { -- | The UserStackAssociation objects.
    DescribeUserStackAssociationsResponse
-> Maybe (NonEmpty UserStackAssociation)
userStackAssociations :: Prelude.Maybe (Prelude.NonEmpty UserStackAssociation),
    -- | The pagination token to use to retrieve the next page of results for
    -- this operation. If there are no more pages, this value is null.
    DescribeUserStackAssociationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeUserStackAssociationsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeUserStackAssociationsResponse
-> DescribeUserStackAssociationsResponse -> Bool
(DescribeUserStackAssociationsResponse
 -> DescribeUserStackAssociationsResponse -> Bool)
-> (DescribeUserStackAssociationsResponse
    -> DescribeUserStackAssociationsResponse -> Bool)
-> Eq DescribeUserStackAssociationsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeUserStackAssociationsResponse
-> DescribeUserStackAssociationsResponse -> Bool
$c/= :: DescribeUserStackAssociationsResponse
-> DescribeUserStackAssociationsResponse -> Bool
== :: DescribeUserStackAssociationsResponse
-> DescribeUserStackAssociationsResponse -> Bool
$c== :: DescribeUserStackAssociationsResponse
-> DescribeUserStackAssociationsResponse -> Bool
Prelude.Eq, Int -> DescribeUserStackAssociationsResponse -> ShowS
[DescribeUserStackAssociationsResponse] -> ShowS
DescribeUserStackAssociationsResponse -> String
(Int -> DescribeUserStackAssociationsResponse -> ShowS)
-> (DescribeUserStackAssociationsResponse -> String)
-> ([DescribeUserStackAssociationsResponse] -> ShowS)
-> Show DescribeUserStackAssociationsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeUserStackAssociationsResponse] -> ShowS
$cshowList :: [DescribeUserStackAssociationsResponse] -> ShowS
show :: DescribeUserStackAssociationsResponse -> String
$cshow :: DescribeUserStackAssociationsResponse -> String
showsPrec :: Int -> DescribeUserStackAssociationsResponse -> ShowS
$cshowsPrec :: Int -> DescribeUserStackAssociationsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeUserStackAssociationsResponse
 -> Rep DescribeUserStackAssociationsResponse x)
-> (forall x.
    Rep DescribeUserStackAssociationsResponse x
    -> DescribeUserStackAssociationsResponse)
-> Generic DescribeUserStackAssociationsResponse
forall x.
Rep DescribeUserStackAssociationsResponse x
-> DescribeUserStackAssociationsResponse
forall x.
DescribeUserStackAssociationsResponse
-> Rep DescribeUserStackAssociationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeUserStackAssociationsResponse x
-> DescribeUserStackAssociationsResponse
$cfrom :: forall x.
DescribeUserStackAssociationsResponse
-> Rep DescribeUserStackAssociationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeUserStackAssociationsResponse' 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:
--
-- 'userStackAssociations', 'describeUserStackAssociationsResponse_userStackAssociations' - The UserStackAssociation objects.
--
-- 'nextToken', 'describeUserStackAssociationsResponse_nextToken' - The pagination token to use to retrieve the next page of results for
-- this operation. If there are no more pages, this value is null.
--
-- 'httpStatus', 'describeUserStackAssociationsResponse_httpStatus' - The response's http status code.
newDescribeUserStackAssociationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeUserStackAssociationsResponse
newDescribeUserStackAssociationsResponse :: Int -> DescribeUserStackAssociationsResponse
newDescribeUserStackAssociationsResponse Int
pHttpStatus_ =
  DescribeUserStackAssociationsResponse' :: Maybe (NonEmpty UserStackAssociation)
-> Maybe Text -> Int -> DescribeUserStackAssociationsResponse
DescribeUserStackAssociationsResponse'
    { $sel:userStackAssociations:DescribeUserStackAssociationsResponse' :: Maybe (NonEmpty UserStackAssociation)
userStackAssociations =
        Maybe (NonEmpty UserStackAssociation)
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeUserStackAssociationsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeUserStackAssociationsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The UserStackAssociation objects.
describeUserStackAssociationsResponse_userStackAssociations :: Lens.Lens' DescribeUserStackAssociationsResponse (Prelude.Maybe (Prelude.NonEmpty UserStackAssociation))
describeUserStackAssociationsResponse_userStackAssociations :: (Maybe (NonEmpty UserStackAssociation)
 -> f (Maybe (NonEmpty UserStackAssociation)))
-> DescribeUserStackAssociationsResponse
-> f DescribeUserStackAssociationsResponse
describeUserStackAssociationsResponse_userStackAssociations = (DescribeUserStackAssociationsResponse
 -> Maybe (NonEmpty UserStackAssociation))
-> (DescribeUserStackAssociationsResponse
    -> Maybe (NonEmpty UserStackAssociation)
    -> DescribeUserStackAssociationsResponse)
-> Lens'
     DescribeUserStackAssociationsResponse
     (Maybe (NonEmpty UserStackAssociation))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeUserStackAssociationsResponse' {Maybe (NonEmpty UserStackAssociation)
userStackAssociations :: Maybe (NonEmpty UserStackAssociation)
$sel:userStackAssociations:DescribeUserStackAssociationsResponse' :: DescribeUserStackAssociationsResponse
-> Maybe (NonEmpty UserStackAssociation)
userStackAssociations} -> Maybe (NonEmpty UserStackAssociation)
userStackAssociations) (\s :: DescribeUserStackAssociationsResponse
s@DescribeUserStackAssociationsResponse' {} Maybe (NonEmpty UserStackAssociation)
a -> DescribeUserStackAssociationsResponse
s {$sel:userStackAssociations:DescribeUserStackAssociationsResponse' :: Maybe (NonEmpty UserStackAssociation)
userStackAssociations = Maybe (NonEmpty UserStackAssociation)
a} :: DescribeUserStackAssociationsResponse) ((Maybe (NonEmpty UserStackAssociation)
  -> f (Maybe (NonEmpty UserStackAssociation)))
 -> DescribeUserStackAssociationsResponse
 -> f DescribeUserStackAssociationsResponse)
-> ((Maybe (NonEmpty UserStackAssociation)
     -> f (Maybe (NonEmpty UserStackAssociation)))
    -> Maybe (NonEmpty UserStackAssociation)
    -> f (Maybe (NonEmpty UserStackAssociation)))
-> (Maybe (NonEmpty UserStackAssociation)
    -> f (Maybe (NonEmpty UserStackAssociation)))
-> DescribeUserStackAssociationsResponse
-> f DescribeUserStackAssociationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty UserStackAssociation)
  (NonEmpty UserStackAssociation)
  (NonEmpty UserStackAssociation)
  (NonEmpty UserStackAssociation)
-> Iso
     (Maybe (NonEmpty UserStackAssociation))
     (Maybe (NonEmpty UserStackAssociation))
     (Maybe (NonEmpty UserStackAssociation))
     (Maybe (NonEmpty UserStackAssociation))
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
  (NonEmpty UserStackAssociation)
  (NonEmpty UserStackAssociation)
  (NonEmpty UserStackAssociation)
  (NonEmpty UserStackAssociation)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The pagination token to use to retrieve the next page of results for
-- this operation. If there are no more pages, this value is null.
describeUserStackAssociationsResponse_nextToken :: Lens.Lens' DescribeUserStackAssociationsResponse (Prelude.Maybe Prelude.Text)
describeUserStackAssociationsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeUserStackAssociationsResponse
-> f DescribeUserStackAssociationsResponse
describeUserStackAssociationsResponse_nextToken = (DescribeUserStackAssociationsResponse -> Maybe Text)
-> (DescribeUserStackAssociationsResponse
    -> Maybe Text -> DescribeUserStackAssociationsResponse)
-> Lens' DescribeUserStackAssociationsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeUserStackAssociationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeUserStackAssociationsResponse' :: DescribeUserStackAssociationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeUserStackAssociationsResponse
s@DescribeUserStackAssociationsResponse' {} Maybe Text
a -> DescribeUserStackAssociationsResponse
s {$sel:nextToken:DescribeUserStackAssociationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeUserStackAssociationsResponse)

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

instance
  Prelude.NFData
    DescribeUserStackAssociationsResponse