{-# 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.ListUsageForLicenseConfiguration
-- 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 all license usage records for a license configuration, displaying
-- license consumption details by resource at a selected point in time. Use
-- this action to audit the current license consumption for any license
-- inventory and configuration.
--
-- This operation returns paginated results.
module Amazonka.LicenseManager.ListUsageForLicenseConfiguration
  ( -- * Creating a Request
    ListUsageForLicenseConfiguration (..),
    newListUsageForLicenseConfiguration,

    -- * Request Lenses
    listUsageForLicenseConfiguration_filters,
    listUsageForLicenseConfiguration_nextToken,
    listUsageForLicenseConfiguration_maxResults,
    listUsageForLicenseConfiguration_licenseConfigurationArn,

    -- * Destructuring the Response
    ListUsageForLicenseConfigurationResponse (..),
    newListUsageForLicenseConfigurationResponse,

    -- * Response Lenses
    listUsageForLicenseConfigurationResponse_nextToken,
    listUsageForLicenseConfigurationResponse_licenseConfigurationUsageList,
    listUsageForLicenseConfigurationResponse_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:/ 'newListUsageForLicenseConfiguration' smart constructor.
data ListUsageForLicenseConfiguration = ListUsageForLicenseConfiguration'
  { -- | Filters to scope the results. The following filters and logical
    -- operators are supported:
    --
    -- -   @resourceArn@ - The ARN of the license configuration resource.
    --     Logical operators are @EQUALS@ | @NOT_EQUALS@.
    --
    -- -   @resourceType@ - The resource type (@EC2_INSTANCE@ | @EC2_HOST@ |
    --     @EC2_AMI@ | @SYSTEMS_MANAGER_MANAGED_INSTANCE@). Logical operators
    --     are @EQUALS@ | @NOT_EQUALS@.
    --
    -- -   @resourceAccount@ - The ID of the account that owns the resource.
    --     Logical operators are @EQUALS@ | @NOT_EQUALS@.
    ListUsageForLicenseConfiguration -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | Token for the next set of results.
    ListUsageForLicenseConfiguration -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Maximum number of results to return in a single call.
    ListUsageForLicenseConfiguration -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | Amazon Resource Name (ARN) of the license configuration.
    ListUsageForLicenseConfiguration -> Text
licenseConfigurationArn :: Prelude.Text
  }
  deriving (ListUsageForLicenseConfiguration
-> ListUsageForLicenseConfiguration -> Bool
(ListUsageForLicenseConfiguration
 -> ListUsageForLicenseConfiguration -> Bool)
-> (ListUsageForLicenseConfiguration
    -> ListUsageForLicenseConfiguration -> Bool)
-> Eq ListUsageForLicenseConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListUsageForLicenseConfiguration
-> ListUsageForLicenseConfiguration -> Bool
$c/= :: ListUsageForLicenseConfiguration
-> ListUsageForLicenseConfiguration -> Bool
== :: ListUsageForLicenseConfiguration
-> ListUsageForLicenseConfiguration -> Bool
$c== :: ListUsageForLicenseConfiguration
-> ListUsageForLicenseConfiguration -> Bool
Prelude.Eq, ReadPrec [ListUsageForLicenseConfiguration]
ReadPrec ListUsageForLicenseConfiguration
Int -> ReadS ListUsageForLicenseConfiguration
ReadS [ListUsageForLicenseConfiguration]
(Int -> ReadS ListUsageForLicenseConfiguration)
-> ReadS [ListUsageForLicenseConfiguration]
-> ReadPrec ListUsageForLicenseConfiguration
-> ReadPrec [ListUsageForLicenseConfiguration]
-> Read ListUsageForLicenseConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListUsageForLicenseConfiguration]
$creadListPrec :: ReadPrec [ListUsageForLicenseConfiguration]
readPrec :: ReadPrec ListUsageForLicenseConfiguration
$creadPrec :: ReadPrec ListUsageForLicenseConfiguration
readList :: ReadS [ListUsageForLicenseConfiguration]
$creadList :: ReadS [ListUsageForLicenseConfiguration]
readsPrec :: Int -> ReadS ListUsageForLicenseConfiguration
$creadsPrec :: Int -> ReadS ListUsageForLicenseConfiguration
Prelude.Read, Int -> ListUsageForLicenseConfiguration -> ShowS
[ListUsageForLicenseConfiguration] -> ShowS
ListUsageForLicenseConfiguration -> String
(Int -> ListUsageForLicenseConfiguration -> ShowS)
-> (ListUsageForLicenseConfiguration -> String)
-> ([ListUsageForLicenseConfiguration] -> ShowS)
-> Show ListUsageForLicenseConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListUsageForLicenseConfiguration] -> ShowS
$cshowList :: [ListUsageForLicenseConfiguration] -> ShowS
show :: ListUsageForLicenseConfiguration -> String
$cshow :: ListUsageForLicenseConfiguration -> String
showsPrec :: Int -> ListUsageForLicenseConfiguration -> ShowS
$cshowsPrec :: Int -> ListUsageForLicenseConfiguration -> ShowS
Prelude.Show, (forall x.
 ListUsageForLicenseConfiguration
 -> Rep ListUsageForLicenseConfiguration x)
-> (forall x.
    Rep ListUsageForLicenseConfiguration x
    -> ListUsageForLicenseConfiguration)
-> Generic ListUsageForLicenseConfiguration
forall x.
Rep ListUsageForLicenseConfiguration x
-> ListUsageForLicenseConfiguration
forall x.
ListUsageForLicenseConfiguration
-> Rep ListUsageForLicenseConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListUsageForLicenseConfiguration x
-> ListUsageForLicenseConfiguration
$cfrom :: forall x.
ListUsageForLicenseConfiguration
-> Rep ListUsageForLicenseConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ListUsageForLicenseConfiguration' 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', 'listUsageForLicenseConfiguration_filters' - Filters to scope the results. The following filters and logical
-- operators are supported:
--
-- -   @resourceArn@ - The ARN of the license configuration resource.
--     Logical operators are @EQUALS@ | @NOT_EQUALS@.
--
-- -   @resourceType@ - The resource type (@EC2_INSTANCE@ | @EC2_HOST@ |
--     @EC2_AMI@ | @SYSTEMS_MANAGER_MANAGED_INSTANCE@). Logical operators
--     are @EQUALS@ | @NOT_EQUALS@.
--
-- -   @resourceAccount@ - The ID of the account that owns the resource.
--     Logical operators are @EQUALS@ | @NOT_EQUALS@.
--
-- 'nextToken', 'listUsageForLicenseConfiguration_nextToken' - Token for the next set of results.
--
-- 'maxResults', 'listUsageForLicenseConfiguration_maxResults' - Maximum number of results to return in a single call.
--
-- 'licenseConfigurationArn', 'listUsageForLicenseConfiguration_licenseConfigurationArn' - Amazon Resource Name (ARN) of the license configuration.
newListUsageForLicenseConfiguration ::
  -- | 'licenseConfigurationArn'
  Prelude.Text ->
  ListUsageForLicenseConfiguration
newListUsageForLicenseConfiguration :: Text -> ListUsageForLicenseConfiguration
newListUsageForLicenseConfiguration
  Text
pLicenseConfigurationArn_ =
    ListUsageForLicenseConfiguration' :: Maybe [Filter]
-> Maybe Text
-> Maybe Int
-> Text
-> ListUsageForLicenseConfiguration
ListUsageForLicenseConfiguration'
      { $sel:filters:ListUsageForLicenseConfiguration' :: Maybe [Filter]
filters =
          Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:ListUsageForLicenseConfiguration' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListUsageForLicenseConfiguration' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:licenseConfigurationArn:ListUsageForLicenseConfiguration' :: Text
licenseConfigurationArn =
          Text
pLicenseConfigurationArn_
      }

-- | Filters to scope the results. The following filters and logical
-- operators are supported:
--
-- -   @resourceArn@ - The ARN of the license configuration resource.
--     Logical operators are @EQUALS@ | @NOT_EQUALS@.
--
-- -   @resourceType@ - The resource type (@EC2_INSTANCE@ | @EC2_HOST@ |
--     @EC2_AMI@ | @SYSTEMS_MANAGER_MANAGED_INSTANCE@). Logical operators
--     are @EQUALS@ | @NOT_EQUALS@.
--
-- -   @resourceAccount@ - The ID of the account that owns the resource.
--     Logical operators are @EQUALS@ | @NOT_EQUALS@.
listUsageForLicenseConfiguration_filters :: Lens.Lens' ListUsageForLicenseConfiguration (Prelude.Maybe [Filter])
listUsageForLicenseConfiguration_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> ListUsageForLicenseConfiguration
-> f ListUsageForLicenseConfiguration
listUsageForLicenseConfiguration_filters = (ListUsageForLicenseConfiguration -> Maybe [Filter])
-> (ListUsageForLicenseConfiguration
    -> Maybe [Filter] -> ListUsageForLicenseConfiguration)
-> Lens
     ListUsageForLicenseConfiguration
     ListUsageForLicenseConfiguration
     (Maybe [Filter])
     (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUsageForLicenseConfiguration' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:ListUsageForLicenseConfiguration' :: ListUsageForLicenseConfiguration -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: ListUsageForLicenseConfiguration
s@ListUsageForLicenseConfiguration' {} Maybe [Filter]
a -> ListUsageForLicenseConfiguration
s {$sel:filters:ListUsageForLicenseConfiguration' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: ListUsageForLicenseConfiguration) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> ListUsageForLicenseConfiguration
 -> f ListUsageForLicenseConfiguration)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> ListUsageForLicenseConfiguration
-> f ListUsageForLicenseConfiguration
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.
listUsageForLicenseConfiguration_nextToken :: Lens.Lens' ListUsageForLicenseConfiguration (Prelude.Maybe Prelude.Text)
listUsageForLicenseConfiguration_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListUsageForLicenseConfiguration
-> f ListUsageForLicenseConfiguration
listUsageForLicenseConfiguration_nextToken = (ListUsageForLicenseConfiguration -> Maybe Text)
-> (ListUsageForLicenseConfiguration
    -> Maybe Text -> ListUsageForLicenseConfiguration)
-> Lens
     ListUsageForLicenseConfiguration
     ListUsageForLicenseConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUsageForLicenseConfiguration' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListUsageForLicenseConfiguration' :: ListUsageForLicenseConfiguration -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListUsageForLicenseConfiguration
s@ListUsageForLicenseConfiguration' {} Maybe Text
a -> ListUsageForLicenseConfiguration
s {$sel:nextToken:ListUsageForLicenseConfiguration' :: Maybe Text
nextToken = Maybe Text
a} :: ListUsageForLicenseConfiguration)

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

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

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

instance
  Prelude.NFData
    ListUsageForLicenseConfiguration

instance
  Core.ToHeaders
    ListUsageForLicenseConfiguration
  where
  toHeaders :: ListUsageForLicenseConfiguration -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> ListUsageForLicenseConfiguration -> 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.ListUsageForLicenseConfiguration" ::
                          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 ListUsageForLicenseConfiguration where
  toJSON :: ListUsageForLicenseConfiguration -> Value
toJSON ListUsageForLicenseConfiguration' {Maybe Int
Maybe [Filter]
Maybe Text
Text
licenseConfigurationArn :: Text
maxResults :: Maybe Int
nextToken :: Maybe Text
filters :: Maybe [Filter]
$sel:licenseConfigurationArn:ListUsageForLicenseConfiguration' :: ListUsageForLicenseConfiguration -> Text
$sel:maxResults:ListUsageForLicenseConfiguration' :: ListUsageForLicenseConfiguration -> Maybe Int
$sel:nextToken:ListUsageForLicenseConfiguration' :: ListUsageForLicenseConfiguration -> Maybe Text
$sel:filters:ListUsageForLicenseConfiguration' :: ListUsageForLicenseConfiguration -> 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
"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 ListUsageForLicenseConfiguration where
  toPath :: ListUsageForLicenseConfiguration -> ByteString
toPath = ByteString -> ListUsageForLicenseConfiguration -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'ListUsageForLicenseConfigurationResponse' 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', 'listUsageForLicenseConfigurationResponse_nextToken' - Token for the next set of results.
--
-- 'licenseConfigurationUsageList', 'listUsageForLicenseConfigurationResponse_licenseConfigurationUsageList' - Information about the license configurations.
--
-- 'httpStatus', 'listUsageForLicenseConfigurationResponse_httpStatus' - The response's http status code.
newListUsageForLicenseConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListUsageForLicenseConfigurationResponse
newListUsageForLicenseConfigurationResponse :: Int -> ListUsageForLicenseConfigurationResponse
newListUsageForLicenseConfigurationResponse
  Int
pHttpStatus_ =
    ListUsageForLicenseConfigurationResponse' :: Maybe Text
-> Maybe [LicenseConfigurationUsage]
-> Int
-> ListUsageForLicenseConfigurationResponse
ListUsageForLicenseConfigurationResponse'
      { $sel:nextToken:ListUsageForLicenseConfigurationResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:licenseConfigurationUsageList:ListUsageForLicenseConfigurationResponse' :: Maybe [LicenseConfigurationUsage]
licenseConfigurationUsageList =
          Maybe [LicenseConfigurationUsage]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListUsageForLicenseConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

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

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

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

instance
  Prelude.NFData
    ListUsageForLicenseConfigurationResponse