{-# 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 #-}
module Amazonka.BillingConductor.ListCustomLineItems
(
ListCustomLineItems (..),
newListCustomLineItems,
listCustomLineItems_billingPeriod,
listCustomLineItems_filters,
listCustomLineItems_maxResults,
listCustomLineItems_nextToken,
ListCustomLineItemsResponse (..),
newListCustomLineItemsResponse,
listCustomLineItemsResponse_customLineItems,
listCustomLineItemsResponse_nextToken,
listCustomLineItemsResponse_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
data ListCustomLineItems = ListCustomLineItems'
{
ListCustomLineItems -> Maybe Text
billingPeriod :: Prelude.Maybe Prelude.Text,
ListCustomLineItems -> Maybe ListCustomLineItemsFilter
filters :: Prelude.Maybe ListCustomLineItemsFilter,
ListCustomLineItems -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListCustomLineItems -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListCustomLineItems -> ListCustomLineItems -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCustomLineItems -> ListCustomLineItems -> Bool
$c/= :: ListCustomLineItems -> ListCustomLineItems -> Bool
== :: ListCustomLineItems -> ListCustomLineItems -> Bool
$c== :: ListCustomLineItems -> ListCustomLineItems -> Bool
Prelude.Eq, Int -> ListCustomLineItems -> ShowS
[ListCustomLineItems] -> ShowS
ListCustomLineItems -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCustomLineItems] -> ShowS
$cshowList :: [ListCustomLineItems] -> ShowS
show :: ListCustomLineItems -> String
$cshow :: ListCustomLineItems -> String
showsPrec :: Int -> ListCustomLineItems -> ShowS
$cshowsPrec :: Int -> ListCustomLineItems -> ShowS
Prelude.Show, forall x. Rep ListCustomLineItems x -> ListCustomLineItems
forall x. ListCustomLineItems -> Rep ListCustomLineItems x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListCustomLineItems x -> ListCustomLineItems
$cfrom :: forall x. ListCustomLineItems -> Rep ListCustomLineItems x
Prelude.Generic)
newListCustomLineItems ::
ListCustomLineItems
newListCustomLineItems :: ListCustomLineItems
newListCustomLineItems =
ListCustomLineItems'
{ $sel:billingPeriod:ListCustomLineItems' :: Maybe Text
billingPeriod =
forall a. Maybe a
Prelude.Nothing,
$sel:filters:ListCustomLineItems' :: Maybe ListCustomLineItemsFilter
filters = forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListCustomLineItems' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListCustomLineItems' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listCustomLineItems_billingPeriod :: Lens.Lens' ListCustomLineItems (Prelude.Maybe Prelude.Text)
listCustomLineItems_billingPeriod :: Lens' ListCustomLineItems (Maybe Text)
listCustomLineItems_billingPeriod = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCustomLineItems' {Maybe Text
billingPeriod :: Maybe Text
$sel:billingPeriod:ListCustomLineItems' :: ListCustomLineItems -> Maybe Text
billingPeriod} -> Maybe Text
billingPeriod) (\s :: ListCustomLineItems
s@ListCustomLineItems' {} Maybe Text
a -> ListCustomLineItems
s {$sel:billingPeriod:ListCustomLineItems' :: Maybe Text
billingPeriod = Maybe Text
a} :: ListCustomLineItems)
listCustomLineItems_filters :: Lens.Lens' ListCustomLineItems (Prelude.Maybe ListCustomLineItemsFilter)
listCustomLineItems_filters :: Lens' ListCustomLineItems (Maybe ListCustomLineItemsFilter)
listCustomLineItems_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCustomLineItems' {Maybe ListCustomLineItemsFilter
filters :: Maybe ListCustomLineItemsFilter
$sel:filters:ListCustomLineItems' :: ListCustomLineItems -> Maybe ListCustomLineItemsFilter
filters} -> Maybe ListCustomLineItemsFilter
filters) (\s :: ListCustomLineItems
s@ListCustomLineItems' {} Maybe ListCustomLineItemsFilter
a -> ListCustomLineItems
s {$sel:filters:ListCustomLineItems' :: Maybe ListCustomLineItemsFilter
filters = Maybe ListCustomLineItemsFilter
a} :: ListCustomLineItems)
listCustomLineItems_maxResults :: Lens.Lens' ListCustomLineItems (Prelude.Maybe Prelude.Natural)
listCustomLineItems_maxResults :: Lens' ListCustomLineItems (Maybe Natural)
listCustomLineItems_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCustomLineItems' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListCustomLineItems' :: ListCustomLineItems -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListCustomLineItems
s@ListCustomLineItems' {} Maybe Natural
a -> ListCustomLineItems
s {$sel:maxResults:ListCustomLineItems' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListCustomLineItems)
listCustomLineItems_nextToken :: Lens.Lens' ListCustomLineItems (Prelude.Maybe Prelude.Text)
listCustomLineItems_nextToken :: Lens' ListCustomLineItems (Maybe Text)
listCustomLineItems_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCustomLineItems' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListCustomLineItems' :: ListCustomLineItems -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListCustomLineItems
s@ListCustomLineItems' {} Maybe Text
a -> ListCustomLineItems
s {$sel:nextToken:ListCustomLineItems' :: Maybe Text
nextToken = Maybe Text
a} :: ListCustomLineItems)
instance Core.AWSPager ListCustomLineItems where
page :: ListCustomLineItems
-> AWSResponse ListCustomLineItems -> Maybe ListCustomLineItems
page ListCustomLineItems
rq AWSResponse ListCustomLineItems
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListCustomLineItems
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListCustomLineItemsResponse (Maybe Text)
listCustomLineItemsResponse_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 ListCustomLineItems
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
ListCustomLineItemsResponse (Maybe [CustomLineItemListElement])
listCustomLineItemsResponse_customLineItems
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.$ ListCustomLineItems
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListCustomLineItems (Maybe Text)
listCustomLineItems_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListCustomLineItems
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListCustomLineItemsResponse (Maybe Text)
listCustomLineItemsResponse_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 ListCustomLineItems where
type
AWSResponse ListCustomLineItems =
ListCustomLineItemsResponse
request :: (Service -> Service)
-> ListCustomLineItems -> Request ListCustomLineItems
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 ListCustomLineItems
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListCustomLineItems)))
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 [CustomLineItemListElement]
-> Maybe Text -> Int -> ListCustomLineItemsResponse
ListCustomLineItemsResponse'
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
"CustomLineItems"
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 ListCustomLineItems where
hashWithSalt :: Int -> ListCustomLineItems -> Int
hashWithSalt Int
_salt ListCustomLineItems' {Maybe Natural
Maybe Text
Maybe ListCustomLineItemsFilter
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe ListCustomLineItemsFilter
billingPeriod :: Maybe Text
$sel:nextToken:ListCustomLineItems' :: ListCustomLineItems -> Maybe Text
$sel:maxResults:ListCustomLineItems' :: ListCustomLineItems -> Maybe Natural
$sel:filters:ListCustomLineItems' :: ListCustomLineItems -> Maybe ListCustomLineItemsFilter
$sel:billingPeriod:ListCustomLineItems' :: ListCustomLineItems -> 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 ListCustomLineItemsFilter
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
instance Prelude.NFData ListCustomLineItems where
rnf :: ListCustomLineItems -> ()
rnf ListCustomLineItems' {Maybe Natural
Maybe Text
Maybe ListCustomLineItemsFilter
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe ListCustomLineItemsFilter
billingPeriod :: Maybe Text
$sel:nextToken:ListCustomLineItems' :: ListCustomLineItems -> Maybe Text
$sel:maxResults:ListCustomLineItems' :: ListCustomLineItems -> Maybe Natural
$sel:filters:ListCustomLineItems' :: ListCustomLineItems -> Maybe ListCustomLineItemsFilter
$sel:billingPeriod:ListCustomLineItems' :: ListCustomLineItems -> 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 ListCustomLineItemsFilter
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
instance Data.ToHeaders ListCustomLineItems where
toHeaders :: ListCustomLineItems -> 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 ListCustomLineItems where
toJSON :: ListCustomLineItems -> Value
toJSON ListCustomLineItems' {Maybe Natural
Maybe Text
Maybe ListCustomLineItemsFilter
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe ListCustomLineItemsFilter
billingPeriod :: Maybe Text
$sel:nextToken:ListCustomLineItems' :: ListCustomLineItems -> Maybe Text
$sel:maxResults:ListCustomLineItems' :: ListCustomLineItems -> Maybe Natural
$sel:filters:ListCustomLineItems' :: ListCustomLineItems -> Maybe ListCustomLineItemsFilter
$sel:billingPeriod:ListCustomLineItems' :: ListCustomLineItems -> 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 ListCustomLineItemsFilter
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
]
)
instance Data.ToPath ListCustomLineItems where
toPath :: ListCustomLineItems -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/list-custom-line-items"
instance Data.ToQuery ListCustomLineItems where
toQuery :: ListCustomLineItems -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListCustomLineItemsResponse = ListCustomLineItemsResponse'
{
ListCustomLineItemsResponse -> Maybe [CustomLineItemListElement]
customLineItems :: Prelude.Maybe [CustomLineItemListElement],
ListCustomLineItemsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListCustomLineItemsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListCustomLineItemsResponse -> ListCustomLineItemsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCustomLineItemsResponse -> ListCustomLineItemsResponse -> Bool
$c/= :: ListCustomLineItemsResponse -> ListCustomLineItemsResponse -> Bool
== :: ListCustomLineItemsResponse -> ListCustomLineItemsResponse -> Bool
$c== :: ListCustomLineItemsResponse -> ListCustomLineItemsResponse -> Bool
Prelude.Eq, Int -> ListCustomLineItemsResponse -> ShowS
[ListCustomLineItemsResponse] -> ShowS
ListCustomLineItemsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCustomLineItemsResponse] -> ShowS
$cshowList :: [ListCustomLineItemsResponse] -> ShowS
show :: ListCustomLineItemsResponse -> String
$cshow :: ListCustomLineItemsResponse -> String
showsPrec :: Int -> ListCustomLineItemsResponse -> ShowS
$cshowsPrec :: Int -> ListCustomLineItemsResponse -> ShowS
Prelude.Show, forall x.
Rep ListCustomLineItemsResponse x -> ListCustomLineItemsResponse
forall x.
ListCustomLineItemsResponse -> Rep ListCustomLineItemsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListCustomLineItemsResponse x -> ListCustomLineItemsResponse
$cfrom :: forall x.
ListCustomLineItemsResponse -> Rep ListCustomLineItemsResponse x
Prelude.Generic)
newListCustomLineItemsResponse ::
Prelude.Int ->
ListCustomLineItemsResponse
newListCustomLineItemsResponse :: Int -> ListCustomLineItemsResponse
newListCustomLineItemsResponse Int
pHttpStatus_ =
ListCustomLineItemsResponse'
{ $sel:customLineItems:ListCustomLineItemsResponse' :: Maybe [CustomLineItemListElement]
customLineItems =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListCustomLineItemsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListCustomLineItemsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listCustomLineItemsResponse_customLineItems :: Lens.Lens' ListCustomLineItemsResponse (Prelude.Maybe [CustomLineItemListElement])
listCustomLineItemsResponse_customLineItems :: Lens'
ListCustomLineItemsResponse (Maybe [CustomLineItemListElement])
listCustomLineItemsResponse_customLineItems = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCustomLineItemsResponse' {Maybe [CustomLineItemListElement]
customLineItems :: Maybe [CustomLineItemListElement]
$sel:customLineItems:ListCustomLineItemsResponse' :: ListCustomLineItemsResponse -> Maybe [CustomLineItemListElement]
customLineItems} -> Maybe [CustomLineItemListElement]
customLineItems) (\s :: ListCustomLineItemsResponse
s@ListCustomLineItemsResponse' {} Maybe [CustomLineItemListElement]
a -> ListCustomLineItemsResponse
s {$sel:customLineItems:ListCustomLineItemsResponse' :: Maybe [CustomLineItemListElement]
customLineItems = Maybe [CustomLineItemListElement]
a} :: ListCustomLineItemsResponse) 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
listCustomLineItemsResponse_nextToken :: Lens.Lens' ListCustomLineItemsResponse (Prelude.Maybe Prelude.Text)
listCustomLineItemsResponse_nextToken :: Lens' ListCustomLineItemsResponse (Maybe Text)
listCustomLineItemsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCustomLineItemsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListCustomLineItemsResponse' :: ListCustomLineItemsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListCustomLineItemsResponse
s@ListCustomLineItemsResponse' {} Maybe Text
a -> ListCustomLineItemsResponse
s {$sel:nextToken:ListCustomLineItemsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListCustomLineItemsResponse)
listCustomLineItemsResponse_httpStatus :: Lens.Lens' ListCustomLineItemsResponse Prelude.Int
listCustomLineItemsResponse_httpStatus :: Lens' ListCustomLineItemsResponse Int
listCustomLineItemsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCustomLineItemsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListCustomLineItemsResponse' :: ListCustomLineItemsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListCustomLineItemsResponse
s@ListCustomLineItemsResponse' {} Int
a -> ListCustomLineItemsResponse
s {$sel:httpStatus:ListCustomLineItemsResponse' :: Int
httpStatus = Int
a} :: ListCustomLineItemsResponse)
instance Prelude.NFData ListCustomLineItemsResponse where
rnf :: ListCustomLineItemsResponse -> ()
rnf ListCustomLineItemsResponse' {Int
Maybe [CustomLineItemListElement]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
customLineItems :: Maybe [CustomLineItemListElement]
$sel:httpStatus:ListCustomLineItemsResponse' :: ListCustomLineItemsResponse -> Int
$sel:nextToken:ListCustomLineItemsResponse' :: ListCustomLineItemsResponse -> Maybe Text
$sel:customLineItems:ListCustomLineItemsResponse' :: ListCustomLineItemsResponse -> Maybe [CustomLineItemListElement]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [CustomLineItemListElement]
customLineItems
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