{-# 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.ListLicenseConfigurations
-- 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 license configurations for your account.
--
-- This operation returns paginated results.
module Amazonka.LicenseManager.ListLicenseConfigurations
  ( -- * Creating a Request
    ListLicenseConfigurations (..),
    newListLicenseConfigurations,

    -- * Request Lenses
    listLicenseConfigurations_filters,
    listLicenseConfigurations_nextToken,
    listLicenseConfigurations_licenseConfigurationArns,
    listLicenseConfigurations_maxResults,

    -- * Destructuring the Response
    ListLicenseConfigurationsResponse (..),
    newListLicenseConfigurationsResponse,

    -- * Response Lenses
    listLicenseConfigurationsResponse_nextToken,
    listLicenseConfigurationsResponse_licenseConfigurations,
    listLicenseConfigurationsResponse_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:/ 'newListLicenseConfigurations' smart constructor.
data ListLicenseConfigurations = ListLicenseConfigurations'
  { -- | Filters to scope the results. The following filters and logical
    -- operators are supported:
    --
    -- -   @licenseCountingType@ - The dimension for which licenses are
    --     counted. Possible values are @vCPU@ | @Instance@ | @Core@ |
    --     @Socket@. Logical operators are @EQUALS@ | @NOT_EQUALS@.
    --
    -- -   @enforceLicenseCount@ - A Boolean value that indicates whether hard
    --     license enforcement is used. Logical operators are @EQUALS@ |
    --     @NOT_EQUALS@.
    --
    -- -   @usagelimitExceeded@ - A Boolean value that indicates whether the
    --     available licenses have been exceeded. Logical operators are
    --     @EQUALS@ | @NOT_EQUALS@.
    ListLicenseConfigurations -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | Token for the next set of results.
    ListLicenseConfigurations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Amazon Resource Names (ARN) of the license configurations.
    ListLicenseConfigurations -> Maybe [Text]
licenseConfigurationArns :: Prelude.Maybe [Prelude.Text],
    -- | Maximum number of results to return in a single call.
    ListLicenseConfigurations -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int
  }
  deriving (ListLicenseConfigurations -> ListLicenseConfigurations -> Bool
(ListLicenseConfigurations -> ListLicenseConfigurations -> Bool)
-> (ListLicenseConfigurations -> ListLicenseConfigurations -> Bool)
-> Eq ListLicenseConfigurations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListLicenseConfigurations -> ListLicenseConfigurations -> Bool
$c/= :: ListLicenseConfigurations -> ListLicenseConfigurations -> Bool
== :: ListLicenseConfigurations -> ListLicenseConfigurations -> Bool
$c== :: ListLicenseConfigurations -> ListLicenseConfigurations -> Bool
Prelude.Eq, ReadPrec [ListLicenseConfigurations]
ReadPrec ListLicenseConfigurations
Int -> ReadS ListLicenseConfigurations
ReadS [ListLicenseConfigurations]
(Int -> ReadS ListLicenseConfigurations)
-> ReadS [ListLicenseConfigurations]
-> ReadPrec ListLicenseConfigurations
-> ReadPrec [ListLicenseConfigurations]
-> Read ListLicenseConfigurations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListLicenseConfigurations]
$creadListPrec :: ReadPrec [ListLicenseConfigurations]
readPrec :: ReadPrec ListLicenseConfigurations
$creadPrec :: ReadPrec ListLicenseConfigurations
readList :: ReadS [ListLicenseConfigurations]
$creadList :: ReadS [ListLicenseConfigurations]
readsPrec :: Int -> ReadS ListLicenseConfigurations
$creadsPrec :: Int -> ReadS ListLicenseConfigurations
Prelude.Read, Int -> ListLicenseConfigurations -> ShowS
[ListLicenseConfigurations] -> ShowS
ListLicenseConfigurations -> String
(Int -> ListLicenseConfigurations -> ShowS)
-> (ListLicenseConfigurations -> String)
-> ([ListLicenseConfigurations] -> ShowS)
-> Show ListLicenseConfigurations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListLicenseConfigurations] -> ShowS
$cshowList :: [ListLicenseConfigurations] -> ShowS
show :: ListLicenseConfigurations -> String
$cshow :: ListLicenseConfigurations -> String
showsPrec :: Int -> ListLicenseConfigurations -> ShowS
$cshowsPrec :: Int -> ListLicenseConfigurations -> ShowS
Prelude.Show, (forall x.
 ListLicenseConfigurations -> Rep ListLicenseConfigurations x)
-> (forall x.
    Rep ListLicenseConfigurations x -> ListLicenseConfigurations)
-> Generic ListLicenseConfigurations
forall x.
Rep ListLicenseConfigurations x -> ListLicenseConfigurations
forall x.
ListLicenseConfigurations -> Rep ListLicenseConfigurations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListLicenseConfigurations x -> ListLicenseConfigurations
$cfrom :: forall x.
ListLicenseConfigurations -> Rep ListLicenseConfigurations x
Prelude.Generic)

-- |
-- Create a value of 'ListLicenseConfigurations' 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:
--
-- 'filters', 'listLicenseConfigurations_filters' - Filters to scope the results. The following filters and logical
-- operators are supported:
--
-- -   @licenseCountingType@ - The dimension for which licenses are
--     counted. Possible values are @vCPU@ | @Instance@ | @Core@ |
--     @Socket@. Logical operators are @EQUALS@ | @NOT_EQUALS@.
--
-- -   @enforceLicenseCount@ - A Boolean value that indicates whether hard
--     license enforcement is used. Logical operators are @EQUALS@ |
--     @NOT_EQUALS@.
--
-- -   @usagelimitExceeded@ - A Boolean value that indicates whether the
--     available licenses have been exceeded. Logical operators are
--     @EQUALS@ | @NOT_EQUALS@.
--
-- 'nextToken', 'listLicenseConfigurations_nextToken' - Token for the next set of results.
--
-- 'licenseConfigurationArns', 'listLicenseConfigurations_licenseConfigurationArns' - Amazon Resource Names (ARN) of the license configurations.
--
-- 'maxResults', 'listLicenseConfigurations_maxResults' - Maximum number of results to return in a single call.
newListLicenseConfigurations ::
  ListLicenseConfigurations
newListLicenseConfigurations :: ListLicenseConfigurations
newListLicenseConfigurations =
  ListLicenseConfigurations' :: Maybe [Filter]
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> ListLicenseConfigurations
ListLicenseConfigurations'
    { $sel:filters:ListLicenseConfigurations' :: Maybe [Filter]
filters =
        Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListLicenseConfigurations' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:licenseConfigurationArns:ListLicenseConfigurations' :: Maybe [Text]
licenseConfigurationArns = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListLicenseConfigurations' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | Filters to scope the results. The following filters and logical
-- operators are supported:
--
-- -   @licenseCountingType@ - The dimension for which licenses are
--     counted. Possible values are @vCPU@ | @Instance@ | @Core@ |
--     @Socket@. Logical operators are @EQUALS@ | @NOT_EQUALS@.
--
-- -   @enforceLicenseCount@ - A Boolean value that indicates whether hard
--     license enforcement is used. Logical operators are @EQUALS@ |
--     @NOT_EQUALS@.
--
-- -   @usagelimitExceeded@ - A Boolean value that indicates whether the
--     available licenses have been exceeded. Logical operators are
--     @EQUALS@ | @NOT_EQUALS@.
listLicenseConfigurations_filters :: Lens.Lens' ListLicenseConfigurations (Prelude.Maybe [Filter])
listLicenseConfigurations_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> ListLicenseConfigurations -> f ListLicenseConfigurations
listLicenseConfigurations_filters = (ListLicenseConfigurations -> Maybe [Filter])
-> (ListLicenseConfigurations
    -> Maybe [Filter] -> ListLicenseConfigurations)
-> Lens
     ListLicenseConfigurations
     ListLicenseConfigurations
     (Maybe [Filter])
     (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLicenseConfigurations' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:ListLicenseConfigurations' :: ListLicenseConfigurations -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: ListLicenseConfigurations
s@ListLicenseConfigurations' {} Maybe [Filter]
a -> ListLicenseConfigurations
s {$sel:filters:ListLicenseConfigurations' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: ListLicenseConfigurations) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> ListLicenseConfigurations -> f ListLicenseConfigurations)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> ListLicenseConfigurations
-> f ListLicenseConfigurations
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Filter] [Filter] [Filter] [Filter]
-> Iso
     (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter])
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 [Filter] [Filter] [Filter] [Filter]
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.
listLicenseConfigurations_nextToken :: Lens.Lens' ListLicenseConfigurations (Prelude.Maybe Prelude.Text)
listLicenseConfigurations_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListLicenseConfigurations -> f ListLicenseConfigurations
listLicenseConfigurations_nextToken = (ListLicenseConfigurations -> Maybe Text)
-> (ListLicenseConfigurations
    -> Maybe Text -> ListLicenseConfigurations)
-> Lens
     ListLicenseConfigurations
     ListLicenseConfigurations
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLicenseConfigurations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListLicenseConfigurations' :: ListLicenseConfigurations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListLicenseConfigurations
s@ListLicenseConfigurations' {} Maybe Text
a -> ListLicenseConfigurations
s {$sel:nextToken:ListLicenseConfigurations' :: Maybe Text
nextToken = Maybe Text
a} :: ListLicenseConfigurations)

-- | Amazon Resource Names (ARN) of the license configurations.
listLicenseConfigurations_licenseConfigurationArns :: Lens.Lens' ListLicenseConfigurations (Prelude.Maybe [Prelude.Text])
listLicenseConfigurations_licenseConfigurationArns :: (Maybe [Text] -> f (Maybe [Text]))
-> ListLicenseConfigurations -> f ListLicenseConfigurations
listLicenseConfigurations_licenseConfigurationArns = (ListLicenseConfigurations -> Maybe [Text])
-> (ListLicenseConfigurations
    -> Maybe [Text] -> ListLicenseConfigurations)
-> Lens
     ListLicenseConfigurations
     ListLicenseConfigurations
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLicenseConfigurations' {Maybe [Text]
licenseConfigurationArns :: Maybe [Text]
$sel:licenseConfigurationArns:ListLicenseConfigurations' :: ListLicenseConfigurations -> Maybe [Text]
licenseConfigurationArns} -> Maybe [Text]
licenseConfigurationArns) (\s :: ListLicenseConfigurations
s@ListLicenseConfigurations' {} Maybe [Text]
a -> ListLicenseConfigurations
s {$sel:licenseConfigurationArns:ListLicenseConfigurations' :: Maybe [Text]
licenseConfigurationArns = Maybe [Text]
a} :: ListLicenseConfigurations) ((Maybe [Text] -> f (Maybe [Text]))
 -> ListLicenseConfigurations -> f ListLicenseConfigurations)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ListLicenseConfigurations
-> f ListLicenseConfigurations
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

instance Prelude.NFData ListLicenseConfigurations

instance Core.ToHeaders ListLicenseConfigurations where
  toHeaders :: ListLicenseConfigurations -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListLicenseConfigurations -> 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.ListLicenseConfigurations" ::
                          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 ListLicenseConfigurations where
  toJSON :: ListLicenseConfigurations -> Value
toJSON ListLicenseConfigurations' {Maybe Int
Maybe [Text]
Maybe [Filter]
Maybe Text
maxResults :: Maybe Int
licenseConfigurationArns :: Maybe [Text]
nextToken :: Maybe Text
filters :: Maybe [Filter]
$sel:maxResults:ListLicenseConfigurations' :: ListLicenseConfigurations -> Maybe Int
$sel:licenseConfigurationArns:ListLicenseConfigurations' :: ListLicenseConfigurations -> Maybe [Text]
$sel:nextToken:ListLicenseConfigurations' :: ListLicenseConfigurations -> Maybe Text
$sel:filters:ListLicenseConfigurations' :: ListLicenseConfigurations -> Maybe [Filter]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Filters" Text -> [Filter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Filter] -> Pair) -> Maybe [Filter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Filter]
filters,
            (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
"LicenseConfigurationArns" 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]
licenseConfigurationArns,
            (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
          ]
      )

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

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

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

-- |
-- Create a value of 'ListLicenseConfigurationsResponse' 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', 'listLicenseConfigurationsResponse_nextToken' - Token for the next set of results.
--
-- 'licenseConfigurations', 'listLicenseConfigurationsResponse_licenseConfigurations' - Information about the license configurations.
--
-- 'httpStatus', 'listLicenseConfigurationsResponse_httpStatus' - The response's http status code.
newListLicenseConfigurationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListLicenseConfigurationsResponse
newListLicenseConfigurationsResponse :: Int -> ListLicenseConfigurationsResponse
newListLicenseConfigurationsResponse Int
pHttpStatus_ =
  ListLicenseConfigurationsResponse' :: Maybe Text
-> Maybe [LicenseConfiguration]
-> Int
-> ListLicenseConfigurationsResponse
ListLicenseConfigurationsResponse'
    { $sel:nextToken:ListLicenseConfigurationsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:licenseConfigurations:ListLicenseConfigurationsResponse' :: Maybe [LicenseConfiguration]
licenseConfigurations = Maybe [LicenseConfiguration]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListLicenseConfigurationsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | Information about the license configurations.
listLicenseConfigurationsResponse_licenseConfigurations :: Lens.Lens' ListLicenseConfigurationsResponse (Prelude.Maybe [LicenseConfiguration])
listLicenseConfigurationsResponse_licenseConfigurations :: (Maybe [LicenseConfiguration] -> f (Maybe [LicenseConfiguration]))
-> ListLicenseConfigurationsResponse
-> f ListLicenseConfigurationsResponse
listLicenseConfigurationsResponse_licenseConfigurations = (ListLicenseConfigurationsResponse -> Maybe [LicenseConfiguration])
-> (ListLicenseConfigurationsResponse
    -> Maybe [LicenseConfiguration]
    -> ListLicenseConfigurationsResponse)
-> Lens'
     ListLicenseConfigurationsResponse (Maybe [LicenseConfiguration])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLicenseConfigurationsResponse' {Maybe [LicenseConfiguration]
licenseConfigurations :: Maybe [LicenseConfiguration]
$sel:licenseConfigurations:ListLicenseConfigurationsResponse' :: ListLicenseConfigurationsResponse -> Maybe [LicenseConfiguration]
licenseConfigurations} -> Maybe [LicenseConfiguration]
licenseConfigurations) (\s :: ListLicenseConfigurationsResponse
s@ListLicenseConfigurationsResponse' {} Maybe [LicenseConfiguration]
a -> ListLicenseConfigurationsResponse
s {$sel:licenseConfigurations:ListLicenseConfigurationsResponse' :: Maybe [LicenseConfiguration]
licenseConfigurations = Maybe [LicenseConfiguration]
a} :: ListLicenseConfigurationsResponse) ((Maybe [LicenseConfiguration] -> f (Maybe [LicenseConfiguration]))
 -> ListLicenseConfigurationsResponse
 -> f ListLicenseConfigurationsResponse)
-> ((Maybe [LicenseConfiguration]
     -> f (Maybe [LicenseConfiguration]))
    -> Maybe [LicenseConfiguration]
    -> f (Maybe [LicenseConfiguration]))
-> (Maybe [LicenseConfiguration]
    -> f (Maybe [LicenseConfiguration]))
-> ListLicenseConfigurationsResponse
-> f ListLicenseConfigurationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [LicenseConfiguration]
  [LicenseConfiguration]
  [LicenseConfiguration]
  [LicenseConfiguration]
-> Iso
     (Maybe [LicenseConfiguration])
     (Maybe [LicenseConfiguration])
     (Maybe [LicenseConfiguration])
     (Maybe [LicenseConfiguration])
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
  [LicenseConfiguration]
  [LicenseConfiguration]
  [LicenseConfiguration]
  [LicenseConfiguration]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    ListLicenseConfigurationsResponse