{-# 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.ListAccountAssociations
(
ListAccountAssociations (..),
newListAccountAssociations,
listAccountAssociations_billingPeriod,
listAccountAssociations_filters,
listAccountAssociations_nextToken,
ListAccountAssociationsResponse (..),
newListAccountAssociationsResponse,
listAccountAssociationsResponse_linkedAccounts,
listAccountAssociationsResponse_nextToken,
listAccountAssociationsResponse_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 ListAccountAssociations = ListAccountAssociations'
{
ListAccountAssociations -> Maybe Text
billingPeriod :: Prelude.Maybe Prelude.Text,
ListAccountAssociations -> Maybe ListAccountAssociationsFilter
filters :: Prelude.Maybe ListAccountAssociationsFilter,
ListAccountAssociations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListAccountAssociations -> ListAccountAssociations -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAccountAssociations -> ListAccountAssociations -> Bool
$c/= :: ListAccountAssociations -> ListAccountAssociations -> Bool
== :: ListAccountAssociations -> ListAccountAssociations -> Bool
$c== :: ListAccountAssociations -> ListAccountAssociations -> Bool
Prelude.Eq, ReadPrec [ListAccountAssociations]
ReadPrec ListAccountAssociations
Int -> ReadS ListAccountAssociations
ReadS [ListAccountAssociations]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAccountAssociations]
$creadListPrec :: ReadPrec [ListAccountAssociations]
readPrec :: ReadPrec ListAccountAssociations
$creadPrec :: ReadPrec ListAccountAssociations
readList :: ReadS [ListAccountAssociations]
$creadList :: ReadS [ListAccountAssociations]
readsPrec :: Int -> ReadS ListAccountAssociations
$creadsPrec :: Int -> ReadS ListAccountAssociations
Prelude.Read, Int -> ListAccountAssociations -> ShowS
[ListAccountAssociations] -> ShowS
ListAccountAssociations -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAccountAssociations] -> ShowS
$cshowList :: [ListAccountAssociations] -> ShowS
show :: ListAccountAssociations -> String
$cshow :: ListAccountAssociations -> String
showsPrec :: Int -> ListAccountAssociations -> ShowS
$cshowsPrec :: Int -> ListAccountAssociations -> ShowS
Prelude.Show, forall x. Rep ListAccountAssociations x -> ListAccountAssociations
forall x. ListAccountAssociations -> Rep ListAccountAssociations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAccountAssociations x -> ListAccountAssociations
$cfrom :: forall x. ListAccountAssociations -> Rep ListAccountAssociations x
Prelude.Generic)
newListAccountAssociations ::
ListAccountAssociations
newListAccountAssociations :: ListAccountAssociations
newListAccountAssociations =
ListAccountAssociations'
{ $sel:billingPeriod:ListAccountAssociations' :: Maybe Text
billingPeriod =
forall a. Maybe a
Prelude.Nothing,
$sel:filters:ListAccountAssociations' :: Maybe ListAccountAssociationsFilter
filters = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListAccountAssociations' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listAccountAssociations_billingPeriod :: Lens.Lens' ListAccountAssociations (Prelude.Maybe Prelude.Text)
listAccountAssociations_billingPeriod :: Lens' ListAccountAssociations (Maybe Text)
listAccountAssociations_billingPeriod = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountAssociations' {Maybe Text
billingPeriod :: Maybe Text
$sel:billingPeriod:ListAccountAssociations' :: ListAccountAssociations -> Maybe Text
billingPeriod} -> Maybe Text
billingPeriod) (\s :: ListAccountAssociations
s@ListAccountAssociations' {} Maybe Text
a -> ListAccountAssociations
s {$sel:billingPeriod:ListAccountAssociations' :: Maybe Text
billingPeriod = Maybe Text
a} :: ListAccountAssociations)
listAccountAssociations_filters :: Lens.Lens' ListAccountAssociations (Prelude.Maybe ListAccountAssociationsFilter)
listAccountAssociations_filters :: Lens' ListAccountAssociations (Maybe ListAccountAssociationsFilter)
listAccountAssociations_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountAssociations' {Maybe ListAccountAssociationsFilter
filters :: Maybe ListAccountAssociationsFilter
$sel:filters:ListAccountAssociations' :: ListAccountAssociations -> Maybe ListAccountAssociationsFilter
filters} -> Maybe ListAccountAssociationsFilter
filters) (\s :: ListAccountAssociations
s@ListAccountAssociations' {} Maybe ListAccountAssociationsFilter
a -> ListAccountAssociations
s {$sel:filters:ListAccountAssociations' :: Maybe ListAccountAssociationsFilter
filters = Maybe ListAccountAssociationsFilter
a} :: ListAccountAssociations)
listAccountAssociations_nextToken :: Lens.Lens' ListAccountAssociations (Prelude.Maybe Prelude.Text)
listAccountAssociations_nextToken :: Lens' ListAccountAssociations (Maybe Text)
listAccountAssociations_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountAssociations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAccountAssociations' :: ListAccountAssociations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAccountAssociations
s@ListAccountAssociations' {} Maybe Text
a -> ListAccountAssociations
s {$sel:nextToken:ListAccountAssociations' :: Maybe Text
nextToken = Maybe Text
a} :: ListAccountAssociations)
instance Core.AWSPager ListAccountAssociations where
page :: ListAccountAssociations
-> AWSResponse ListAccountAssociations
-> Maybe ListAccountAssociations
page ListAccountAssociations
rq AWSResponse ListAccountAssociations
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListAccountAssociations
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAccountAssociationsResponse (Maybe Text)
listAccountAssociationsResponse_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 ListAccountAssociations
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
ListAccountAssociationsResponse
(Maybe [AccountAssociationsListElement])
listAccountAssociationsResponse_linkedAccounts
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.$ ListAccountAssociations
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListAccountAssociations (Maybe Text)
listAccountAssociations_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAccountAssociations
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAccountAssociationsResponse (Maybe Text)
listAccountAssociationsResponse_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 ListAccountAssociations where
type
AWSResponse ListAccountAssociations =
ListAccountAssociationsResponse
request :: (Service -> Service)
-> ListAccountAssociations -> Request ListAccountAssociations
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 ListAccountAssociations
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListAccountAssociations)))
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 [AccountAssociationsListElement]
-> Maybe Text -> Int -> ListAccountAssociationsResponse
ListAccountAssociationsResponse'
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
"LinkedAccounts" 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 ListAccountAssociations where
hashWithSalt :: Int -> ListAccountAssociations -> Int
hashWithSalt Int
_salt ListAccountAssociations' {Maybe Text
Maybe ListAccountAssociationsFilter
nextToken :: Maybe Text
filters :: Maybe ListAccountAssociationsFilter
billingPeriod :: Maybe Text
$sel:nextToken:ListAccountAssociations' :: ListAccountAssociations -> Maybe Text
$sel:filters:ListAccountAssociations' :: ListAccountAssociations -> Maybe ListAccountAssociationsFilter
$sel:billingPeriod:ListAccountAssociations' :: ListAccountAssociations -> 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 ListAccountAssociationsFilter
filters
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData ListAccountAssociations where
rnf :: ListAccountAssociations -> ()
rnf ListAccountAssociations' {Maybe Text
Maybe ListAccountAssociationsFilter
nextToken :: Maybe Text
filters :: Maybe ListAccountAssociationsFilter
billingPeriod :: Maybe Text
$sel:nextToken:ListAccountAssociations' :: ListAccountAssociations -> Maybe Text
$sel:filters:ListAccountAssociations' :: ListAccountAssociations -> Maybe ListAccountAssociationsFilter
$sel:billingPeriod:ListAccountAssociations' :: ListAccountAssociations -> 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 ListAccountAssociationsFilter
filters
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
instance Data.ToHeaders ListAccountAssociations where
toHeaders :: ListAccountAssociations -> 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 ListAccountAssociations where
toJSON :: ListAccountAssociations -> Value
toJSON ListAccountAssociations' {Maybe Text
Maybe ListAccountAssociationsFilter
nextToken :: Maybe Text
filters :: Maybe ListAccountAssociationsFilter
billingPeriod :: Maybe Text
$sel:nextToken:ListAccountAssociations' :: ListAccountAssociations -> Maybe Text
$sel:filters:ListAccountAssociations' :: ListAccountAssociations -> Maybe ListAccountAssociationsFilter
$sel:billingPeriod:ListAccountAssociations' :: ListAccountAssociations -> 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 ListAccountAssociationsFilter
filters,
(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 ListAccountAssociations where
toPath :: ListAccountAssociations -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/list-account-associations"
instance Data.ToQuery ListAccountAssociations where
toQuery :: ListAccountAssociations -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListAccountAssociationsResponse = ListAccountAssociationsResponse'
{
ListAccountAssociationsResponse
-> Maybe [AccountAssociationsListElement]
linkedAccounts :: Prelude.Maybe [AccountAssociationsListElement],
ListAccountAssociationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListAccountAssociationsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListAccountAssociationsResponse
-> ListAccountAssociationsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAccountAssociationsResponse
-> ListAccountAssociationsResponse -> Bool
$c/= :: ListAccountAssociationsResponse
-> ListAccountAssociationsResponse -> Bool
== :: ListAccountAssociationsResponse
-> ListAccountAssociationsResponse -> Bool
$c== :: ListAccountAssociationsResponse
-> ListAccountAssociationsResponse -> Bool
Prelude.Eq, Int -> ListAccountAssociationsResponse -> ShowS
[ListAccountAssociationsResponse] -> ShowS
ListAccountAssociationsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAccountAssociationsResponse] -> ShowS
$cshowList :: [ListAccountAssociationsResponse] -> ShowS
show :: ListAccountAssociationsResponse -> String
$cshow :: ListAccountAssociationsResponse -> String
showsPrec :: Int -> ListAccountAssociationsResponse -> ShowS
$cshowsPrec :: Int -> ListAccountAssociationsResponse -> ShowS
Prelude.Show, forall x.
Rep ListAccountAssociationsResponse x
-> ListAccountAssociationsResponse
forall x.
ListAccountAssociationsResponse
-> Rep ListAccountAssociationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAccountAssociationsResponse x
-> ListAccountAssociationsResponse
$cfrom :: forall x.
ListAccountAssociationsResponse
-> Rep ListAccountAssociationsResponse x
Prelude.Generic)
newListAccountAssociationsResponse ::
Prelude.Int ->
ListAccountAssociationsResponse
newListAccountAssociationsResponse :: Int -> ListAccountAssociationsResponse
newListAccountAssociationsResponse Int
pHttpStatus_ =
ListAccountAssociationsResponse'
{ $sel:linkedAccounts:ListAccountAssociationsResponse' :: Maybe [AccountAssociationsListElement]
linkedAccounts =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListAccountAssociationsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListAccountAssociationsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listAccountAssociationsResponse_linkedAccounts :: Lens.Lens' ListAccountAssociationsResponse (Prelude.Maybe [AccountAssociationsListElement])
listAccountAssociationsResponse_linkedAccounts :: Lens'
ListAccountAssociationsResponse
(Maybe [AccountAssociationsListElement])
listAccountAssociationsResponse_linkedAccounts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountAssociationsResponse' {Maybe [AccountAssociationsListElement]
linkedAccounts :: Maybe [AccountAssociationsListElement]
$sel:linkedAccounts:ListAccountAssociationsResponse' :: ListAccountAssociationsResponse
-> Maybe [AccountAssociationsListElement]
linkedAccounts} -> Maybe [AccountAssociationsListElement]
linkedAccounts) (\s :: ListAccountAssociationsResponse
s@ListAccountAssociationsResponse' {} Maybe [AccountAssociationsListElement]
a -> ListAccountAssociationsResponse
s {$sel:linkedAccounts:ListAccountAssociationsResponse' :: Maybe [AccountAssociationsListElement]
linkedAccounts = Maybe [AccountAssociationsListElement]
a} :: ListAccountAssociationsResponse) 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
listAccountAssociationsResponse_nextToken :: Lens.Lens' ListAccountAssociationsResponse (Prelude.Maybe Prelude.Text)
listAccountAssociationsResponse_nextToken :: Lens' ListAccountAssociationsResponse (Maybe Text)
listAccountAssociationsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountAssociationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAccountAssociationsResponse' :: ListAccountAssociationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAccountAssociationsResponse
s@ListAccountAssociationsResponse' {} Maybe Text
a -> ListAccountAssociationsResponse
s {$sel:nextToken:ListAccountAssociationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAccountAssociationsResponse)
listAccountAssociationsResponse_httpStatus :: Lens.Lens' ListAccountAssociationsResponse Prelude.Int
listAccountAssociationsResponse_httpStatus :: Lens' ListAccountAssociationsResponse Int
listAccountAssociationsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountAssociationsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListAccountAssociationsResponse' :: ListAccountAssociationsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListAccountAssociationsResponse
s@ListAccountAssociationsResponse' {} Int
a -> ListAccountAssociationsResponse
s {$sel:httpStatus:ListAccountAssociationsResponse' :: Int
httpStatus = Int
a} :: ListAccountAssociationsResponse)
instance
Prelude.NFData
ListAccountAssociationsResponse
where
rnf :: ListAccountAssociationsResponse -> ()
rnf ListAccountAssociationsResponse' {Int
Maybe [AccountAssociationsListElement]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
linkedAccounts :: Maybe [AccountAssociationsListElement]
$sel:httpStatus:ListAccountAssociationsResponse' :: ListAccountAssociationsResponse -> Int
$sel:nextToken:ListAccountAssociationsResponse' :: ListAccountAssociationsResponse -> Maybe Text
$sel:linkedAccounts:ListAccountAssociationsResponse' :: ListAccountAssociationsResponse
-> Maybe [AccountAssociationsListElement]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [AccountAssociationsListElement]
linkedAccounts
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