{-# 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.BillingConductor.ListResourcesAssociatedToCustomLineItem
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- List the resources that are associated to a custom line item.
--
-- This operation returns paginated results.
module Amazonka.BillingConductor.ListResourcesAssociatedToCustomLineItem
  ( -- * Creating a Request
    ListResourcesAssociatedToCustomLineItem (..),
    newListResourcesAssociatedToCustomLineItem,

    -- * Request Lenses
    listResourcesAssociatedToCustomLineItem_billingPeriod,
    listResourcesAssociatedToCustomLineItem_filters,
    listResourcesAssociatedToCustomLineItem_maxResults,
    listResourcesAssociatedToCustomLineItem_nextToken,
    listResourcesAssociatedToCustomLineItem_arn,

    -- * Destructuring the Response
    ListResourcesAssociatedToCustomLineItemResponse (..),
    newListResourcesAssociatedToCustomLineItemResponse,

    -- * Response Lenses
    listResourcesAssociatedToCustomLineItemResponse_arn,
    listResourcesAssociatedToCustomLineItemResponse_associatedResources,
    listResourcesAssociatedToCustomLineItemResponse_nextToken,
    listResourcesAssociatedToCustomLineItemResponse_httpStatus,
  )
where

import Amazonka.BillingConductor.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListResourcesAssociatedToCustomLineItem' smart constructor.
data ListResourcesAssociatedToCustomLineItem = ListResourcesAssociatedToCustomLineItem'
  { -- | The billing period for which the resource associations will be listed.
    ListResourcesAssociatedToCustomLineItem -> Maybe Text
billingPeriod :: Prelude.Maybe Prelude.Text,
    -- | (Optional) A @ListResourcesAssociatedToCustomLineItemFilter@ that can
    -- specify the types of resources that should be retrieved.
    ListResourcesAssociatedToCustomLineItem
-> Maybe ListResourcesAssociatedToCustomLineItemFilter
filters :: Prelude.Maybe ListResourcesAssociatedToCustomLineItemFilter,
    -- | (Optional) The maximum number of resource associations to be retrieved.
    ListResourcesAssociatedToCustomLineItem -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | (Optional) The pagination token that\'s returned by a previous request.
    ListResourcesAssociatedToCustomLineItem -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the custom line item for which the resource associations will
    -- be listed.
    ListResourcesAssociatedToCustomLineItem -> Text
arn :: Prelude.Text
  }
  deriving (ListResourcesAssociatedToCustomLineItem
-> ListResourcesAssociatedToCustomLineItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResourcesAssociatedToCustomLineItem
-> ListResourcesAssociatedToCustomLineItem -> Bool
$c/= :: ListResourcesAssociatedToCustomLineItem
-> ListResourcesAssociatedToCustomLineItem -> Bool
== :: ListResourcesAssociatedToCustomLineItem
-> ListResourcesAssociatedToCustomLineItem -> Bool
$c== :: ListResourcesAssociatedToCustomLineItem
-> ListResourcesAssociatedToCustomLineItem -> Bool
Prelude.Eq, ReadPrec [ListResourcesAssociatedToCustomLineItem]
ReadPrec ListResourcesAssociatedToCustomLineItem
Int -> ReadS ListResourcesAssociatedToCustomLineItem
ReadS [ListResourcesAssociatedToCustomLineItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResourcesAssociatedToCustomLineItem]
$creadListPrec :: ReadPrec [ListResourcesAssociatedToCustomLineItem]
readPrec :: ReadPrec ListResourcesAssociatedToCustomLineItem
$creadPrec :: ReadPrec ListResourcesAssociatedToCustomLineItem
readList :: ReadS [ListResourcesAssociatedToCustomLineItem]
$creadList :: ReadS [ListResourcesAssociatedToCustomLineItem]
readsPrec :: Int -> ReadS ListResourcesAssociatedToCustomLineItem
$creadsPrec :: Int -> ReadS ListResourcesAssociatedToCustomLineItem
Prelude.Read, Int -> ListResourcesAssociatedToCustomLineItem -> ShowS
[ListResourcesAssociatedToCustomLineItem] -> ShowS
ListResourcesAssociatedToCustomLineItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResourcesAssociatedToCustomLineItem] -> ShowS
$cshowList :: [ListResourcesAssociatedToCustomLineItem] -> ShowS
show :: ListResourcesAssociatedToCustomLineItem -> String
$cshow :: ListResourcesAssociatedToCustomLineItem -> String
showsPrec :: Int -> ListResourcesAssociatedToCustomLineItem -> ShowS
$cshowsPrec :: Int -> ListResourcesAssociatedToCustomLineItem -> ShowS
Prelude.Show, forall x.
Rep ListResourcesAssociatedToCustomLineItem x
-> ListResourcesAssociatedToCustomLineItem
forall x.
ListResourcesAssociatedToCustomLineItem
-> Rep ListResourcesAssociatedToCustomLineItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListResourcesAssociatedToCustomLineItem x
-> ListResourcesAssociatedToCustomLineItem
$cfrom :: forall x.
ListResourcesAssociatedToCustomLineItem
-> Rep ListResourcesAssociatedToCustomLineItem x
Prelude.Generic)

-- |
-- Create a value of 'ListResourcesAssociatedToCustomLineItem' 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:
--
-- 'billingPeriod', 'listResourcesAssociatedToCustomLineItem_billingPeriod' - The billing period for which the resource associations will be listed.
--
-- 'filters', 'listResourcesAssociatedToCustomLineItem_filters' - (Optional) A @ListResourcesAssociatedToCustomLineItemFilter@ that can
-- specify the types of resources that should be retrieved.
--
-- 'maxResults', 'listResourcesAssociatedToCustomLineItem_maxResults' - (Optional) The maximum number of resource associations to be retrieved.
--
-- 'nextToken', 'listResourcesAssociatedToCustomLineItem_nextToken' - (Optional) The pagination token that\'s returned by a previous request.
--
-- 'arn', 'listResourcesAssociatedToCustomLineItem_arn' - The ARN of the custom line item for which the resource associations will
-- be listed.
newListResourcesAssociatedToCustomLineItem ::
  -- | 'arn'
  Prelude.Text ->
  ListResourcesAssociatedToCustomLineItem
newListResourcesAssociatedToCustomLineItem :: Text -> ListResourcesAssociatedToCustomLineItem
newListResourcesAssociatedToCustomLineItem Text
pArn_ =
  ListResourcesAssociatedToCustomLineItem'
    { $sel:billingPeriod:ListResourcesAssociatedToCustomLineItem' :: Maybe Text
billingPeriod =
        forall a. Maybe a
Prelude.Nothing,
      $sel:filters:ListResourcesAssociatedToCustomLineItem' :: Maybe ListResourcesAssociatedToCustomLineItemFilter
filters = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListResourcesAssociatedToCustomLineItem' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListResourcesAssociatedToCustomLineItem' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:arn:ListResourcesAssociatedToCustomLineItem' :: Text
arn = Text
pArn_
    }

-- | The billing period for which the resource associations will be listed.
listResourcesAssociatedToCustomLineItem_billingPeriod :: Lens.Lens' ListResourcesAssociatedToCustomLineItem (Prelude.Maybe Prelude.Text)
listResourcesAssociatedToCustomLineItem_billingPeriod :: Lens' ListResourcesAssociatedToCustomLineItem (Maybe Text)
listResourcesAssociatedToCustomLineItem_billingPeriod = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesAssociatedToCustomLineItem' {Maybe Text
billingPeriod :: Maybe Text
$sel:billingPeriod:ListResourcesAssociatedToCustomLineItem' :: ListResourcesAssociatedToCustomLineItem -> Maybe Text
billingPeriod} -> Maybe Text
billingPeriod) (\s :: ListResourcesAssociatedToCustomLineItem
s@ListResourcesAssociatedToCustomLineItem' {} Maybe Text
a -> ListResourcesAssociatedToCustomLineItem
s {$sel:billingPeriod:ListResourcesAssociatedToCustomLineItem' :: Maybe Text
billingPeriod = Maybe Text
a} :: ListResourcesAssociatedToCustomLineItem)

-- | (Optional) A @ListResourcesAssociatedToCustomLineItemFilter@ that can
-- specify the types of resources that should be retrieved.
listResourcesAssociatedToCustomLineItem_filters :: Lens.Lens' ListResourcesAssociatedToCustomLineItem (Prelude.Maybe ListResourcesAssociatedToCustomLineItemFilter)
listResourcesAssociatedToCustomLineItem_filters :: Lens'
  ListResourcesAssociatedToCustomLineItem
  (Maybe ListResourcesAssociatedToCustomLineItemFilter)
listResourcesAssociatedToCustomLineItem_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesAssociatedToCustomLineItem' {Maybe ListResourcesAssociatedToCustomLineItemFilter
filters :: Maybe ListResourcesAssociatedToCustomLineItemFilter
$sel:filters:ListResourcesAssociatedToCustomLineItem' :: ListResourcesAssociatedToCustomLineItem
-> Maybe ListResourcesAssociatedToCustomLineItemFilter
filters} -> Maybe ListResourcesAssociatedToCustomLineItemFilter
filters) (\s :: ListResourcesAssociatedToCustomLineItem
s@ListResourcesAssociatedToCustomLineItem' {} Maybe ListResourcesAssociatedToCustomLineItemFilter
a -> ListResourcesAssociatedToCustomLineItem
s {$sel:filters:ListResourcesAssociatedToCustomLineItem' :: Maybe ListResourcesAssociatedToCustomLineItemFilter
filters = Maybe ListResourcesAssociatedToCustomLineItemFilter
a} :: ListResourcesAssociatedToCustomLineItem)

-- | (Optional) The maximum number of resource associations to be retrieved.
listResourcesAssociatedToCustomLineItem_maxResults :: Lens.Lens' ListResourcesAssociatedToCustomLineItem (Prelude.Maybe Prelude.Natural)
listResourcesAssociatedToCustomLineItem_maxResults :: Lens' ListResourcesAssociatedToCustomLineItem (Maybe Natural)
listResourcesAssociatedToCustomLineItem_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesAssociatedToCustomLineItem' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListResourcesAssociatedToCustomLineItem' :: ListResourcesAssociatedToCustomLineItem -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListResourcesAssociatedToCustomLineItem
s@ListResourcesAssociatedToCustomLineItem' {} Maybe Natural
a -> ListResourcesAssociatedToCustomLineItem
s {$sel:maxResults:ListResourcesAssociatedToCustomLineItem' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListResourcesAssociatedToCustomLineItem)

-- | (Optional) The pagination token that\'s returned by a previous request.
listResourcesAssociatedToCustomLineItem_nextToken :: Lens.Lens' ListResourcesAssociatedToCustomLineItem (Prelude.Maybe Prelude.Text)
listResourcesAssociatedToCustomLineItem_nextToken :: Lens' ListResourcesAssociatedToCustomLineItem (Maybe Text)
listResourcesAssociatedToCustomLineItem_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesAssociatedToCustomLineItem' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListResourcesAssociatedToCustomLineItem' :: ListResourcesAssociatedToCustomLineItem -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListResourcesAssociatedToCustomLineItem
s@ListResourcesAssociatedToCustomLineItem' {} Maybe Text
a -> ListResourcesAssociatedToCustomLineItem
s {$sel:nextToken:ListResourcesAssociatedToCustomLineItem' :: Maybe Text
nextToken = Maybe Text
a} :: ListResourcesAssociatedToCustomLineItem)

-- | The ARN of the custom line item for which the resource associations will
-- be listed.
listResourcesAssociatedToCustomLineItem_arn :: Lens.Lens' ListResourcesAssociatedToCustomLineItem Prelude.Text
listResourcesAssociatedToCustomLineItem_arn :: Lens' ListResourcesAssociatedToCustomLineItem Text
listResourcesAssociatedToCustomLineItem_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesAssociatedToCustomLineItem' {Text
arn :: Text
$sel:arn:ListResourcesAssociatedToCustomLineItem' :: ListResourcesAssociatedToCustomLineItem -> Text
arn} -> Text
arn) (\s :: ListResourcesAssociatedToCustomLineItem
s@ListResourcesAssociatedToCustomLineItem' {} Text
a -> ListResourcesAssociatedToCustomLineItem
s {$sel:arn:ListResourcesAssociatedToCustomLineItem' :: Text
arn = Text
a} :: ListResourcesAssociatedToCustomLineItem)

instance
  Core.AWSPager
    ListResourcesAssociatedToCustomLineItem
  where
  page :: ListResourcesAssociatedToCustomLineItem
-> AWSResponse ListResourcesAssociatedToCustomLineItem
-> Maybe ListResourcesAssociatedToCustomLineItem
page ListResourcesAssociatedToCustomLineItem
rq AWSResponse ListResourcesAssociatedToCustomLineItem
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListResourcesAssociatedToCustomLineItem
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListResourcesAssociatedToCustomLineItemResponse (Maybe Text)
listResourcesAssociatedToCustomLineItemResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListResourcesAssociatedToCustomLineItem
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
  ListResourcesAssociatedToCustomLineItemResponse
  (Maybe [ListResourcesAssociatedToCustomLineItemResponseElement])
listResourcesAssociatedToCustomLineItemResponse_associatedResources
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListResourcesAssociatedToCustomLineItem
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListResourcesAssociatedToCustomLineItem (Maybe Text)
listResourcesAssociatedToCustomLineItem_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListResourcesAssociatedToCustomLineItem
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListResourcesAssociatedToCustomLineItemResponse (Maybe Text)
listResourcesAssociatedToCustomLineItemResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance
  Core.AWSRequest
    ListResourcesAssociatedToCustomLineItem
  where
  type
    AWSResponse
      ListResourcesAssociatedToCustomLineItem =
      ListResourcesAssociatedToCustomLineItemResponse
  request :: (Service -> Service)
-> ListResourcesAssociatedToCustomLineItem
-> Request ListResourcesAssociatedToCustomLineItem
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListResourcesAssociatedToCustomLineItem
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse ListResourcesAssociatedToCustomLineItem)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe [ListResourcesAssociatedToCustomLineItemResponseElement]
-> Maybe Text
-> Int
-> ListResourcesAssociatedToCustomLineItemResponse
ListResourcesAssociatedToCustomLineItemResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"AssociatedResources"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    ListResourcesAssociatedToCustomLineItem
  where
  hashWithSalt :: Int -> ListResourcesAssociatedToCustomLineItem -> Int
hashWithSalt
    Int
_salt
    ListResourcesAssociatedToCustomLineItem' {Maybe Natural
Maybe Text
Maybe ListResourcesAssociatedToCustomLineItemFilter
Text
arn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe ListResourcesAssociatedToCustomLineItemFilter
billingPeriod :: Maybe Text
$sel:arn:ListResourcesAssociatedToCustomLineItem' :: ListResourcesAssociatedToCustomLineItem -> Text
$sel:nextToken:ListResourcesAssociatedToCustomLineItem' :: ListResourcesAssociatedToCustomLineItem -> Maybe Text
$sel:maxResults:ListResourcesAssociatedToCustomLineItem' :: ListResourcesAssociatedToCustomLineItem -> Maybe Natural
$sel:filters:ListResourcesAssociatedToCustomLineItem' :: ListResourcesAssociatedToCustomLineItem
-> Maybe ListResourcesAssociatedToCustomLineItemFilter
$sel:billingPeriod:ListResourcesAssociatedToCustomLineItem' :: ListResourcesAssociatedToCustomLineItem -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
billingPeriod
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ListResourcesAssociatedToCustomLineItemFilter
filters
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn

instance
  Prelude.NFData
    ListResourcesAssociatedToCustomLineItem
  where
  rnf :: ListResourcesAssociatedToCustomLineItem -> ()
rnf ListResourcesAssociatedToCustomLineItem' {Maybe Natural
Maybe Text
Maybe ListResourcesAssociatedToCustomLineItemFilter
Text
arn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe ListResourcesAssociatedToCustomLineItemFilter
billingPeriod :: Maybe Text
$sel:arn:ListResourcesAssociatedToCustomLineItem' :: ListResourcesAssociatedToCustomLineItem -> Text
$sel:nextToken:ListResourcesAssociatedToCustomLineItem' :: ListResourcesAssociatedToCustomLineItem -> Maybe Text
$sel:maxResults:ListResourcesAssociatedToCustomLineItem' :: ListResourcesAssociatedToCustomLineItem -> Maybe Natural
$sel:filters:ListResourcesAssociatedToCustomLineItem' :: ListResourcesAssociatedToCustomLineItem
-> Maybe ListResourcesAssociatedToCustomLineItemFilter
$sel:billingPeriod:ListResourcesAssociatedToCustomLineItem' :: ListResourcesAssociatedToCustomLineItem -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
billingPeriod
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ListResourcesAssociatedToCustomLineItemFilter
filters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn

instance
  Data.ToHeaders
    ListResourcesAssociatedToCustomLineItem
  where
  toHeaders :: ListResourcesAssociatedToCustomLineItem -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance
  Data.ToJSON
    ListResourcesAssociatedToCustomLineItem
  where
  toJSON :: ListResourcesAssociatedToCustomLineItem -> Value
toJSON ListResourcesAssociatedToCustomLineItem' {Maybe Natural
Maybe Text
Maybe ListResourcesAssociatedToCustomLineItemFilter
Text
arn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe ListResourcesAssociatedToCustomLineItemFilter
billingPeriod :: Maybe Text
$sel:arn:ListResourcesAssociatedToCustomLineItem' :: ListResourcesAssociatedToCustomLineItem -> Text
$sel:nextToken:ListResourcesAssociatedToCustomLineItem' :: ListResourcesAssociatedToCustomLineItem -> Maybe Text
$sel:maxResults:ListResourcesAssociatedToCustomLineItem' :: ListResourcesAssociatedToCustomLineItem -> Maybe Natural
$sel:filters:ListResourcesAssociatedToCustomLineItem' :: ListResourcesAssociatedToCustomLineItem
-> Maybe ListResourcesAssociatedToCustomLineItemFilter
$sel:billingPeriod:ListResourcesAssociatedToCustomLineItem' :: ListResourcesAssociatedToCustomLineItem -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"BillingPeriod" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
billingPeriod,
            (Key
"Filters" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ListResourcesAssociatedToCustomLineItemFilter
filters,
            (Key
"MaxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            forall a. a -> Maybe a
Prelude.Just (Key
"Arn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
arn)
          ]
      )

instance
  Data.ToPath
    ListResourcesAssociatedToCustomLineItem
  where
  toPath :: ListResourcesAssociatedToCustomLineItem -> ByteString
toPath =
    forall a b. a -> b -> a
Prelude.const
      ByteString
"/list-resources-associated-to-custom-line-item"

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

-- | /See:/ 'newListResourcesAssociatedToCustomLineItemResponse' smart constructor.
data ListResourcesAssociatedToCustomLineItemResponse = ListResourcesAssociatedToCustomLineItemResponse'
  { -- | The custom line item ARN for which the resource associations are listed.
    ListResourcesAssociatedToCustomLineItemResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | A list of @ListResourcesAssociatedToCustomLineItemResponseElement@ for
    -- each resource association retrieved.
    ListResourcesAssociatedToCustomLineItemResponse
-> Maybe [ListResourcesAssociatedToCustomLineItemResponseElement]
associatedResources :: Prelude.Maybe [ListResourcesAssociatedToCustomLineItemResponseElement],
    -- | The pagination token to be used in subsequent requests to retrieve
    -- additional results.
    ListResourcesAssociatedToCustomLineItemResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListResourcesAssociatedToCustomLineItemResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListResourcesAssociatedToCustomLineItemResponse
-> ListResourcesAssociatedToCustomLineItemResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResourcesAssociatedToCustomLineItemResponse
-> ListResourcesAssociatedToCustomLineItemResponse -> Bool
$c/= :: ListResourcesAssociatedToCustomLineItemResponse
-> ListResourcesAssociatedToCustomLineItemResponse -> Bool
== :: ListResourcesAssociatedToCustomLineItemResponse
-> ListResourcesAssociatedToCustomLineItemResponse -> Bool
$c== :: ListResourcesAssociatedToCustomLineItemResponse
-> ListResourcesAssociatedToCustomLineItemResponse -> Bool
Prelude.Eq, ReadPrec [ListResourcesAssociatedToCustomLineItemResponse]
ReadPrec ListResourcesAssociatedToCustomLineItemResponse
Int -> ReadS ListResourcesAssociatedToCustomLineItemResponse
ReadS [ListResourcesAssociatedToCustomLineItemResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResourcesAssociatedToCustomLineItemResponse]
$creadListPrec :: ReadPrec [ListResourcesAssociatedToCustomLineItemResponse]
readPrec :: ReadPrec ListResourcesAssociatedToCustomLineItemResponse
$creadPrec :: ReadPrec ListResourcesAssociatedToCustomLineItemResponse
readList :: ReadS [ListResourcesAssociatedToCustomLineItemResponse]
$creadList :: ReadS [ListResourcesAssociatedToCustomLineItemResponse]
readsPrec :: Int -> ReadS ListResourcesAssociatedToCustomLineItemResponse
$creadsPrec :: Int -> ReadS ListResourcesAssociatedToCustomLineItemResponse
Prelude.Read, Int -> ListResourcesAssociatedToCustomLineItemResponse -> ShowS
[ListResourcesAssociatedToCustomLineItemResponse] -> ShowS
ListResourcesAssociatedToCustomLineItemResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResourcesAssociatedToCustomLineItemResponse] -> ShowS
$cshowList :: [ListResourcesAssociatedToCustomLineItemResponse] -> ShowS
show :: ListResourcesAssociatedToCustomLineItemResponse -> String
$cshow :: ListResourcesAssociatedToCustomLineItemResponse -> String
showsPrec :: Int -> ListResourcesAssociatedToCustomLineItemResponse -> ShowS
$cshowsPrec :: Int -> ListResourcesAssociatedToCustomLineItemResponse -> ShowS
Prelude.Show, forall x.
Rep ListResourcesAssociatedToCustomLineItemResponse x
-> ListResourcesAssociatedToCustomLineItemResponse
forall x.
ListResourcesAssociatedToCustomLineItemResponse
-> Rep ListResourcesAssociatedToCustomLineItemResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListResourcesAssociatedToCustomLineItemResponse x
-> ListResourcesAssociatedToCustomLineItemResponse
$cfrom :: forall x.
ListResourcesAssociatedToCustomLineItemResponse
-> Rep ListResourcesAssociatedToCustomLineItemResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListResourcesAssociatedToCustomLineItemResponse' 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:
--
-- 'arn', 'listResourcesAssociatedToCustomLineItemResponse_arn' - The custom line item ARN for which the resource associations are listed.
--
-- 'associatedResources', 'listResourcesAssociatedToCustomLineItemResponse_associatedResources' - A list of @ListResourcesAssociatedToCustomLineItemResponseElement@ for
-- each resource association retrieved.
--
-- 'nextToken', 'listResourcesAssociatedToCustomLineItemResponse_nextToken' - The pagination token to be used in subsequent requests to retrieve
-- additional results.
--
-- 'httpStatus', 'listResourcesAssociatedToCustomLineItemResponse_httpStatus' - The response's http status code.
newListResourcesAssociatedToCustomLineItemResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListResourcesAssociatedToCustomLineItemResponse
newListResourcesAssociatedToCustomLineItemResponse :: Int -> ListResourcesAssociatedToCustomLineItemResponse
newListResourcesAssociatedToCustomLineItemResponse
  Int
pHttpStatus_ =
    ListResourcesAssociatedToCustomLineItemResponse'
      { $sel:arn:ListResourcesAssociatedToCustomLineItemResponse' :: Maybe Text
arn =
          forall a. Maybe a
Prelude.Nothing,
        $sel:associatedResources:ListResourcesAssociatedToCustomLineItemResponse' :: Maybe [ListResourcesAssociatedToCustomLineItemResponseElement]
associatedResources =
          forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:ListResourcesAssociatedToCustomLineItemResponse' :: Maybe Text
nextToken =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListResourcesAssociatedToCustomLineItemResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The custom line item ARN for which the resource associations are listed.
listResourcesAssociatedToCustomLineItemResponse_arn :: Lens.Lens' ListResourcesAssociatedToCustomLineItemResponse (Prelude.Maybe Prelude.Text)
listResourcesAssociatedToCustomLineItemResponse_arn :: Lens' ListResourcesAssociatedToCustomLineItemResponse (Maybe Text)
listResourcesAssociatedToCustomLineItemResponse_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesAssociatedToCustomLineItemResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:ListResourcesAssociatedToCustomLineItemResponse' :: ListResourcesAssociatedToCustomLineItemResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: ListResourcesAssociatedToCustomLineItemResponse
s@ListResourcesAssociatedToCustomLineItemResponse' {} Maybe Text
a -> ListResourcesAssociatedToCustomLineItemResponse
s {$sel:arn:ListResourcesAssociatedToCustomLineItemResponse' :: Maybe Text
arn = Maybe Text
a} :: ListResourcesAssociatedToCustomLineItemResponse)

-- | A list of @ListResourcesAssociatedToCustomLineItemResponseElement@ for
-- each resource association retrieved.
listResourcesAssociatedToCustomLineItemResponse_associatedResources :: Lens.Lens' ListResourcesAssociatedToCustomLineItemResponse (Prelude.Maybe [ListResourcesAssociatedToCustomLineItemResponseElement])
listResourcesAssociatedToCustomLineItemResponse_associatedResources :: Lens'
  ListResourcesAssociatedToCustomLineItemResponse
  (Maybe [ListResourcesAssociatedToCustomLineItemResponseElement])
listResourcesAssociatedToCustomLineItemResponse_associatedResources = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesAssociatedToCustomLineItemResponse' {Maybe [ListResourcesAssociatedToCustomLineItemResponseElement]
associatedResources :: Maybe [ListResourcesAssociatedToCustomLineItemResponseElement]
$sel:associatedResources:ListResourcesAssociatedToCustomLineItemResponse' :: ListResourcesAssociatedToCustomLineItemResponse
-> Maybe [ListResourcesAssociatedToCustomLineItemResponseElement]
associatedResources} -> Maybe [ListResourcesAssociatedToCustomLineItemResponseElement]
associatedResources) (\s :: ListResourcesAssociatedToCustomLineItemResponse
s@ListResourcesAssociatedToCustomLineItemResponse' {} Maybe [ListResourcesAssociatedToCustomLineItemResponseElement]
a -> ListResourcesAssociatedToCustomLineItemResponse
s {$sel:associatedResources:ListResourcesAssociatedToCustomLineItemResponse' :: Maybe [ListResourcesAssociatedToCustomLineItemResponseElement]
associatedResources = Maybe [ListResourcesAssociatedToCustomLineItemResponseElement]
a} :: ListResourcesAssociatedToCustomLineItemResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The pagination token to be used in subsequent requests to retrieve
-- additional results.
listResourcesAssociatedToCustomLineItemResponse_nextToken :: Lens.Lens' ListResourcesAssociatedToCustomLineItemResponse (Prelude.Maybe Prelude.Text)
listResourcesAssociatedToCustomLineItemResponse_nextToken :: Lens' ListResourcesAssociatedToCustomLineItemResponse (Maybe Text)
listResourcesAssociatedToCustomLineItemResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesAssociatedToCustomLineItemResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListResourcesAssociatedToCustomLineItemResponse' :: ListResourcesAssociatedToCustomLineItemResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListResourcesAssociatedToCustomLineItemResponse
s@ListResourcesAssociatedToCustomLineItemResponse' {} Maybe Text
a -> ListResourcesAssociatedToCustomLineItemResponse
s {$sel:nextToken:ListResourcesAssociatedToCustomLineItemResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListResourcesAssociatedToCustomLineItemResponse)

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

instance
  Prelude.NFData
    ListResourcesAssociatedToCustomLineItemResponse
  where
  rnf :: ListResourcesAssociatedToCustomLineItemResponse -> ()
rnf
    ListResourcesAssociatedToCustomLineItemResponse' {Int
Maybe [ListResourcesAssociatedToCustomLineItemResponseElement]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
associatedResources :: Maybe [ListResourcesAssociatedToCustomLineItemResponseElement]
arn :: Maybe Text
$sel:httpStatus:ListResourcesAssociatedToCustomLineItemResponse' :: ListResourcesAssociatedToCustomLineItemResponse -> Int
$sel:nextToken:ListResourcesAssociatedToCustomLineItemResponse' :: ListResourcesAssociatedToCustomLineItemResponse -> Maybe Text
$sel:associatedResources:ListResourcesAssociatedToCustomLineItemResponse' :: ListResourcesAssociatedToCustomLineItemResponse
-> Maybe [ListResourcesAssociatedToCustomLineItemResponseElement]
$sel:arn:ListResourcesAssociatedToCustomLineItemResponse' :: ListResourcesAssociatedToCustomLineItemResponse -> Maybe Text
..} =
      forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
        seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ListResourcesAssociatedToCustomLineItemResponseElement]
associatedResources
        seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
        seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus