{-# 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.ListPricingPlansAssociatedWithPricingRule
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- A list of the pricing plans that are associated with a pricing rule.
--
-- This operation returns paginated results.
module Amazonka.BillingConductor.ListPricingPlansAssociatedWithPricingRule
  ( -- * Creating a Request
    ListPricingPlansAssociatedWithPricingRule (..),
    newListPricingPlansAssociatedWithPricingRule,

    -- * Request Lenses
    listPricingPlansAssociatedWithPricingRule_billingPeriod,
    listPricingPlansAssociatedWithPricingRule_maxResults,
    listPricingPlansAssociatedWithPricingRule_nextToken,
    listPricingPlansAssociatedWithPricingRule_pricingRuleArn,

    -- * Destructuring the Response
    ListPricingPlansAssociatedWithPricingRuleResponse (..),
    newListPricingPlansAssociatedWithPricingRuleResponse,

    -- * Response Lenses
    listPricingPlansAssociatedWithPricingRuleResponse_billingPeriod,
    listPricingPlansAssociatedWithPricingRuleResponse_nextToken,
    listPricingPlansAssociatedWithPricingRuleResponse_pricingPlanArns,
    listPricingPlansAssociatedWithPricingRuleResponse_pricingRuleArn,
    listPricingPlansAssociatedWithPricingRuleResponse_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:/ 'newListPricingPlansAssociatedWithPricingRule' smart constructor.
data ListPricingPlansAssociatedWithPricingRule = ListPricingPlansAssociatedWithPricingRule'
  { -- | The pricing plan billing period for which associations will be listed.
    ListPricingPlansAssociatedWithPricingRule -> Maybe Text
billingPeriod :: Prelude.Maybe Prelude.Text,
    -- | The optional maximum number of pricing rule associations to retrieve.
    ListPricingPlansAssociatedWithPricingRule -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The optional pagination token returned by a previous call.
    ListPricingPlansAssociatedWithPricingRule -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The pricing rule Amazon Resource Name (ARN) for which associations will
    -- be listed.
    ListPricingPlansAssociatedWithPricingRule -> Text
pricingRuleArn :: Prelude.Text
  }
  deriving (ListPricingPlansAssociatedWithPricingRule
-> ListPricingPlansAssociatedWithPricingRule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPricingPlansAssociatedWithPricingRule
-> ListPricingPlansAssociatedWithPricingRule -> Bool
$c/= :: ListPricingPlansAssociatedWithPricingRule
-> ListPricingPlansAssociatedWithPricingRule -> Bool
== :: ListPricingPlansAssociatedWithPricingRule
-> ListPricingPlansAssociatedWithPricingRule -> Bool
$c== :: ListPricingPlansAssociatedWithPricingRule
-> ListPricingPlansAssociatedWithPricingRule -> Bool
Prelude.Eq, ReadPrec [ListPricingPlansAssociatedWithPricingRule]
ReadPrec ListPricingPlansAssociatedWithPricingRule
Int -> ReadS ListPricingPlansAssociatedWithPricingRule
ReadS [ListPricingPlansAssociatedWithPricingRule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPricingPlansAssociatedWithPricingRule]
$creadListPrec :: ReadPrec [ListPricingPlansAssociatedWithPricingRule]
readPrec :: ReadPrec ListPricingPlansAssociatedWithPricingRule
$creadPrec :: ReadPrec ListPricingPlansAssociatedWithPricingRule
readList :: ReadS [ListPricingPlansAssociatedWithPricingRule]
$creadList :: ReadS [ListPricingPlansAssociatedWithPricingRule]
readsPrec :: Int -> ReadS ListPricingPlansAssociatedWithPricingRule
$creadsPrec :: Int -> ReadS ListPricingPlansAssociatedWithPricingRule
Prelude.Read, Int -> ListPricingPlansAssociatedWithPricingRule -> ShowS
[ListPricingPlansAssociatedWithPricingRule] -> ShowS
ListPricingPlansAssociatedWithPricingRule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPricingPlansAssociatedWithPricingRule] -> ShowS
$cshowList :: [ListPricingPlansAssociatedWithPricingRule] -> ShowS
show :: ListPricingPlansAssociatedWithPricingRule -> String
$cshow :: ListPricingPlansAssociatedWithPricingRule -> String
showsPrec :: Int -> ListPricingPlansAssociatedWithPricingRule -> ShowS
$cshowsPrec :: Int -> ListPricingPlansAssociatedWithPricingRule -> ShowS
Prelude.Show, forall x.
Rep ListPricingPlansAssociatedWithPricingRule x
-> ListPricingPlansAssociatedWithPricingRule
forall x.
ListPricingPlansAssociatedWithPricingRule
-> Rep ListPricingPlansAssociatedWithPricingRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListPricingPlansAssociatedWithPricingRule x
-> ListPricingPlansAssociatedWithPricingRule
$cfrom :: forall x.
ListPricingPlansAssociatedWithPricingRule
-> Rep ListPricingPlansAssociatedWithPricingRule x
Prelude.Generic)

-- |
-- Create a value of 'ListPricingPlansAssociatedWithPricingRule' 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', 'listPricingPlansAssociatedWithPricingRule_billingPeriod' - The pricing plan billing period for which associations will be listed.
--
-- 'maxResults', 'listPricingPlansAssociatedWithPricingRule_maxResults' - The optional maximum number of pricing rule associations to retrieve.
--
-- 'nextToken', 'listPricingPlansAssociatedWithPricingRule_nextToken' - The optional pagination token returned by a previous call.
--
-- 'pricingRuleArn', 'listPricingPlansAssociatedWithPricingRule_pricingRuleArn' - The pricing rule Amazon Resource Name (ARN) for which associations will
-- be listed.
newListPricingPlansAssociatedWithPricingRule ::
  -- | 'pricingRuleArn'
  Prelude.Text ->
  ListPricingPlansAssociatedWithPricingRule
newListPricingPlansAssociatedWithPricingRule :: Text -> ListPricingPlansAssociatedWithPricingRule
newListPricingPlansAssociatedWithPricingRule
  Text
pPricingRuleArn_ =
    ListPricingPlansAssociatedWithPricingRule'
      { $sel:billingPeriod:ListPricingPlansAssociatedWithPricingRule' :: Maybe Text
billingPeriod =
          forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListPricingPlansAssociatedWithPricingRule' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:ListPricingPlansAssociatedWithPricingRule' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
        $sel:pricingRuleArn:ListPricingPlansAssociatedWithPricingRule' :: Text
pricingRuleArn =
          Text
pPricingRuleArn_
      }

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

-- | The optional maximum number of pricing rule associations to retrieve.
listPricingPlansAssociatedWithPricingRule_maxResults :: Lens.Lens' ListPricingPlansAssociatedWithPricingRule (Prelude.Maybe Prelude.Natural)
listPricingPlansAssociatedWithPricingRule_maxResults :: Lens' ListPricingPlansAssociatedWithPricingRule (Maybe Natural)
listPricingPlansAssociatedWithPricingRule_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPricingPlansAssociatedWithPricingRule' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListPricingPlansAssociatedWithPricingRule' :: ListPricingPlansAssociatedWithPricingRule -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListPricingPlansAssociatedWithPricingRule
s@ListPricingPlansAssociatedWithPricingRule' {} Maybe Natural
a -> ListPricingPlansAssociatedWithPricingRule
s {$sel:maxResults:ListPricingPlansAssociatedWithPricingRule' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListPricingPlansAssociatedWithPricingRule)

-- | The optional pagination token returned by a previous call.
listPricingPlansAssociatedWithPricingRule_nextToken :: Lens.Lens' ListPricingPlansAssociatedWithPricingRule (Prelude.Maybe Prelude.Text)
listPricingPlansAssociatedWithPricingRule_nextToken :: Lens' ListPricingPlansAssociatedWithPricingRule (Maybe Text)
listPricingPlansAssociatedWithPricingRule_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPricingPlansAssociatedWithPricingRule' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPricingPlansAssociatedWithPricingRule' :: ListPricingPlansAssociatedWithPricingRule -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPricingPlansAssociatedWithPricingRule
s@ListPricingPlansAssociatedWithPricingRule' {} Maybe Text
a -> ListPricingPlansAssociatedWithPricingRule
s {$sel:nextToken:ListPricingPlansAssociatedWithPricingRule' :: Maybe Text
nextToken = Maybe Text
a} :: ListPricingPlansAssociatedWithPricingRule)

-- | The pricing rule Amazon Resource Name (ARN) for which associations will
-- be listed.
listPricingPlansAssociatedWithPricingRule_pricingRuleArn :: Lens.Lens' ListPricingPlansAssociatedWithPricingRule Prelude.Text
listPricingPlansAssociatedWithPricingRule_pricingRuleArn :: Lens' ListPricingPlansAssociatedWithPricingRule Text
listPricingPlansAssociatedWithPricingRule_pricingRuleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPricingPlansAssociatedWithPricingRule' {Text
pricingRuleArn :: Text
$sel:pricingRuleArn:ListPricingPlansAssociatedWithPricingRule' :: ListPricingPlansAssociatedWithPricingRule -> Text
pricingRuleArn} -> Text
pricingRuleArn) (\s :: ListPricingPlansAssociatedWithPricingRule
s@ListPricingPlansAssociatedWithPricingRule' {} Text
a -> ListPricingPlansAssociatedWithPricingRule
s {$sel:pricingRuleArn:ListPricingPlansAssociatedWithPricingRule' :: Text
pricingRuleArn = Text
a} :: ListPricingPlansAssociatedWithPricingRule)

instance
  Core.AWSPager
    ListPricingPlansAssociatedWithPricingRule
  where
  page :: ListPricingPlansAssociatedWithPricingRule
-> AWSResponse ListPricingPlansAssociatedWithPricingRule
-> Maybe ListPricingPlansAssociatedWithPricingRule
page ListPricingPlansAssociatedWithPricingRule
rq AWSResponse ListPricingPlansAssociatedWithPricingRule
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListPricingPlansAssociatedWithPricingRule
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
  ListPricingPlansAssociatedWithPricingRuleResponse (Maybe Text)
listPricingPlansAssociatedWithPricingRuleResponse_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 ListPricingPlansAssociatedWithPricingRule
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
  ListPricingPlansAssociatedWithPricingRuleResponse
  (Maybe (NonEmpty Text))
listPricingPlansAssociatedWithPricingRuleResponse_pricingPlanArns
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to forall l. IsList l => l -> [Item l]
Prelude.toList
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListPricingPlansAssociatedWithPricingRule
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListPricingPlansAssociatedWithPricingRule (Maybe Text)
listPricingPlansAssociatedWithPricingRule_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListPricingPlansAssociatedWithPricingRule
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
  ListPricingPlansAssociatedWithPricingRuleResponse (Maybe Text)
listPricingPlansAssociatedWithPricingRuleResponse_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
    ListPricingPlansAssociatedWithPricingRule
  where
  type
    AWSResponse
      ListPricingPlansAssociatedWithPricingRule =
      ListPricingPlansAssociatedWithPricingRuleResponse
  request :: (Service -> Service)
-> ListPricingPlansAssociatedWithPricingRule
-> Request ListPricingPlansAssociatedWithPricingRule
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 ListPricingPlansAssociatedWithPricingRule
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse ListPricingPlansAssociatedWithPricingRule)))
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 Text
-> Maybe (NonEmpty Text)
-> Maybe Text
-> Int
-> ListPricingPlansAssociatedWithPricingRuleResponse
ListPricingPlansAssociatedWithPricingRuleResponse'
            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
"BillingPeriod")
            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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"PricingPlanArns")
            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
"PricingRuleArn")
            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
    ListPricingPlansAssociatedWithPricingRule
  where
  hashWithSalt :: Int -> ListPricingPlansAssociatedWithPricingRule -> Int
hashWithSalt
    Int
_salt
    ListPricingPlansAssociatedWithPricingRule' {Maybe Natural
Maybe Text
Text
pricingRuleArn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
billingPeriod :: Maybe Text
$sel:pricingRuleArn:ListPricingPlansAssociatedWithPricingRule' :: ListPricingPlansAssociatedWithPricingRule -> Text
$sel:nextToken:ListPricingPlansAssociatedWithPricingRule' :: ListPricingPlansAssociatedWithPricingRule -> Maybe Text
$sel:maxResults:ListPricingPlansAssociatedWithPricingRule' :: ListPricingPlansAssociatedWithPricingRule -> Maybe Natural
$sel:billingPeriod:ListPricingPlansAssociatedWithPricingRule' :: ListPricingPlansAssociatedWithPricingRule -> 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 Natural
maxResults
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
pricingRuleArn

instance
  Prelude.NFData
    ListPricingPlansAssociatedWithPricingRule
  where
  rnf :: ListPricingPlansAssociatedWithPricingRule -> ()
rnf ListPricingPlansAssociatedWithPricingRule' {Maybe Natural
Maybe Text
Text
pricingRuleArn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
billingPeriod :: Maybe Text
$sel:pricingRuleArn:ListPricingPlansAssociatedWithPricingRule' :: ListPricingPlansAssociatedWithPricingRule -> Text
$sel:nextToken:ListPricingPlansAssociatedWithPricingRule' :: ListPricingPlansAssociatedWithPricingRule -> Maybe Text
$sel:maxResults:ListPricingPlansAssociatedWithPricingRule' :: ListPricingPlansAssociatedWithPricingRule -> Maybe Natural
$sel:billingPeriod:ListPricingPlansAssociatedWithPricingRule' :: ListPricingPlansAssociatedWithPricingRule -> 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 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
pricingRuleArn

instance
  Data.ToHeaders
    ListPricingPlansAssociatedWithPricingRule
  where
  toHeaders :: ListPricingPlansAssociatedWithPricingRule -> 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
    ListPricingPlansAssociatedWithPricingRule
  where
  toJSON :: ListPricingPlansAssociatedWithPricingRule -> Value
toJSON ListPricingPlansAssociatedWithPricingRule' {Maybe Natural
Maybe Text
Text
pricingRuleArn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
billingPeriod :: Maybe Text
$sel:pricingRuleArn:ListPricingPlansAssociatedWithPricingRule' :: ListPricingPlansAssociatedWithPricingRule -> Text
$sel:nextToken:ListPricingPlansAssociatedWithPricingRule' :: ListPricingPlansAssociatedWithPricingRule -> Maybe Text
$sel:maxResults:ListPricingPlansAssociatedWithPricingRule' :: ListPricingPlansAssociatedWithPricingRule -> Maybe Natural
$sel:billingPeriod:ListPricingPlansAssociatedWithPricingRule' :: ListPricingPlansAssociatedWithPricingRule -> 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
"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
"PricingRuleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
pricingRuleArn)
          ]
      )

instance
  Data.ToPath
    ListPricingPlansAssociatedWithPricingRule
  where
  toPath :: ListPricingPlansAssociatedWithPricingRule -> ByteString
toPath =
    forall a b. a -> b -> a
Prelude.const
      ByteString
"/list-pricing-plans-associated-with-pricing-rule"

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

-- | /See:/ 'newListPricingPlansAssociatedWithPricingRuleResponse' smart constructor.
data ListPricingPlansAssociatedWithPricingRuleResponse = ListPricingPlansAssociatedWithPricingRuleResponse'
  { -- | The pricing plan billing period for which associations will be listed.
    ListPricingPlansAssociatedWithPricingRuleResponse -> Maybe Text
billingPeriod :: Prelude.Maybe Prelude.Text,
    -- | The pagination token to be used on subsequent calls.
    ListPricingPlansAssociatedWithPricingRuleResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The list containing pricing plans that are associated with the requested
    -- pricing rule.
    ListPricingPlansAssociatedWithPricingRuleResponse
-> Maybe (NonEmpty Text)
pricingPlanArns :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The pricing rule Amazon Resource Name (ARN) for which associations will
    -- be listed.
    ListPricingPlansAssociatedWithPricingRuleResponse -> Maybe Text
pricingRuleArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListPricingPlansAssociatedWithPricingRuleResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListPricingPlansAssociatedWithPricingRuleResponse
-> ListPricingPlansAssociatedWithPricingRuleResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPricingPlansAssociatedWithPricingRuleResponse
-> ListPricingPlansAssociatedWithPricingRuleResponse -> Bool
$c/= :: ListPricingPlansAssociatedWithPricingRuleResponse
-> ListPricingPlansAssociatedWithPricingRuleResponse -> Bool
== :: ListPricingPlansAssociatedWithPricingRuleResponse
-> ListPricingPlansAssociatedWithPricingRuleResponse -> Bool
$c== :: ListPricingPlansAssociatedWithPricingRuleResponse
-> ListPricingPlansAssociatedWithPricingRuleResponse -> Bool
Prelude.Eq, ReadPrec [ListPricingPlansAssociatedWithPricingRuleResponse]
ReadPrec ListPricingPlansAssociatedWithPricingRuleResponse
Int -> ReadS ListPricingPlansAssociatedWithPricingRuleResponse
ReadS [ListPricingPlansAssociatedWithPricingRuleResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPricingPlansAssociatedWithPricingRuleResponse]
$creadListPrec :: ReadPrec [ListPricingPlansAssociatedWithPricingRuleResponse]
readPrec :: ReadPrec ListPricingPlansAssociatedWithPricingRuleResponse
$creadPrec :: ReadPrec ListPricingPlansAssociatedWithPricingRuleResponse
readList :: ReadS [ListPricingPlansAssociatedWithPricingRuleResponse]
$creadList :: ReadS [ListPricingPlansAssociatedWithPricingRuleResponse]
readsPrec :: Int -> ReadS ListPricingPlansAssociatedWithPricingRuleResponse
$creadsPrec :: Int -> ReadS ListPricingPlansAssociatedWithPricingRuleResponse
Prelude.Read, Int -> ListPricingPlansAssociatedWithPricingRuleResponse -> ShowS
[ListPricingPlansAssociatedWithPricingRuleResponse] -> ShowS
ListPricingPlansAssociatedWithPricingRuleResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPricingPlansAssociatedWithPricingRuleResponse] -> ShowS
$cshowList :: [ListPricingPlansAssociatedWithPricingRuleResponse] -> ShowS
show :: ListPricingPlansAssociatedWithPricingRuleResponse -> String
$cshow :: ListPricingPlansAssociatedWithPricingRuleResponse -> String
showsPrec :: Int -> ListPricingPlansAssociatedWithPricingRuleResponse -> ShowS
$cshowsPrec :: Int -> ListPricingPlansAssociatedWithPricingRuleResponse -> ShowS
Prelude.Show, forall x.
Rep ListPricingPlansAssociatedWithPricingRuleResponse x
-> ListPricingPlansAssociatedWithPricingRuleResponse
forall x.
ListPricingPlansAssociatedWithPricingRuleResponse
-> Rep ListPricingPlansAssociatedWithPricingRuleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListPricingPlansAssociatedWithPricingRuleResponse x
-> ListPricingPlansAssociatedWithPricingRuleResponse
$cfrom :: forall x.
ListPricingPlansAssociatedWithPricingRuleResponse
-> Rep ListPricingPlansAssociatedWithPricingRuleResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListPricingPlansAssociatedWithPricingRuleResponse' 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', 'listPricingPlansAssociatedWithPricingRuleResponse_billingPeriod' - The pricing plan billing period for which associations will be listed.
--
-- 'nextToken', 'listPricingPlansAssociatedWithPricingRuleResponse_nextToken' - The pagination token to be used on subsequent calls.
--
-- 'pricingPlanArns', 'listPricingPlansAssociatedWithPricingRuleResponse_pricingPlanArns' - The list containing pricing plans that are associated with the requested
-- pricing rule.
--
-- 'pricingRuleArn', 'listPricingPlansAssociatedWithPricingRuleResponse_pricingRuleArn' - The pricing rule Amazon Resource Name (ARN) for which associations will
-- be listed.
--
-- 'httpStatus', 'listPricingPlansAssociatedWithPricingRuleResponse_httpStatus' - The response's http status code.
newListPricingPlansAssociatedWithPricingRuleResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListPricingPlansAssociatedWithPricingRuleResponse
newListPricingPlansAssociatedWithPricingRuleResponse :: Int -> ListPricingPlansAssociatedWithPricingRuleResponse
newListPricingPlansAssociatedWithPricingRuleResponse
  Int
pHttpStatus_ =
    ListPricingPlansAssociatedWithPricingRuleResponse'
      { $sel:billingPeriod:ListPricingPlansAssociatedWithPricingRuleResponse' :: Maybe Text
billingPeriod =
          forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:ListPricingPlansAssociatedWithPricingRuleResponse' :: Maybe Text
nextToken =
          forall a. Maybe a
Prelude.Nothing,
        $sel:pricingPlanArns:ListPricingPlansAssociatedWithPricingRuleResponse' :: Maybe (NonEmpty Text)
pricingPlanArns =
          forall a. Maybe a
Prelude.Nothing,
        $sel:pricingRuleArn:ListPricingPlansAssociatedWithPricingRuleResponse' :: Maybe Text
pricingRuleArn =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListPricingPlansAssociatedWithPricingRuleResponse' :: Int
httpStatus =
          Int
pHttpStatus_
      }

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

-- | The pagination token to be used on subsequent calls.
listPricingPlansAssociatedWithPricingRuleResponse_nextToken :: Lens.Lens' ListPricingPlansAssociatedWithPricingRuleResponse (Prelude.Maybe Prelude.Text)
listPricingPlansAssociatedWithPricingRuleResponse_nextToken :: Lens'
  ListPricingPlansAssociatedWithPricingRuleResponse (Maybe Text)
listPricingPlansAssociatedWithPricingRuleResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPricingPlansAssociatedWithPricingRuleResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPricingPlansAssociatedWithPricingRuleResponse' :: ListPricingPlansAssociatedWithPricingRuleResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPricingPlansAssociatedWithPricingRuleResponse
s@ListPricingPlansAssociatedWithPricingRuleResponse' {} Maybe Text
a -> ListPricingPlansAssociatedWithPricingRuleResponse
s {$sel:nextToken:ListPricingPlansAssociatedWithPricingRuleResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListPricingPlansAssociatedWithPricingRuleResponse)

-- | The list containing pricing plans that are associated with the requested
-- pricing rule.
listPricingPlansAssociatedWithPricingRuleResponse_pricingPlanArns :: Lens.Lens' ListPricingPlansAssociatedWithPricingRuleResponse (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
listPricingPlansAssociatedWithPricingRuleResponse_pricingPlanArns :: Lens'
  ListPricingPlansAssociatedWithPricingRuleResponse
  (Maybe (NonEmpty Text))
listPricingPlansAssociatedWithPricingRuleResponse_pricingPlanArns = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPricingPlansAssociatedWithPricingRuleResponse' {Maybe (NonEmpty Text)
pricingPlanArns :: Maybe (NonEmpty Text)
$sel:pricingPlanArns:ListPricingPlansAssociatedWithPricingRuleResponse' :: ListPricingPlansAssociatedWithPricingRuleResponse
-> Maybe (NonEmpty Text)
pricingPlanArns} -> Maybe (NonEmpty Text)
pricingPlanArns) (\s :: ListPricingPlansAssociatedWithPricingRuleResponse
s@ListPricingPlansAssociatedWithPricingRuleResponse' {} Maybe (NonEmpty Text)
a -> ListPricingPlansAssociatedWithPricingRuleResponse
s {$sel:pricingPlanArns:ListPricingPlansAssociatedWithPricingRuleResponse' :: Maybe (NonEmpty Text)
pricingPlanArns = Maybe (NonEmpty Text)
a} :: ListPricingPlansAssociatedWithPricingRuleResponse) 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 pricing rule Amazon Resource Name (ARN) for which associations will
-- be listed.
listPricingPlansAssociatedWithPricingRuleResponse_pricingRuleArn :: Lens.Lens' ListPricingPlansAssociatedWithPricingRuleResponse (Prelude.Maybe Prelude.Text)
listPricingPlansAssociatedWithPricingRuleResponse_pricingRuleArn :: Lens'
  ListPricingPlansAssociatedWithPricingRuleResponse (Maybe Text)
listPricingPlansAssociatedWithPricingRuleResponse_pricingRuleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPricingPlansAssociatedWithPricingRuleResponse' {Maybe Text
pricingRuleArn :: Maybe Text
$sel:pricingRuleArn:ListPricingPlansAssociatedWithPricingRuleResponse' :: ListPricingPlansAssociatedWithPricingRuleResponse -> Maybe Text
pricingRuleArn} -> Maybe Text
pricingRuleArn) (\s :: ListPricingPlansAssociatedWithPricingRuleResponse
s@ListPricingPlansAssociatedWithPricingRuleResponse' {} Maybe Text
a -> ListPricingPlansAssociatedWithPricingRuleResponse
s {$sel:pricingRuleArn:ListPricingPlansAssociatedWithPricingRuleResponse' :: Maybe Text
pricingRuleArn = Maybe Text
a} :: ListPricingPlansAssociatedWithPricingRuleResponse)

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

instance
  Prelude.NFData
    ListPricingPlansAssociatedWithPricingRuleResponse
  where
  rnf :: ListPricingPlansAssociatedWithPricingRuleResponse -> ()
rnf
    ListPricingPlansAssociatedWithPricingRuleResponse' {Int
Maybe (NonEmpty Text)
Maybe Text
httpStatus :: Int
pricingRuleArn :: Maybe Text
pricingPlanArns :: Maybe (NonEmpty Text)
nextToken :: Maybe Text
billingPeriod :: Maybe Text
$sel:httpStatus:ListPricingPlansAssociatedWithPricingRuleResponse' :: ListPricingPlansAssociatedWithPricingRuleResponse -> Int
$sel:pricingRuleArn:ListPricingPlansAssociatedWithPricingRuleResponse' :: ListPricingPlansAssociatedWithPricingRuleResponse -> Maybe Text
$sel:pricingPlanArns:ListPricingPlansAssociatedWithPricingRuleResponse' :: ListPricingPlansAssociatedWithPricingRuleResponse
-> Maybe (NonEmpty Text)
$sel:nextToken:ListPricingPlansAssociatedWithPricingRuleResponse' :: ListPricingPlansAssociatedWithPricingRuleResponse -> Maybe Text
$sel:billingPeriod:ListPricingPlansAssociatedWithPricingRuleResponse' :: ListPricingPlansAssociatedWithPricingRuleResponse -> 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 Text
nextToken
        seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
pricingPlanArns
        seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
pricingRuleArn
        seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus