{-# 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.ListBillingGroups
(
ListBillingGroups (..),
newListBillingGroups,
listBillingGroups_billingPeriod,
listBillingGroups_filters,
listBillingGroups_maxResults,
listBillingGroups_nextToken,
ListBillingGroupsResponse (..),
newListBillingGroupsResponse,
listBillingGroupsResponse_billingGroups,
listBillingGroupsResponse_nextToken,
listBillingGroupsResponse_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 ListBillingGroups = ListBillingGroups'
{
ListBillingGroups -> Maybe Text
billingPeriod :: Prelude.Maybe Prelude.Text,
ListBillingGroups -> Maybe ListBillingGroupsFilter
filters :: Prelude.Maybe ListBillingGroupsFilter,
ListBillingGroups -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListBillingGroups -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListBillingGroups -> ListBillingGroups -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListBillingGroups -> ListBillingGroups -> Bool
$c/= :: ListBillingGroups -> ListBillingGroups -> Bool
== :: ListBillingGroups -> ListBillingGroups -> Bool
$c== :: ListBillingGroups -> ListBillingGroups -> Bool
Prelude.Eq, ReadPrec [ListBillingGroups]
ReadPrec ListBillingGroups
Int -> ReadS ListBillingGroups
ReadS [ListBillingGroups]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListBillingGroups]
$creadListPrec :: ReadPrec [ListBillingGroups]
readPrec :: ReadPrec ListBillingGroups
$creadPrec :: ReadPrec ListBillingGroups
readList :: ReadS [ListBillingGroups]
$creadList :: ReadS [ListBillingGroups]
readsPrec :: Int -> ReadS ListBillingGroups
$creadsPrec :: Int -> ReadS ListBillingGroups
Prelude.Read, Int -> ListBillingGroups -> ShowS
[ListBillingGroups] -> ShowS
ListBillingGroups -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListBillingGroups] -> ShowS
$cshowList :: [ListBillingGroups] -> ShowS
show :: ListBillingGroups -> String
$cshow :: ListBillingGroups -> String
showsPrec :: Int -> ListBillingGroups -> ShowS
$cshowsPrec :: Int -> ListBillingGroups -> ShowS
Prelude.Show, forall x. Rep ListBillingGroups x -> ListBillingGroups
forall x. ListBillingGroups -> Rep ListBillingGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListBillingGroups x -> ListBillingGroups
$cfrom :: forall x. ListBillingGroups -> Rep ListBillingGroups x
Prelude.Generic)
newListBillingGroups ::
ListBillingGroups
newListBillingGroups :: ListBillingGroups
newListBillingGroups =
ListBillingGroups'
{ $sel:billingPeriod:ListBillingGroups' :: Maybe Text
billingPeriod = forall a. Maybe a
Prelude.Nothing,
$sel:filters:ListBillingGroups' :: Maybe ListBillingGroupsFilter
filters = forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListBillingGroups' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListBillingGroups' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listBillingGroups_billingPeriod :: Lens.Lens' ListBillingGroups (Prelude.Maybe Prelude.Text)
listBillingGroups_billingPeriod :: Lens' ListBillingGroups (Maybe Text)
listBillingGroups_billingPeriod = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBillingGroups' {Maybe Text
billingPeriod :: Maybe Text
$sel:billingPeriod:ListBillingGroups' :: ListBillingGroups -> Maybe Text
billingPeriod} -> Maybe Text
billingPeriod) (\s :: ListBillingGroups
s@ListBillingGroups' {} Maybe Text
a -> ListBillingGroups
s {$sel:billingPeriod:ListBillingGroups' :: Maybe Text
billingPeriod = Maybe Text
a} :: ListBillingGroups)
listBillingGroups_filters :: Lens.Lens' ListBillingGroups (Prelude.Maybe ListBillingGroupsFilter)
listBillingGroups_filters :: Lens' ListBillingGroups (Maybe ListBillingGroupsFilter)
listBillingGroups_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBillingGroups' {Maybe ListBillingGroupsFilter
filters :: Maybe ListBillingGroupsFilter
$sel:filters:ListBillingGroups' :: ListBillingGroups -> Maybe ListBillingGroupsFilter
filters} -> Maybe ListBillingGroupsFilter
filters) (\s :: ListBillingGroups
s@ListBillingGroups' {} Maybe ListBillingGroupsFilter
a -> ListBillingGroups
s {$sel:filters:ListBillingGroups' :: Maybe ListBillingGroupsFilter
filters = Maybe ListBillingGroupsFilter
a} :: ListBillingGroups)
listBillingGroups_maxResults :: Lens.Lens' ListBillingGroups (Prelude.Maybe Prelude.Natural)
listBillingGroups_maxResults :: Lens' ListBillingGroups (Maybe Natural)
listBillingGroups_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBillingGroups' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListBillingGroups' :: ListBillingGroups -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListBillingGroups
s@ListBillingGroups' {} Maybe Natural
a -> ListBillingGroups
s {$sel:maxResults:ListBillingGroups' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListBillingGroups)
listBillingGroups_nextToken :: Lens.Lens' ListBillingGroups (Prelude.Maybe Prelude.Text)
listBillingGroups_nextToken :: Lens' ListBillingGroups (Maybe Text)
listBillingGroups_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBillingGroups' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListBillingGroups' :: ListBillingGroups -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListBillingGroups
s@ListBillingGroups' {} Maybe Text
a -> ListBillingGroups
s {$sel:nextToken:ListBillingGroups' :: Maybe Text
nextToken = Maybe Text
a} :: ListBillingGroups)
instance Core.AWSPager ListBillingGroups where
page :: ListBillingGroups
-> AWSResponse ListBillingGroups -> Maybe ListBillingGroups
page ListBillingGroups
rq AWSResponse ListBillingGroups
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListBillingGroups
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListBillingGroupsResponse (Maybe Text)
listBillingGroupsResponse_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 ListBillingGroups
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListBillingGroupsResponse (Maybe [BillingGroupListElement])
listBillingGroupsResponse_billingGroups
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.$ ListBillingGroups
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListBillingGroups (Maybe Text)
listBillingGroups_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListBillingGroups
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListBillingGroupsResponse (Maybe Text)
listBillingGroupsResponse_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 ListBillingGroups where
type
AWSResponse ListBillingGroups =
ListBillingGroupsResponse
request :: (Service -> Service)
-> ListBillingGroups -> Request ListBillingGroups
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 ListBillingGroups
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListBillingGroups)))
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 [BillingGroupListElement]
-> Maybe Text -> Int -> ListBillingGroupsResponse
ListBillingGroupsResponse'
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
"BillingGroups" 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 ListBillingGroups where
hashWithSalt :: Int -> ListBillingGroups -> Int
hashWithSalt Int
_salt ListBillingGroups' {Maybe Natural
Maybe Text
Maybe ListBillingGroupsFilter
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe ListBillingGroupsFilter
billingPeriod :: Maybe Text
$sel:nextToken:ListBillingGroups' :: ListBillingGroups -> Maybe Text
$sel:maxResults:ListBillingGroups' :: ListBillingGroups -> Maybe Natural
$sel:filters:ListBillingGroups' :: ListBillingGroups -> Maybe ListBillingGroupsFilter
$sel:billingPeriod:ListBillingGroups' :: ListBillingGroups -> 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 ListBillingGroupsFilter
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 ListBillingGroups where
rnf :: ListBillingGroups -> ()
rnf ListBillingGroups' {Maybe Natural
Maybe Text
Maybe ListBillingGroupsFilter
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe ListBillingGroupsFilter
billingPeriod :: Maybe Text
$sel:nextToken:ListBillingGroups' :: ListBillingGroups -> Maybe Text
$sel:maxResults:ListBillingGroups' :: ListBillingGroups -> Maybe Natural
$sel:filters:ListBillingGroups' :: ListBillingGroups -> Maybe ListBillingGroupsFilter
$sel:billingPeriod:ListBillingGroups' :: ListBillingGroups -> 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 ListBillingGroupsFilter
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 ListBillingGroups where
toHeaders :: ListBillingGroups -> 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 ListBillingGroups where
toJSON :: ListBillingGroups -> Value
toJSON ListBillingGroups' {Maybe Natural
Maybe Text
Maybe ListBillingGroupsFilter
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe ListBillingGroupsFilter
billingPeriod :: Maybe Text
$sel:nextToken:ListBillingGroups' :: ListBillingGroups -> Maybe Text
$sel:maxResults:ListBillingGroups' :: ListBillingGroups -> Maybe Natural
$sel:filters:ListBillingGroups' :: ListBillingGroups -> Maybe ListBillingGroupsFilter
$sel:billingPeriod:ListBillingGroups' :: ListBillingGroups -> 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 ListBillingGroupsFilter
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 ListBillingGroups where
toPath :: ListBillingGroups -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/list-billing-groups"
instance Data.ToQuery ListBillingGroups where
toQuery :: ListBillingGroups -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListBillingGroupsResponse = ListBillingGroupsResponse'
{
ListBillingGroupsResponse -> Maybe [BillingGroupListElement]
billingGroups :: Prelude.Maybe [BillingGroupListElement],
ListBillingGroupsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListBillingGroupsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListBillingGroupsResponse -> ListBillingGroupsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListBillingGroupsResponse -> ListBillingGroupsResponse -> Bool
$c/= :: ListBillingGroupsResponse -> ListBillingGroupsResponse -> Bool
== :: ListBillingGroupsResponse -> ListBillingGroupsResponse -> Bool
$c== :: ListBillingGroupsResponse -> ListBillingGroupsResponse -> Bool
Prelude.Eq, Int -> ListBillingGroupsResponse -> ShowS
[ListBillingGroupsResponse] -> ShowS
ListBillingGroupsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListBillingGroupsResponse] -> ShowS
$cshowList :: [ListBillingGroupsResponse] -> ShowS
show :: ListBillingGroupsResponse -> String
$cshow :: ListBillingGroupsResponse -> String
showsPrec :: Int -> ListBillingGroupsResponse -> ShowS
$cshowsPrec :: Int -> ListBillingGroupsResponse -> ShowS
Prelude.Show, forall x.
Rep ListBillingGroupsResponse x -> ListBillingGroupsResponse
forall x.
ListBillingGroupsResponse -> Rep ListBillingGroupsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListBillingGroupsResponse x -> ListBillingGroupsResponse
$cfrom :: forall x.
ListBillingGroupsResponse -> Rep ListBillingGroupsResponse x
Prelude.Generic)
newListBillingGroupsResponse ::
Prelude.Int ->
ListBillingGroupsResponse
newListBillingGroupsResponse :: Int -> ListBillingGroupsResponse
newListBillingGroupsResponse Int
pHttpStatus_ =
ListBillingGroupsResponse'
{ $sel:billingGroups:ListBillingGroupsResponse' :: Maybe [BillingGroupListElement]
billingGroups =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListBillingGroupsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListBillingGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listBillingGroupsResponse_billingGroups :: Lens.Lens' ListBillingGroupsResponse (Prelude.Maybe [BillingGroupListElement])
listBillingGroupsResponse_billingGroups :: Lens' ListBillingGroupsResponse (Maybe [BillingGroupListElement])
listBillingGroupsResponse_billingGroups = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBillingGroupsResponse' {Maybe [BillingGroupListElement]
billingGroups :: Maybe [BillingGroupListElement]
$sel:billingGroups:ListBillingGroupsResponse' :: ListBillingGroupsResponse -> Maybe [BillingGroupListElement]
billingGroups} -> Maybe [BillingGroupListElement]
billingGroups) (\s :: ListBillingGroupsResponse
s@ListBillingGroupsResponse' {} Maybe [BillingGroupListElement]
a -> ListBillingGroupsResponse
s {$sel:billingGroups:ListBillingGroupsResponse' :: Maybe [BillingGroupListElement]
billingGroups = Maybe [BillingGroupListElement]
a} :: ListBillingGroupsResponse) 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
listBillingGroupsResponse_nextToken :: Lens.Lens' ListBillingGroupsResponse (Prelude.Maybe Prelude.Text)
listBillingGroupsResponse_nextToken :: Lens' ListBillingGroupsResponse (Maybe Text)
listBillingGroupsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBillingGroupsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListBillingGroupsResponse' :: ListBillingGroupsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListBillingGroupsResponse
s@ListBillingGroupsResponse' {} Maybe Text
a -> ListBillingGroupsResponse
s {$sel:nextToken:ListBillingGroupsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListBillingGroupsResponse)
listBillingGroupsResponse_httpStatus :: Lens.Lens' ListBillingGroupsResponse Prelude.Int
listBillingGroupsResponse_httpStatus :: Lens' ListBillingGroupsResponse Int
listBillingGroupsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBillingGroupsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListBillingGroupsResponse' :: ListBillingGroupsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListBillingGroupsResponse
s@ListBillingGroupsResponse' {} Int
a -> ListBillingGroupsResponse
s {$sel:httpStatus:ListBillingGroupsResponse' :: Int
httpStatus = Int
a} :: ListBillingGroupsResponse)
instance Prelude.NFData ListBillingGroupsResponse where
rnf :: ListBillingGroupsResponse -> ()
rnf ListBillingGroupsResponse' {Int
Maybe [BillingGroupListElement]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
billingGroups :: Maybe [BillingGroupListElement]
$sel:httpStatus:ListBillingGroupsResponse' :: ListBillingGroupsResponse -> Int
$sel:nextToken:ListBillingGroupsResponse' :: ListBillingGroupsResponse -> Maybe Text
$sel:billingGroups:ListBillingGroupsResponse' :: ListBillingGroupsResponse -> Maybe [BillingGroupListElement]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [BillingGroupListElement]
billingGroups
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