{-# 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.SSM.ListAssociations
-- 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)
--
-- Returns all State Manager associations in the current Amazon Web
-- Services account and Amazon Web Services Region. You can limit the
-- results to a specific State Manager association document or instance by
-- specifying a filter. State Manager is a capability of Amazon Web
-- Services Systems Manager.
--
-- This operation returns paginated results.
module Amazonka.SSM.ListAssociations
  ( -- * Creating a Request
    ListAssociations (..),
    newListAssociations,

    -- * Request Lenses
    listAssociations_associationFilterList,
    listAssociations_nextToken,
    listAssociations_maxResults,

    -- * Destructuring the Response
    ListAssociationsResponse (..),
    newListAssociationsResponse,

    -- * Response Lenses
    listAssociationsResponse_nextToken,
    listAssociationsResponse_associations,
    listAssociationsResponse_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.SSM.Types

-- | /See:/ 'newListAssociations' smart constructor.
data ListAssociations = ListAssociations'
  { -- | One or more filters. Use a filter to return a more specific list of
    -- results.
    --
    -- Filtering associations using the @InstanceID@ attribute only returns
    -- legacy associations created using the @InstanceID@ attribute.
    -- Associations targeting the instance that are part of the Target
    -- Attributes @ResourceGroup@ or @Tags@ aren\'t returned.
    ListAssociations -> Maybe (NonEmpty AssociationFilter)
associationFilterList :: Prelude.Maybe (Prelude.NonEmpty AssociationFilter),
    -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    ListAssociations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to return for this call. The call also
    -- returns a token that you can specify in a subsequent call to get the
    -- next set of results.
    ListAssociations -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListAssociations -> ListAssociations -> Bool
(ListAssociations -> ListAssociations -> Bool)
-> (ListAssociations -> ListAssociations -> Bool)
-> Eq ListAssociations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAssociations -> ListAssociations -> Bool
$c/= :: ListAssociations -> ListAssociations -> Bool
== :: ListAssociations -> ListAssociations -> Bool
$c== :: ListAssociations -> ListAssociations -> Bool
Prelude.Eq, ReadPrec [ListAssociations]
ReadPrec ListAssociations
Int -> ReadS ListAssociations
ReadS [ListAssociations]
(Int -> ReadS ListAssociations)
-> ReadS [ListAssociations]
-> ReadPrec ListAssociations
-> ReadPrec [ListAssociations]
-> Read ListAssociations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAssociations]
$creadListPrec :: ReadPrec [ListAssociations]
readPrec :: ReadPrec ListAssociations
$creadPrec :: ReadPrec ListAssociations
readList :: ReadS [ListAssociations]
$creadList :: ReadS [ListAssociations]
readsPrec :: Int -> ReadS ListAssociations
$creadsPrec :: Int -> ReadS ListAssociations
Prelude.Read, Int -> ListAssociations -> ShowS
[ListAssociations] -> ShowS
ListAssociations -> String
(Int -> ListAssociations -> ShowS)
-> (ListAssociations -> String)
-> ([ListAssociations] -> ShowS)
-> Show ListAssociations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAssociations] -> ShowS
$cshowList :: [ListAssociations] -> ShowS
show :: ListAssociations -> String
$cshow :: ListAssociations -> String
showsPrec :: Int -> ListAssociations -> ShowS
$cshowsPrec :: Int -> ListAssociations -> ShowS
Prelude.Show, (forall x. ListAssociations -> Rep ListAssociations x)
-> (forall x. Rep ListAssociations x -> ListAssociations)
-> Generic ListAssociations
forall x. Rep ListAssociations x -> ListAssociations
forall x. ListAssociations -> Rep ListAssociations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAssociations x -> ListAssociations
$cfrom :: forall x. ListAssociations -> Rep ListAssociations x
Prelude.Generic)

-- |
-- Create a value of 'ListAssociations' 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:
--
-- 'associationFilterList', 'listAssociations_associationFilterList' - One or more filters. Use a filter to return a more specific list of
-- results.
--
-- Filtering associations using the @InstanceID@ attribute only returns
-- legacy associations created using the @InstanceID@ attribute.
-- Associations targeting the instance that are part of the Target
-- Attributes @ResourceGroup@ or @Tags@ aren\'t returned.
--
-- 'nextToken', 'listAssociations_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'maxResults', 'listAssociations_maxResults' - The maximum number of items to return for this call. The call also
-- returns a token that you can specify in a subsequent call to get the
-- next set of results.
newListAssociations ::
  ListAssociations
newListAssociations :: ListAssociations
newListAssociations =
  ListAssociations' :: Maybe (NonEmpty AssociationFilter)
-> Maybe Text -> Maybe Natural -> ListAssociations
ListAssociations'
    { $sel:associationFilterList:ListAssociations' :: Maybe (NonEmpty AssociationFilter)
associationFilterList =
        Maybe (NonEmpty AssociationFilter)
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListAssociations' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListAssociations' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | One or more filters. Use a filter to return a more specific list of
-- results.
--
-- Filtering associations using the @InstanceID@ attribute only returns
-- legacy associations created using the @InstanceID@ attribute.
-- Associations targeting the instance that are part of the Target
-- Attributes @ResourceGroup@ or @Tags@ aren\'t returned.
listAssociations_associationFilterList :: Lens.Lens' ListAssociations (Prelude.Maybe (Prelude.NonEmpty AssociationFilter))
listAssociations_associationFilterList :: (Maybe (NonEmpty AssociationFilter)
 -> f (Maybe (NonEmpty AssociationFilter)))
-> ListAssociations -> f ListAssociations
listAssociations_associationFilterList = (ListAssociations -> Maybe (NonEmpty AssociationFilter))
-> (ListAssociations
    -> Maybe (NonEmpty AssociationFilter) -> ListAssociations)
-> Lens
     ListAssociations
     ListAssociations
     (Maybe (NonEmpty AssociationFilter))
     (Maybe (NonEmpty AssociationFilter))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociations' {Maybe (NonEmpty AssociationFilter)
associationFilterList :: Maybe (NonEmpty AssociationFilter)
$sel:associationFilterList:ListAssociations' :: ListAssociations -> Maybe (NonEmpty AssociationFilter)
associationFilterList} -> Maybe (NonEmpty AssociationFilter)
associationFilterList) (\s :: ListAssociations
s@ListAssociations' {} Maybe (NonEmpty AssociationFilter)
a -> ListAssociations
s {$sel:associationFilterList:ListAssociations' :: Maybe (NonEmpty AssociationFilter)
associationFilterList = Maybe (NonEmpty AssociationFilter)
a} :: ListAssociations) ((Maybe (NonEmpty AssociationFilter)
  -> f (Maybe (NonEmpty AssociationFilter)))
 -> ListAssociations -> f ListAssociations)
-> ((Maybe (NonEmpty AssociationFilter)
     -> f (Maybe (NonEmpty AssociationFilter)))
    -> Maybe (NonEmpty AssociationFilter)
    -> f (Maybe (NonEmpty AssociationFilter)))
-> (Maybe (NonEmpty AssociationFilter)
    -> f (Maybe (NonEmpty AssociationFilter)))
-> ListAssociations
-> f ListAssociations
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty AssociationFilter)
  (NonEmpty AssociationFilter)
  (NonEmpty AssociationFilter)
  (NonEmpty AssociationFilter)
-> Iso
     (Maybe (NonEmpty AssociationFilter))
     (Maybe (NonEmpty AssociationFilter))
     (Maybe (NonEmpty AssociationFilter))
     (Maybe (NonEmpty AssociationFilter))
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 AssociationFilter)
  (NonEmpty AssociationFilter)
  (NonEmpty AssociationFilter)
  (NonEmpty AssociationFilter)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token for the next set of items to return. (You received this token
-- from a previous call.)
listAssociations_nextToken :: Lens.Lens' ListAssociations (Prelude.Maybe Prelude.Text)
listAssociations_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAssociations -> f ListAssociations
listAssociations_nextToken = (ListAssociations -> Maybe Text)
-> (ListAssociations -> Maybe Text -> ListAssociations)
-> Lens ListAssociations ListAssociations (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAssociations' :: ListAssociations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAssociations
s@ListAssociations' {} Maybe Text
a -> ListAssociations
s {$sel:nextToken:ListAssociations' :: Maybe Text
nextToken = Maybe Text
a} :: ListAssociations)

-- | The maximum number of items to return for this call. The call also
-- returns a token that you can specify in a subsequent call to get the
-- next set of results.
listAssociations_maxResults :: Lens.Lens' ListAssociations (Prelude.Maybe Prelude.Natural)
listAssociations_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListAssociations -> f ListAssociations
listAssociations_maxResults = (ListAssociations -> Maybe Natural)
-> (ListAssociations -> Maybe Natural -> ListAssociations)
-> Lens
     ListAssociations ListAssociations (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociations' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListAssociations' :: ListAssociations -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListAssociations
s@ListAssociations' {} Maybe Natural
a -> ListAssociations
s {$sel:maxResults:ListAssociations' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListAssociations)

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

instance Prelude.NFData ListAssociations

instance Core.ToHeaders ListAssociations where
  toHeaders :: ListAssociations -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListAssociations -> 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
"AmazonSSM.ListAssociations" :: 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 ListAssociations where
  toJSON :: ListAssociations -> Value
toJSON ListAssociations' {Maybe Natural
Maybe (NonEmpty AssociationFilter)
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
associationFilterList :: Maybe (NonEmpty AssociationFilter)
$sel:maxResults:ListAssociations' :: ListAssociations -> Maybe Natural
$sel:nextToken:ListAssociations' :: ListAssociations -> Maybe Text
$sel:associationFilterList:ListAssociations' :: ListAssociations -> Maybe (NonEmpty AssociationFilter)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"AssociationFilterList" Text -> NonEmpty AssociationFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty AssociationFilter -> Pair)
-> Maybe (NonEmpty AssociationFilter) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty AssociationFilter)
associationFilterList,
            (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
          ]
      )

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

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

-- | /See:/ 'newListAssociationsResponse' smart constructor.
data ListAssociationsResponse = ListAssociationsResponse'
  { -- | The token to use when requesting the next set of items. If there are no
    -- additional items to return, the string is empty.
    ListAssociationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The associations.
    ListAssociationsResponse -> Maybe [Association]
associations :: Prelude.Maybe [Association],
    -- | The response's http status code.
    ListAssociationsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListAssociationsResponse -> ListAssociationsResponse -> Bool
(ListAssociationsResponse -> ListAssociationsResponse -> Bool)
-> (ListAssociationsResponse -> ListAssociationsResponse -> Bool)
-> Eq ListAssociationsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAssociationsResponse -> ListAssociationsResponse -> Bool
$c/= :: ListAssociationsResponse -> ListAssociationsResponse -> Bool
== :: ListAssociationsResponse -> ListAssociationsResponse -> Bool
$c== :: ListAssociationsResponse -> ListAssociationsResponse -> Bool
Prelude.Eq, ReadPrec [ListAssociationsResponse]
ReadPrec ListAssociationsResponse
Int -> ReadS ListAssociationsResponse
ReadS [ListAssociationsResponse]
(Int -> ReadS ListAssociationsResponse)
-> ReadS [ListAssociationsResponse]
-> ReadPrec ListAssociationsResponse
-> ReadPrec [ListAssociationsResponse]
-> Read ListAssociationsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAssociationsResponse]
$creadListPrec :: ReadPrec [ListAssociationsResponse]
readPrec :: ReadPrec ListAssociationsResponse
$creadPrec :: ReadPrec ListAssociationsResponse
readList :: ReadS [ListAssociationsResponse]
$creadList :: ReadS [ListAssociationsResponse]
readsPrec :: Int -> ReadS ListAssociationsResponse
$creadsPrec :: Int -> ReadS ListAssociationsResponse
Prelude.Read, Int -> ListAssociationsResponse -> ShowS
[ListAssociationsResponse] -> ShowS
ListAssociationsResponse -> String
(Int -> ListAssociationsResponse -> ShowS)
-> (ListAssociationsResponse -> String)
-> ([ListAssociationsResponse] -> ShowS)
-> Show ListAssociationsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAssociationsResponse] -> ShowS
$cshowList :: [ListAssociationsResponse] -> ShowS
show :: ListAssociationsResponse -> String
$cshow :: ListAssociationsResponse -> String
showsPrec :: Int -> ListAssociationsResponse -> ShowS
$cshowsPrec :: Int -> ListAssociationsResponse -> ShowS
Prelude.Show, (forall x.
 ListAssociationsResponse -> Rep ListAssociationsResponse x)
-> (forall x.
    Rep ListAssociationsResponse x -> ListAssociationsResponse)
-> Generic ListAssociationsResponse
forall x.
Rep ListAssociationsResponse x -> ListAssociationsResponse
forall x.
ListAssociationsResponse -> Rep ListAssociationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAssociationsResponse x -> ListAssociationsResponse
$cfrom :: forall x.
ListAssociationsResponse -> Rep ListAssociationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListAssociationsResponse' 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', 'listAssociationsResponse_nextToken' - The token to use when requesting the next set of items. If there are no
-- additional items to return, the string is empty.
--
-- 'associations', 'listAssociationsResponse_associations' - The associations.
--
-- 'httpStatus', 'listAssociationsResponse_httpStatus' - The response's http status code.
newListAssociationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAssociationsResponse
newListAssociationsResponse :: Int -> ListAssociationsResponse
newListAssociationsResponse Int
pHttpStatus_ =
  ListAssociationsResponse' :: Maybe Text
-> Maybe [Association] -> Int -> ListAssociationsResponse
ListAssociationsResponse'
    { $sel:nextToken:ListAssociationsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:associations:ListAssociationsResponse' :: Maybe [Association]
associations = Maybe [Association]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListAssociationsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token to use when requesting the next set of items. If there are no
-- additional items to return, the string is empty.
listAssociationsResponse_nextToken :: Lens.Lens' ListAssociationsResponse (Prelude.Maybe Prelude.Text)
listAssociationsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAssociationsResponse -> f ListAssociationsResponse
listAssociationsResponse_nextToken = (ListAssociationsResponse -> Maybe Text)
-> (ListAssociationsResponse
    -> Maybe Text -> ListAssociationsResponse)
-> Lens' ListAssociationsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAssociationsResponse' :: ListAssociationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAssociationsResponse
s@ListAssociationsResponse' {} Maybe Text
a -> ListAssociationsResponse
s {$sel:nextToken:ListAssociationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAssociationsResponse)

-- | The associations.
listAssociationsResponse_associations :: Lens.Lens' ListAssociationsResponse (Prelude.Maybe [Association])
listAssociationsResponse_associations :: (Maybe [Association] -> f (Maybe [Association]))
-> ListAssociationsResponse -> f ListAssociationsResponse
listAssociationsResponse_associations = (ListAssociationsResponse -> Maybe [Association])
-> (ListAssociationsResponse
    -> Maybe [Association] -> ListAssociationsResponse)
-> Lens' ListAssociationsResponse (Maybe [Association])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociationsResponse' {Maybe [Association]
associations :: Maybe [Association]
$sel:associations:ListAssociationsResponse' :: ListAssociationsResponse -> Maybe [Association]
associations} -> Maybe [Association]
associations) (\s :: ListAssociationsResponse
s@ListAssociationsResponse' {} Maybe [Association]
a -> ListAssociationsResponse
s {$sel:associations:ListAssociationsResponse' :: Maybe [Association]
associations = Maybe [Association]
a} :: ListAssociationsResponse) ((Maybe [Association] -> f (Maybe [Association]))
 -> ListAssociationsResponse -> f ListAssociationsResponse)
-> ((Maybe [Association] -> f (Maybe [Association]))
    -> Maybe [Association] -> f (Maybe [Association]))
-> (Maybe [Association] -> f (Maybe [Association]))
-> ListAssociationsResponse
-> f ListAssociationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Association] [Association] [Association] [Association]
-> Iso
     (Maybe [Association])
     (Maybe [Association])
     (Maybe [Association])
     (Maybe [Association])
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 [Association] [Association] [Association] [Association]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListAssociationsResponse