{-# 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.LicenseManager.ListAssociationsForLicenseConfiguration
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists the resource associations for the specified license configuration.
--
-- Resource associations need not consume licenses from a license
-- configuration. For example, an AMI or a stopped instance might not
-- consume a license (depending on the license rules).
--
-- This operation returns paginated results.
module Amazonka.LicenseManager.ListAssociationsForLicenseConfiguration
  ( -- * Creating a Request
    ListAssociationsForLicenseConfiguration (..),
    newListAssociationsForLicenseConfiguration,

    -- * Request Lenses
    listAssociationsForLicenseConfiguration_nextToken,
    listAssociationsForLicenseConfiguration_maxResults,
    listAssociationsForLicenseConfiguration_licenseConfigurationArn,

    -- * Destructuring the Response
    ListAssociationsForLicenseConfigurationResponse (..),
    newListAssociationsForLicenseConfigurationResponse,

    -- * Response Lenses
    listAssociationsForLicenseConfigurationResponse_licenseConfigurationAssociations,
    listAssociationsForLicenseConfigurationResponse_nextToken,
    listAssociationsForLicenseConfigurationResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LicenseManager.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListAssociationsForLicenseConfiguration' smart constructor.
data ListAssociationsForLicenseConfiguration = ListAssociationsForLicenseConfiguration'
  { -- | Token for the next set of results.
    ListAssociationsForLicenseConfiguration -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Maximum number of results to return in a single call.
    ListAssociationsForLicenseConfiguration -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | Amazon Resource Name (ARN) of a license configuration.
    ListAssociationsForLicenseConfiguration -> Text
licenseConfigurationArn :: Prelude.Text
  }
  deriving (ListAssociationsForLicenseConfiguration
-> ListAssociationsForLicenseConfiguration -> Bool
(ListAssociationsForLicenseConfiguration
 -> ListAssociationsForLicenseConfiguration -> Bool)
-> (ListAssociationsForLicenseConfiguration
    -> ListAssociationsForLicenseConfiguration -> Bool)
-> Eq ListAssociationsForLicenseConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAssociationsForLicenseConfiguration
-> ListAssociationsForLicenseConfiguration -> Bool
$c/= :: ListAssociationsForLicenseConfiguration
-> ListAssociationsForLicenseConfiguration -> Bool
== :: ListAssociationsForLicenseConfiguration
-> ListAssociationsForLicenseConfiguration -> Bool
$c== :: ListAssociationsForLicenseConfiguration
-> ListAssociationsForLicenseConfiguration -> Bool
Prelude.Eq, ReadPrec [ListAssociationsForLicenseConfiguration]
ReadPrec ListAssociationsForLicenseConfiguration
Int -> ReadS ListAssociationsForLicenseConfiguration
ReadS [ListAssociationsForLicenseConfiguration]
(Int -> ReadS ListAssociationsForLicenseConfiguration)
-> ReadS [ListAssociationsForLicenseConfiguration]
-> ReadPrec ListAssociationsForLicenseConfiguration
-> ReadPrec [ListAssociationsForLicenseConfiguration]
-> Read ListAssociationsForLicenseConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAssociationsForLicenseConfiguration]
$creadListPrec :: ReadPrec [ListAssociationsForLicenseConfiguration]
readPrec :: ReadPrec ListAssociationsForLicenseConfiguration
$creadPrec :: ReadPrec ListAssociationsForLicenseConfiguration
readList :: ReadS [ListAssociationsForLicenseConfiguration]
$creadList :: ReadS [ListAssociationsForLicenseConfiguration]
readsPrec :: Int -> ReadS ListAssociationsForLicenseConfiguration
$creadsPrec :: Int -> ReadS ListAssociationsForLicenseConfiguration
Prelude.Read, Int -> ListAssociationsForLicenseConfiguration -> ShowS
[ListAssociationsForLicenseConfiguration] -> ShowS
ListAssociationsForLicenseConfiguration -> String
(Int -> ListAssociationsForLicenseConfiguration -> ShowS)
-> (ListAssociationsForLicenseConfiguration -> String)
-> ([ListAssociationsForLicenseConfiguration] -> ShowS)
-> Show ListAssociationsForLicenseConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAssociationsForLicenseConfiguration] -> ShowS
$cshowList :: [ListAssociationsForLicenseConfiguration] -> ShowS
show :: ListAssociationsForLicenseConfiguration -> String
$cshow :: ListAssociationsForLicenseConfiguration -> String
showsPrec :: Int -> ListAssociationsForLicenseConfiguration -> ShowS
$cshowsPrec :: Int -> ListAssociationsForLicenseConfiguration -> ShowS
Prelude.Show, (forall x.
 ListAssociationsForLicenseConfiguration
 -> Rep ListAssociationsForLicenseConfiguration x)
-> (forall x.
    Rep ListAssociationsForLicenseConfiguration x
    -> ListAssociationsForLicenseConfiguration)
-> Generic ListAssociationsForLicenseConfiguration
forall x.
Rep ListAssociationsForLicenseConfiguration x
-> ListAssociationsForLicenseConfiguration
forall x.
ListAssociationsForLicenseConfiguration
-> Rep ListAssociationsForLicenseConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAssociationsForLicenseConfiguration x
-> ListAssociationsForLicenseConfiguration
$cfrom :: forall x.
ListAssociationsForLicenseConfiguration
-> Rep ListAssociationsForLicenseConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ListAssociationsForLicenseConfiguration' 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', 'listAssociationsForLicenseConfiguration_nextToken' - Token for the next set of results.
--
-- 'maxResults', 'listAssociationsForLicenseConfiguration_maxResults' - Maximum number of results to return in a single call.
--
-- 'licenseConfigurationArn', 'listAssociationsForLicenseConfiguration_licenseConfigurationArn' - Amazon Resource Name (ARN) of a license configuration.
newListAssociationsForLicenseConfiguration ::
  -- | 'licenseConfigurationArn'
  Prelude.Text ->
  ListAssociationsForLicenseConfiguration
newListAssociationsForLicenseConfiguration :: Text -> ListAssociationsForLicenseConfiguration
newListAssociationsForLicenseConfiguration
  Text
pLicenseConfigurationArn_ =
    ListAssociationsForLicenseConfiguration' :: Maybe Text
-> Maybe Int -> Text -> ListAssociationsForLicenseConfiguration
ListAssociationsForLicenseConfiguration'
      { $sel:nextToken:ListAssociationsForLicenseConfiguration' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListAssociationsForLicenseConfiguration' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:licenseConfigurationArn:ListAssociationsForLicenseConfiguration' :: Text
licenseConfigurationArn =
          Text
pLicenseConfigurationArn_
      }

-- | Token for the next set of results.
listAssociationsForLicenseConfiguration_nextToken :: Lens.Lens' ListAssociationsForLicenseConfiguration (Prelude.Maybe Prelude.Text)
listAssociationsForLicenseConfiguration_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAssociationsForLicenseConfiguration
-> f ListAssociationsForLicenseConfiguration
listAssociationsForLicenseConfiguration_nextToken = (ListAssociationsForLicenseConfiguration -> Maybe Text)
-> (ListAssociationsForLicenseConfiguration
    -> Maybe Text -> ListAssociationsForLicenseConfiguration)
-> Lens
     ListAssociationsForLicenseConfiguration
     ListAssociationsForLicenseConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociationsForLicenseConfiguration' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAssociationsForLicenseConfiguration' :: ListAssociationsForLicenseConfiguration -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAssociationsForLicenseConfiguration
s@ListAssociationsForLicenseConfiguration' {} Maybe Text
a -> ListAssociationsForLicenseConfiguration
s {$sel:nextToken:ListAssociationsForLicenseConfiguration' :: Maybe Text
nextToken = Maybe Text
a} :: ListAssociationsForLicenseConfiguration)

-- | Maximum number of results to return in a single call.
listAssociationsForLicenseConfiguration_maxResults :: Lens.Lens' ListAssociationsForLicenseConfiguration (Prelude.Maybe Prelude.Int)
listAssociationsForLicenseConfiguration_maxResults :: (Maybe Int -> f (Maybe Int))
-> ListAssociationsForLicenseConfiguration
-> f ListAssociationsForLicenseConfiguration
listAssociationsForLicenseConfiguration_maxResults = (ListAssociationsForLicenseConfiguration -> Maybe Int)
-> (ListAssociationsForLicenseConfiguration
    -> Maybe Int -> ListAssociationsForLicenseConfiguration)
-> Lens
     ListAssociationsForLicenseConfiguration
     ListAssociationsForLicenseConfiguration
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociationsForLicenseConfiguration' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:ListAssociationsForLicenseConfiguration' :: ListAssociationsForLicenseConfiguration -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: ListAssociationsForLicenseConfiguration
s@ListAssociationsForLicenseConfiguration' {} Maybe Int
a -> ListAssociationsForLicenseConfiguration
s {$sel:maxResults:ListAssociationsForLicenseConfiguration' :: Maybe Int
maxResults = Maybe Int
a} :: ListAssociationsForLicenseConfiguration)

-- | Amazon Resource Name (ARN) of a license configuration.
listAssociationsForLicenseConfiguration_licenseConfigurationArn :: Lens.Lens' ListAssociationsForLicenseConfiguration Prelude.Text
listAssociationsForLicenseConfiguration_licenseConfigurationArn :: (Text -> f Text)
-> ListAssociationsForLicenseConfiguration
-> f ListAssociationsForLicenseConfiguration
listAssociationsForLicenseConfiguration_licenseConfigurationArn = (ListAssociationsForLicenseConfiguration -> Text)
-> (ListAssociationsForLicenseConfiguration
    -> Text -> ListAssociationsForLicenseConfiguration)
-> Lens
     ListAssociationsForLicenseConfiguration
     ListAssociationsForLicenseConfiguration
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociationsForLicenseConfiguration' {Text
licenseConfigurationArn :: Text
$sel:licenseConfigurationArn:ListAssociationsForLicenseConfiguration' :: ListAssociationsForLicenseConfiguration -> Text
licenseConfigurationArn} -> Text
licenseConfigurationArn) (\s :: ListAssociationsForLicenseConfiguration
s@ListAssociationsForLicenseConfiguration' {} Text
a -> ListAssociationsForLicenseConfiguration
s {$sel:licenseConfigurationArn:ListAssociationsForLicenseConfiguration' :: Text
licenseConfigurationArn = Text
a} :: ListAssociationsForLicenseConfiguration)

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

instance
  Prelude.NFData
    ListAssociationsForLicenseConfiguration

instance
  Core.ToHeaders
    ListAssociationsForLicenseConfiguration
  where
  toHeaders :: ListAssociationsForLicenseConfiguration -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> ListAssociationsForLicenseConfiguration -> 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
"AWSLicenseManager.ListAssociationsForLicenseConfiguration" ::
                          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
    ListAssociationsForLicenseConfiguration
  where
  toJSON :: ListAssociationsForLicenseConfiguration -> Value
toJSON ListAssociationsForLicenseConfiguration' {Maybe Int
Maybe Text
Text
licenseConfigurationArn :: Text
maxResults :: Maybe Int
nextToken :: Maybe Text
$sel:licenseConfigurationArn:ListAssociationsForLicenseConfiguration' :: ListAssociationsForLicenseConfiguration -> Text
$sel:maxResults:ListAssociationsForLicenseConfiguration' :: ListAssociationsForLicenseConfiguration -> Maybe Int
$sel:nextToken:ListAssociationsForLicenseConfiguration' :: ListAssociationsForLicenseConfiguration -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"MaxResults" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"LicenseConfigurationArn"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
licenseConfigurationArn
              )
          ]
      )

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

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

-- | /See:/ 'newListAssociationsForLicenseConfigurationResponse' smart constructor.
data ListAssociationsForLicenseConfigurationResponse = ListAssociationsForLicenseConfigurationResponse'
  { -- | Information about the associations for the license configuration.
    ListAssociationsForLicenseConfigurationResponse
-> Maybe [LicenseConfigurationAssociation]
licenseConfigurationAssociations :: Prelude.Maybe [LicenseConfigurationAssociation],
    -- | Token for the next set of results.
    ListAssociationsForLicenseConfigurationResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListAssociationsForLicenseConfigurationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListAssociationsForLicenseConfigurationResponse
-> ListAssociationsForLicenseConfigurationResponse -> Bool
(ListAssociationsForLicenseConfigurationResponse
 -> ListAssociationsForLicenseConfigurationResponse -> Bool)
-> (ListAssociationsForLicenseConfigurationResponse
    -> ListAssociationsForLicenseConfigurationResponse -> Bool)
-> Eq ListAssociationsForLicenseConfigurationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAssociationsForLicenseConfigurationResponse
-> ListAssociationsForLicenseConfigurationResponse -> Bool
$c/= :: ListAssociationsForLicenseConfigurationResponse
-> ListAssociationsForLicenseConfigurationResponse -> Bool
== :: ListAssociationsForLicenseConfigurationResponse
-> ListAssociationsForLicenseConfigurationResponse -> Bool
$c== :: ListAssociationsForLicenseConfigurationResponse
-> ListAssociationsForLicenseConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [ListAssociationsForLicenseConfigurationResponse]
ReadPrec ListAssociationsForLicenseConfigurationResponse
Int -> ReadS ListAssociationsForLicenseConfigurationResponse
ReadS [ListAssociationsForLicenseConfigurationResponse]
(Int -> ReadS ListAssociationsForLicenseConfigurationResponse)
-> ReadS [ListAssociationsForLicenseConfigurationResponse]
-> ReadPrec ListAssociationsForLicenseConfigurationResponse
-> ReadPrec [ListAssociationsForLicenseConfigurationResponse]
-> Read ListAssociationsForLicenseConfigurationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAssociationsForLicenseConfigurationResponse]
$creadListPrec :: ReadPrec [ListAssociationsForLicenseConfigurationResponse]
readPrec :: ReadPrec ListAssociationsForLicenseConfigurationResponse
$creadPrec :: ReadPrec ListAssociationsForLicenseConfigurationResponse
readList :: ReadS [ListAssociationsForLicenseConfigurationResponse]
$creadList :: ReadS [ListAssociationsForLicenseConfigurationResponse]
readsPrec :: Int -> ReadS ListAssociationsForLicenseConfigurationResponse
$creadsPrec :: Int -> ReadS ListAssociationsForLicenseConfigurationResponse
Prelude.Read, Int -> ListAssociationsForLicenseConfigurationResponse -> ShowS
[ListAssociationsForLicenseConfigurationResponse] -> ShowS
ListAssociationsForLicenseConfigurationResponse -> String
(Int -> ListAssociationsForLicenseConfigurationResponse -> ShowS)
-> (ListAssociationsForLicenseConfigurationResponse -> String)
-> ([ListAssociationsForLicenseConfigurationResponse] -> ShowS)
-> Show ListAssociationsForLicenseConfigurationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAssociationsForLicenseConfigurationResponse] -> ShowS
$cshowList :: [ListAssociationsForLicenseConfigurationResponse] -> ShowS
show :: ListAssociationsForLicenseConfigurationResponse -> String
$cshow :: ListAssociationsForLicenseConfigurationResponse -> String
showsPrec :: Int -> ListAssociationsForLicenseConfigurationResponse -> ShowS
$cshowsPrec :: Int -> ListAssociationsForLicenseConfigurationResponse -> ShowS
Prelude.Show, (forall x.
 ListAssociationsForLicenseConfigurationResponse
 -> Rep ListAssociationsForLicenseConfigurationResponse x)
-> (forall x.
    Rep ListAssociationsForLicenseConfigurationResponse x
    -> ListAssociationsForLicenseConfigurationResponse)
-> Generic ListAssociationsForLicenseConfigurationResponse
forall x.
Rep ListAssociationsForLicenseConfigurationResponse x
-> ListAssociationsForLicenseConfigurationResponse
forall x.
ListAssociationsForLicenseConfigurationResponse
-> Rep ListAssociationsForLicenseConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAssociationsForLicenseConfigurationResponse x
-> ListAssociationsForLicenseConfigurationResponse
$cfrom :: forall x.
ListAssociationsForLicenseConfigurationResponse
-> Rep ListAssociationsForLicenseConfigurationResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListAssociationsForLicenseConfigurationResponse' 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:
--
-- 'licenseConfigurationAssociations', 'listAssociationsForLicenseConfigurationResponse_licenseConfigurationAssociations' - Information about the associations for the license configuration.
--
-- 'nextToken', 'listAssociationsForLicenseConfigurationResponse_nextToken' - Token for the next set of results.
--
-- 'httpStatus', 'listAssociationsForLicenseConfigurationResponse_httpStatus' - The response's http status code.
newListAssociationsForLicenseConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAssociationsForLicenseConfigurationResponse
newListAssociationsForLicenseConfigurationResponse :: Int -> ListAssociationsForLicenseConfigurationResponse
newListAssociationsForLicenseConfigurationResponse
  Int
pHttpStatus_ =
    ListAssociationsForLicenseConfigurationResponse' :: Maybe [LicenseConfigurationAssociation]
-> Maybe Text
-> Int
-> ListAssociationsForLicenseConfigurationResponse
ListAssociationsForLicenseConfigurationResponse'
      { $sel:licenseConfigurationAssociations:ListAssociationsForLicenseConfigurationResponse' :: Maybe [LicenseConfigurationAssociation]
licenseConfigurationAssociations =
          Maybe [LicenseConfigurationAssociation]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:ListAssociationsForLicenseConfigurationResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListAssociationsForLicenseConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Information about the associations for the license configuration.
listAssociationsForLicenseConfigurationResponse_licenseConfigurationAssociations :: Lens.Lens' ListAssociationsForLicenseConfigurationResponse (Prelude.Maybe [LicenseConfigurationAssociation])
listAssociationsForLicenseConfigurationResponse_licenseConfigurationAssociations :: (Maybe [LicenseConfigurationAssociation]
 -> f (Maybe [LicenseConfigurationAssociation]))
-> ListAssociationsForLicenseConfigurationResponse
-> f ListAssociationsForLicenseConfigurationResponse
listAssociationsForLicenseConfigurationResponse_licenseConfigurationAssociations = (ListAssociationsForLicenseConfigurationResponse
 -> Maybe [LicenseConfigurationAssociation])
-> (ListAssociationsForLicenseConfigurationResponse
    -> Maybe [LicenseConfigurationAssociation]
    -> ListAssociationsForLicenseConfigurationResponse)
-> Lens'
     ListAssociationsForLicenseConfigurationResponse
     (Maybe [LicenseConfigurationAssociation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociationsForLicenseConfigurationResponse' {Maybe [LicenseConfigurationAssociation]
licenseConfigurationAssociations :: Maybe [LicenseConfigurationAssociation]
$sel:licenseConfigurationAssociations:ListAssociationsForLicenseConfigurationResponse' :: ListAssociationsForLicenseConfigurationResponse
-> Maybe [LicenseConfigurationAssociation]
licenseConfigurationAssociations} -> Maybe [LicenseConfigurationAssociation]
licenseConfigurationAssociations) (\s :: ListAssociationsForLicenseConfigurationResponse
s@ListAssociationsForLicenseConfigurationResponse' {} Maybe [LicenseConfigurationAssociation]
a -> ListAssociationsForLicenseConfigurationResponse
s {$sel:licenseConfigurationAssociations:ListAssociationsForLicenseConfigurationResponse' :: Maybe [LicenseConfigurationAssociation]
licenseConfigurationAssociations = Maybe [LicenseConfigurationAssociation]
a} :: ListAssociationsForLicenseConfigurationResponse) ((Maybe [LicenseConfigurationAssociation]
  -> f (Maybe [LicenseConfigurationAssociation]))
 -> ListAssociationsForLicenseConfigurationResponse
 -> f ListAssociationsForLicenseConfigurationResponse)
-> ((Maybe [LicenseConfigurationAssociation]
     -> f (Maybe [LicenseConfigurationAssociation]))
    -> Maybe [LicenseConfigurationAssociation]
    -> f (Maybe [LicenseConfigurationAssociation]))
-> (Maybe [LicenseConfigurationAssociation]
    -> f (Maybe [LicenseConfigurationAssociation]))
-> ListAssociationsForLicenseConfigurationResponse
-> f ListAssociationsForLicenseConfigurationResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [LicenseConfigurationAssociation]
  [LicenseConfigurationAssociation]
  [LicenseConfigurationAssociation]
  [LicenseConfigurationAssociation]
-> Iso
     (Maybe [LicenseConfigurationAssociation])
     (Maybe [LicenseConfigurationAssociation])
     (Maybe [LicenseConfigurationAssociation])
     (Maybe [LicenseConfigurationAssociation])
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
  [LicenseConfigurationAssociation]
  [LicenseConfigurationAssociation]
  [LicenseConfigurationAssociation]
  [LicenseConfigurationAssociation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Token for the next set of results.
listAssociationsForLicenseConfigurationResponse_nextToken :: Lens.Lens' ListAssociationsForLicenseConfigurationResponse (Prelude.Maybe Prelude.Text)
listAssociationsForLicenseConfigurationResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAssociationsForLicenseConfigurationResponse
-> f ListAssociationsForLicenseConfigurationResponse
listAssociationsForLicenseConfigurationResponse_nextToken = (ListAssociationsForLicenseConfigurationResponse -> Maybe Text)
-> (ListAssociationsForLicenseConfigurationResponse
    -> Maybe Text -> ListAssociationsForLicenseConfigurationResponse)
-> Lens'
     ListAssociationsForLicenseConfigurationResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociationsForLicenseConfigurationResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAssociationsForLicenseConfigurationResponse' :: ListAssociationsForLicenseConfigurationResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAssociationsForLicenseConfigurationResponse
s@ListAssociationsForLicenseConfigurationResponse' {} Maybe Text
a -> ListAssociationsForLicenseConfigurationResponse
s {$sel:nextToken:ListAssociationsForLicenseConfigurationResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAssociationsForLicenseConfigurationResponse)

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

instance
  Prelude.NFData
    ListAssociationsForLicenseConfigurationResponse