{-# 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.CostExplorer.GetCostAndUsageWithResources
(
GetCostAndUsageWithResources (..),
newGetCostAndUsageWithResources,
getCostAndUsageWithResources_groupBy,
getCostAndUsageWithResources_nextPageToken,
getCostAndUsageWithResources_metrics,
getCostAndUsageWithResources_timePeriod,
getCostAndUsageWithResources_granularity,
getCostAndUsageWithResources_filter,
GetCostAndUsageWithResourcesResponse (..),
newGetCostAndUsageWithResourcesResponse,
getCostAndUsageWithResourcesResponse_resultsByTime,
getCostAndUsageWithResourcesResponse_nextPageToken,
getCostAndUsageWithResourcesResponse_dimensionValueAttributes,
getCostAndUsageWithResourcesResponse_groupDefinitions,
getCostAndUsageWithResourcesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.CostExplorer.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetCostAndUsageWithResources = GetCostAndUsageWithResources'
{
GetCostAndUsageWithResources -> Maybe [GroupDefinition]
groupBy :: Prelude.Maybe [GroupDefinition],
GetCostAndUsageWithResources -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
GetCostAndUsageWithResources -> Maybe [Text]
metrics :: Prelude.Maybe [Prelude.Text],
GetCostAndUsageWithResources -> DateInterval
timePeriod :: DateInterval,
GetCostAndUsageWithResources -> Granularity
granularity :: Granularity,
GetCostAndUsageWithResources -> Expression
filter' :: Expression
}
deriving (GetCostAndUsageWithResources
-> GetCostAndUsageWithResources -> Bool
(GetCostAndUsageWithResources
-> GetCostAndUsageWithResources -> Bool)
-> (GetCostAndUsageWithResources
-> GetCostAndUsageWithResources -> Bool)
-> Eq GetCostAndUsageWithResources
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCostAndUsageWithResources
-> GetCostAndUsageWithResources -> Bool
$c/= :: GetCostAndUsageWithResources
-> GetCostAndUsageWithResources -> Bool
== :: GetCostAndUsageWithResources
-> GetCostAndUsageWithResources -> Bool
$c== :: GetCostAndUsageWithResources
-> GetCostAndUsageWithResources -> Bool
Prelude.Eq, ReadPrec [GetCostAndUsageWithResources]
ReadPrec GetCostAndUsageWithResources
Int -> ReadS GetCostAndUsageWithResources
ReadS [GetCostAndUsageWithResources]
(Int -> ReadS GetCostAndUsageWithResources)
-> ReadS [GetCostAndUsageWithResources]
-> ReadPrec GetCostAndUsageWithResources
-> ReadPrec [GetCostAndUsageWithResources]
-> Read GetCostAndUsageWithResources
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCostAndUsageWithResources]
$creadListPrec :: ReadPrec [GetCostAndUsageWithResources]
readPrec :: ReadPrec GetCostAndUsageWithResources
$creadPrec :: ReadPrec GetCostAndUsageWithResources
readList :: ReadS [GetCostAndUsageWithResources]
$creadList :: ReadS [GetCostAndUsageWithResources]
readsPrec :: Int -> ReadS GetCostAndUsageWithResources
$creadsPrec :: Int -> ReadS GetCostAndUsageWithResources
Prelude.Read, Int -> GetCostAndUsageWithResources -> ShowS
[GetCostAndUsageWithResources] -> ShowS
GetCostAndUsageWithResources -> String
(Int -> GetCostAndUsageWithResources -> ShowS)
-> (GetCostAndUsageWithResources -> String)
-> ([GetCostAndUsageWithResources] -> ShowS)
-> Show GetCostAndUsageWithResources
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCostAndUsageWithResources] -> ShowS
$cshowList :: [GetCostAndUsageWithResources] -> ShowS
show :: GetCostAndUsageWithResources -> String
$cshow :: GetCostAndUsageWithResources -> String
showsPrec :: Int -> GetCostAndUsageWithResources -> ShowS
$cshowsPrec :: Int -> GetCostAndUsageWithResources -> ShowS
Prelude.Show, (forall x.
GetCostAndUsageWithResources -> Rep GetCostAndUsageWithResources x)
-> (forall x.
Rep GetCostAndUsageWithResources x -> GetCostAndUsageWithResources)
-> Generic GetCostAndUsageWithResources
forall x.
Rep GetCostAndUsageWithResources x -> GetCostAndUsageWithResources
forall x.
GetCostAndUsageWithResources -> Rep GetCostAndUsageWithResources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetCostAndUsageWithResources x -> GetCostAndUsageWithResources
$cfrom :: forall x.
GetCostAndUsageWithResources -> Rep GetCostAndUsageWithResources x
Prelude.Generic)
newGetCostAndUsageWithResources ::
DateInterval ->
Granularity ->
Expression ->
GetCostAndUsageWithResources
newGetCostAndUsageWithResources :: DateInterval
-> Granularity -> Expression -> GetCostAndUsageWithResources
newGetCostAndUsageWithResources
DateInterval
pTimePeriod_
Granularity
pGranularity_
Expression
pFilter_ =
GetCostAndUsageWithResources' :: Maybe [GroupDefinition]
-> Maybe Text
-> Maybe [Text]
-> DateInterval
-> Granularity
-> Expression
-> GetCostAndUsageWithResources
GetCostAndUsageWithResources'
{ $sel:groupBy:GetCostAndUsageWithResources' :: Maybe [GroupDefinition]
groupBy =
Maybe [GroupDefinition]
forall a. Maybe a
Prelude.Nothing,
$sel:nextPageToken:GetCostAndUsageWithResources' :: Maybe Text
nextPageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:metrics:GetCostAndUsageWithResources' :: Maybe [Text]
metrics = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:timePeriod:GetCostAndUsageWithResources' :: DateInterval
timePeriod = DateInterval
pTimePeriod_,
$sel:granularity:GetCostAndUsageWithResources' :: Granularity
granularity = Granularity
pGranularity_,
$sel:filter':GetCostAndUsageWithResources' :: Expression
filter' = Expression
pFilter_
}
getCostAndUsageWithResources_groupBy :: Lens.Lens' GetCostAndUsageWithResources (Prelude.Maybe [GroupDefinition])
getCostAndUsageWithResources_groupBy :: (Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> GetCostAndUsageWithResources -> f GetCostAndUsageWithResources
getCostAndUsageWithResources_groupBy = (GetCostAndUsageWithResources -> Maybe [GroupDefinition])
-> (GetCostAndUsageWithResources
-> Maybe [GroupDefinition] -> GetCostAndUsageWithResources)
-> Lens
GetCostAndUsageWithResources
GetCostAndUsageWithResources
(Maybe [GroupDefinition])
(Maybe [GroupDefinition])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageWithResources' {Maybe [GroupDefinition]
groupBy :: Maybe [GroupDefinition]
$sel:groupBy:GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> Maybe [GroupDefinition]
groupBy} -> Maybe [GroupDefinition]
groupBy) (\s :: GetCostAndUsageWithResources
s@GetCostAndUsageWithResources' {} Maybe [GroupDefinition]
a -> GetCostAndUsageWithResources
s {$sel:groupBy:GetCostAndUsageWithResources' :: Maybe [GroupDefinition]
groupBy = Maybe [GroupDefinition]
a} :: GetCostAndUsageWithResources) ((Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> GetCostAndUsageWithResources -> f GetCostAndUsageWithResources)
-> ((Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> (Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> GetCostAndUsageWithResources
-> f GetCostAndUsageWithResources
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[GroupDefinition]
[GroupDefinition]
[GroupDefinition]
[GroupDefinition]
-> Iso
(Maybe [GroupDefinition])
(Maybe [GroupDefinition])
(Maybe [GroupDefinition])
(Maybe [GroupDefinition])
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 AnIso
[GroupDefinition]
[GroupDefinition]
[GroupDefinition]
[GroupDefinition]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getCostAndUsageWithResources_nextPageToken :: Lens.Lens' GetCostAndUsageWithResources (Prelude.Maybe Prelude.Text)
getCostAndUsageWithResources_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> GetCostAndUsageWithResources -> f GetCostAndUsageWithResources
getCostAndUsageWithResources_nextPageToken = (GetCostAndUsageWithResources -> Maybe Text)
-> (GetCostAndUsageWithResources
-> Maybe Text -> GetCostAndUsageWithResources)
-> Lens
GetCostAndUsageWithResources
GetCostAndUsageWithResources
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageWithResources' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: GetCostAndUsageWithResources
s@GetCostAndUsageWithResources' {} Maybe Text
a -> GetCostAndUsageWithResources
s {$sel:nextPageToken:GetCostAndUsageWithResources' :: Maybe Text
nextPageToken = Maybe Text
a} :: GetCostAndUsageWithResources)
getCostAndUsageWithResources_metrics :: Lens.Lens' GetCostAndUsageWithResources (Prelude.Maybe [Prelude.Text])
getCostAndUsageWithResources_metrics :: (Maybe [Text] -> f (Maybe [Text]))
-> GetCostAndUsageWithResources -> f GetCostAndUsageWithResources
getCostAndUsageWithResources_metrics = (GetCostAndUsageWithResources -> Maybe [Text])
-> (GetCostAndUsageWithResources
-> Maybe [Text] -> GetCostAndUsageWithResources)
-> Lens
GetCostAndUsageWithResources
GetCostAndUsageWithResources
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageWithResources' {Maybe [Text]
metrics :: Maybe [Text]
$sel:metrics:GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> Maybe [Text]
metrics} -> Maybe [Text]
metrics) (\s :: GetCostAndUsageWithResources
s@GetCostAndUsageWithResources' {} Maybe [Text]
a -> GetCostAndUsageWithResources
s {$sel:metrics:GetCostAndUsageWithResources' :: Maybe [Text]
metrics = Maybe [Text]
a} :: GetCostAndUsageWithResources) ((Maybe [Text] -> f (Maybe [Text]))
-> GetCostAndUsageWithResources -> f GetCostAndUsageWithResources)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> GetCostAndUsageWithResources
-> f GetCostAndUsageWithResources
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getCostAndUsageWithResources_timePeriod :: Lens.Lens' GetCostAndUsageWithResources DateInterval
getCostAndUsageWithResources_timePeriod :: (DateInterval -> f DateInterval)
-> GetCostAndUsageWithResources -> f GetCostAndUsageWithResources
getCostAndUsageWithResources_timePeriod = (GetCostAndUsageWithResources -> DateInterval)
-> (GetCostAndUsageWithResources
-> DateInterval -> GetCostAndUsageWithResources)
-> Lens
GetCostAndUsageWithResources
GetCostAndUsageWithResources
DateInterval
DateInterval
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageWithResources' {DateInterval
timePeriod :: DateInterval
$sel:timePeriod:GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> DateInterval
timePeriod} -> DateInterval
timePeriod) (\s :: GetCostAndUsageWithResources
s@GetCostAndUsageWithResources' {} DateInterval
a -> GetCostAndUsageWithResources
s {$sel:timePeriod:GetCostAndUsageWithResources' :: DateInterval
timePeriod = DateInterval
a} :: GetCostAndUsageWithResources)
getCostAndUsageWithResources_granularity :: Lens.Lens' GetCostAndUsageWithResources Granularity
getCostAndUsageWithResources_granularity :: (Granularity -> f Granularity)
-> GetCostAndUsageWithResources -> f GetCostAndUsageWithResources
getCostAndUsageWithResources_granularity = (GetCostAndUsageWithResources -> Granularity)
-> (GetCostAndUsageWithResources
-> Granularity -> GetCostAndUsageWithResources)
-> Lens
GetCostAndUsageWithResources
GetCostAndUsageWithResources
Granularity
Granularity
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageWithResources' {Granularity
granularity :: Granularity
$sel:granularity:GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> Granularity
granularity} -> Granularity
granularity) (\s :: GetCostAndUsageWithResources
s@GetCostAndUsageWithResources' {} Granularity
a -> GetCostAndUsageWithResources
s {$sel:granularity:GetCostAndUsageWithResources' :: Granularity
granularity = Granularity
a} :: GetCostAndUsageWithResources)
getCostAndUsageWithResources_filter :: Lens.Lens' GetCostAndUsageWithResources Expression
getCostAndUsageWithResources_filter :: (Expression -> f Expression)
-> GetCostAndUsageWithResources -> f GetCostAndUsageWithResources
getCostAndUsageWithResources_filter = (GetCostAndUsageWithResources -> Expression)
-> (GetCostAndUsageWithResources
-> Expression -> GetCostAndUsageWithResources)
-> Lens
GetCostAndUsageWithResources
GetCostAndUsageWithResources
Expression
Expression
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageWithResources' {Expression
filter' :: Expression
$sel:filter':GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> Expression
filter'} -> Expression
filter') (\s :: GetCostAndUsageWithResources
s@GetCostAndUsageWithResources' {} Expression
a -> GetCostAndUsageWithResources
s {$sel:filter':GetCostAndUsageWithResources' :: Expression
filter' = Expression
a} :: GetCostAndUsageWithResources)
instance Core.AWSRequest GetCostAndUsageWithResources where
type
AWSResponse GetCostAndUsageWithResources =
GetCostAndUsageWithResourcesResponse
request :: GetCostAndUsageWithResources
-> Request GetCostAndUsageWithResources
request = Service
-> GetCostAndUsageWithResources
-> Request GetCostAndUsageWithResources
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetCostAndUsageWithResources
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetCostAndUsageWithResources)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetCostAndUsageWithResources))
-> Logger
-> Service
-> Proxy GetCostAndUsageWithResources
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetCostAndUsageWithResources)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [ResultByTime]
-> Maybe Text
-> Maybe [DimensionValuesWithAttributes]
-> Maybe [GroupDefinition]
-> Int
-> GetCostAndUsageWithResourcesResponse
GetCostAndUsageWithResourcesResponse'
(Maybe [ResultByTime]
-> Maybe Text
-> Maybe [DimensionValuesWithAttributes]
-> Maybe [GroupDefinition]
-> Int
-> GetCostAndUsageWithResourcesResponse)
-> Either String (Maybe [ResultByTime])
-> Either
String
(Maybe Text
-> Maybe [DimensionValuesWithAttributes]
-> Maybe [GroupDefinition]
-> Int
-> GetCostAndUsageWithResourcesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [ResultByTime]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResultsByTime" Either String (Maybe (Maybe [ResultByTime]))
-> Maybe [ResultByTime] -> Either String (Maybe [ResultByTime])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ResultByTime]
forall a. Monoid a => a
Prelude.mempty)
Either
String
(Maybe Text
-> Maybe [DimensionValuesWithAttributes]
-> Maybe [GroupDefinition]
-> Int
-> GetCostAndUsageWithResourcesResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe [DimensionValuesWithAttributes]
-> Maybe [GroupDefinition]
-> Int
-> GetCostAndUsageWithResourcesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextPageToken")
Either
String
(Maybe [DimensionValuesWithAttributes]
-> Maybe [GroupDefinition]
-> Int
-> GetCostAndUsageWithResourcesResponse)
-> Either String (Maybe [DimensionValuesWithAttributes])
-> Either
String
(Maybe [GroupDefinition]
-> Int -> GetCostAndUsageWithResourcesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text
-> Either String (Maybe (Maybe [DimensionValuesWithAttributes]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DimensionValueAttributes"
Either String (Maybe (Maybe [DimensionValuesWithAttributes]))
-> Maybe [DimensionValuesWithAttributes]
-> Either String (Maybe [DimensionValuesWithAttributes])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [DimensionValuesWithAttributes]
forall a. Monoid a => a
Prelude.mempty
)
Either
String
(Maybe [GroupDefinition]
-> Int -> GetCostAndUsageWithResourcesResponse)
-> Either String (Maybe [GroupDefinition])
-> Either String (Int -> GetCostAndUsageWithResourcesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe (Maybe [GroupDefinition]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"GroupDefinitions"
Either String (Maybe (Maybe [GroupDefinition]))
-> Maybe [GroupDefinition]
-> Either String (Maybe [GroupDefinition])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [GroupDefinition]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> GetCostAndUsageWithResourcesResponse)
-> Either String Int
-> Either String GetCostAndUsageWithResourcesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance
Prelude.Hashable
GetCostAndUsageWithResources
instance Prelude.NFData GetCostAndUsageWithResources
instance Core.ToHeaders GetCostAndUsageWithResources where
toHeaders :: GetCostAndUsageWithResources -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetCostAndUsageWithResources -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSInsightsIndexService.GetCostAndUsageWithResources" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON GetCostAndUsageWithResources where
toJSON :: GetCostAndUsageWithResources -> Value
toJSON GetCostAndUsageWithResources' {Maybe [Text]
Maybe [GroupDefinition]
Maybe Text
DateInterval
Granularity
Expression
filter' :: Expression
granularity :: Granularity
timePeriod :: DateInterval
metrics :: Maybe [Text]
nextPageToken :: Maybe Text
groupBy :: Maybe [GroupDefinition]
$sel:filter':GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> Expression
$sel:granularity:GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> Granularity
$sel:timePeriod:GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> DateInterval
$sel:metrics:GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> Maybe [Text]
$sel:nextPageToken:GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> Maybe Text
$sel:groupBy:GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> Maybe [GroupDefinition]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"GroupBy" Text -> [GroupDefinition] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([GroupDefinition] -> Pair)
-> Maybe [GroupDefinition] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [GroupDefinition]
groupBy,
(Text
"NextPageToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextPageToken,
(Text
"Metrics" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
metrics,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TimePeriod" Text -> DateInterval -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DateInterval
timePeriod),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Granularity" Text -> Granularity -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Granularity
granularity),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Filter" Text -> Expression -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Expression
filter')
]
)
instance Core.ToPath GetCostAndUsageWithResources where
toPath :: GetCostAndUsageWithResources -> ByteString
toPath = ByteString -> GetCostAndUsageWithResources -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetCostAndUsageWithResources where
toQuery :: GetCostAndUsageWithResources -> QueryString
toQuery = QueryString -> GetCostAndUsageWithResources -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetCostAndUsageWithResourcesResponse = GetCostAndUsageWithResourcesResponse'
{
GetCostAndUsageWithResourcesResponse -> Maybe [ResultByTime]
resultsByTime :: Prelude.Maybe [ResultByTime],
GetCostAndUsageWithResourcesResponse -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
GetCostAndUsageWithResourcesResponse
-> Maybe [DimensionValuesWithAttributes]
dimensionValueAttributes :: Prelude.Maybe [DimensionValuesWithAttributes],
GetCostAndUsageWithResourcesResponse -> Maybe [GroupDefinition]
groupDefinitions :: Prelude.Maybe [GroupDefinition],
GetCostAndUsageWithResourcesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetCostAndUsageWithResourcesResponse
-> GetCostAndUsageWithResourcesResponse -> Bool
(GetCostAndUsageWithResourcesResponse
-> GetCostAndUsageWithResourcesResponse -> Bool)
-> (GetCostAndUsageWithResourcesResponse
-> GetCostAndUsageWithResourcesResponse -> Bool)
-> Eq GetCostAndUsageWithResourcesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCostAndUsageWithResourcesResponse
-> GetCostAndUsageWithResourcesResponse -> Bool
$c/= :: GetCostAndUsageWithResourcesResponse
-> GetCostAndUsageWithResourcesResponse -> Bool
== :: GetCostAndUsageWithResourcesResponse
-> GetCostAndUsageWithResourcesResponse -> Bool
$c== :: GetCostAndUsageWithResourcesResponse
-> GetCostAndUsageWithResourcesResponse -> Bool
Prelude.Eq, ReadPrec [GetCostAndUsageWithResourcesResponse]
ReadPrec GetCostAndUsageWithResourcesResponse
Int -> ReadS GetCostAndUsageWithResourcesResponse
ReadS [GetCostAndUsageWithResourcesResponse]
(Int -> ReadS GetCostAndUsageWithResourcesResponse)
-> ReadS [GetCostAndUsageWithResourcesResponse]
-> ReadPrec GetCostAndUsageWithResourcesResponse
-> ReadPrec [GetCostAndUsageWithResourcesResponse]
-> Read GetCostAndUsageWithResourcesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCostAndUsageWithResourcesResponse]
$creadListPrec :: ReadPrec [GetCostAndUsageWithResourcesResponse]
readPrec :: ReadPrec GetCostAndUsageWithResourcesResponse
$creadPrec :: ReadPrec GetCostAndUsageWithResourcesResponse
readList :: ReadS [GetCostAndUsageWithResourcesResponse]
$creadList :: ReadS [GetCostAndUsageWithResourcesResponse]
readsPrec :: Int -> ReadS GetCostAndUsageWithResourcesResponse
$creadsPrec :: Int -> ReadS GetCostAndUsageWithResourcesResponse
Prelude.Read, Int -> GetCostAndUsageWithResourcesResponse -> ShowS
[GetCostAndUsageWithResourcesResponse] -> ShowS
GetCostAndUsageWithResourcesResponse -> String
(Int -> GetCostAndUsageWithResourcesResponse -> ShowS)
-> (GetCostAndUsageWithResourcesResponse -> String)
-> ([GetCostAndUsageWithResourcesResponse] -> ShowS)
-> Show GetCostAndUsageWithResourcesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCostAndUsageWithResourcesResponse] -> ShowS
$cshowList :: [GetCostAndUsageWithResourcesResponse] -> ShowS
show :: GetCostAndUsageWithResourcesResponse -> String
$cshow :: GetCostAndUsageWithResourcesResponse -> String
showsPrec :: Int -> GetCostAndUsageWithResourcesResponse -> ShowS
$cshowsPrec :: Int -> GetCostAndUsageWithResourcesResponse -> ShowS
Prelude.Show, (forall x.
GetCostAndUsageWithResourcesResponse
-> Rep GetCostAndUsageWithResourcesResponse x)
-> (forall x.
Rep GetCostAndUsageWithResourcesResponse x
-> GetCostAndUsageWithResourcesResponse)
-> Generic GetCostAndUsageWithResourcesResponse
forall x.
Rep GetCostAndUsageWithResourcesResponse x
-> GetCostAndUsageWithResourcesResponse
forall x.
GetCostAndUsageWithResourcesResponse
-> Rep GetCostAndUsageWithResourcesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetCostAndUsageWithResourcesResponse x
-> GetCostAndUsageWithResourcesResponse
$cfrom :: forall x.
GetCostAndUsageWithResourcesResponse
-> Rep GetCostAndUsageWithResourcesResponse x
Prelude.Generic)
newGetCostAndUsageWithResourcesResponse ::
Prelude.Int ->
GetCostAndUsageWithResourcesResponse
newGetCostAndUsageWithResourcesResponse :: Int -> GetCostAndUsageWithResourcesResponse
newGetCostAndUsageWithResourcesResponse Int
pHttpStatus_ =
GetCostAndUsageWithResourcesResponse' :: Maybe [ResultByTime]
-> Maybe Text
-> Maybe [DimensionValuesWithAttributes]
-> Maybe [GroupDefinition]
-> Int
-> GetCostAndUsageWithResourcesResponse
GetCostAndUsageWithResourcesResponse'
{ $sel:resultsByTime:GetCostAndUsageWithResourcesResponse' :: Maybe [ResultByTime]
resultsByTime =
Maybe [ResultByTime]
forall a. Maybe a
Prelude.Nothing,
$sel:nextPageToken:GetCostAndUsageWithResourcesResponse' :: Maybe Text
nextPageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:dimensionValueAttributes:GetCostAndUsageWithResourcesResponse' :: Maybe [DimensionValuesWithAttributes]
dimensionValueAttributes =
Maybe [DimensionValuesWithAttributes]
forall a. Maybe a
Prelude.Nothing,
$sel:groupDefinitions:GetCostAndUsageWithResourcesResponse' :: Maybe [GroupDefinition]
groupDefinitions = Maybe [GroupDefinition]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetCostAndUsageWithResourcesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getCostAndUsageWithResourcesResponse_resultsByTime :: Lens.Lens' GetCostAndUsageWithResourcesResponse (Prelude.Maybe [ResultByTime])
getCostAndUsageWithResourcesResponse_resultsByTime :: (Maybe [ResultByTime] -> f (Maybe [ResultByTime]))
-> GetCostAndUsageWithResourcesResponse
-> f GetCostAndUsageWithResourcesResponse
getCostAndUsageWithResourcesResponse_resultsByTime = (GetCostAndUsageWithResourcesResponse -> Maybe [ResultByTime])
-> (GetCostAndUsageWithResourcesResponse
-> Maybe [ResultByTime] -> GetCostAndUsageWithResourcesResponse)
-> Lens
GetCostAndUsageWithResourcesResponse
GetCostAndUsageWithResourcesResponse
(Maybe [ResultByTime])
(Maybe [ResultByTime])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageWithResourcesResponse' {Maybe [ResultByTime]
resultsByTime :: Maybe [ResultByTime]
$sel:resultsByTime:GetCostAndUsageWithResourcesResponse' :: GetCostAndUsageWithResourcesResponse -> Maybe [ResultByTime]
resultsByTime} -> Maybe [ResultByTime]
resultsByTime) (\s :: GetCostAndUsageWithResourcesResponse
s@GetCostAndUsageWithResourcesResponse' {} Maybe [ResultByTime]
a -> GetCostAndUsageWithResourcesResponse
s {$sel:resultsByTime:GetCostAndUsageWithResourcesResponse' :: Maybe [ResultByTime]
resultsByTime = Maybe [ResultByTime]
a} :: GetCostAndUsageWithResourcesResponse) ((Maybe [ResultByTime] -> f (Maybe [ResultByTime]))
-> GetCostAndUsageWithResourcesResponse
-> f GetCostAndUsageWithResourcesResponse)
-> ((Maybe [ResultByTime] -> f (Maybe [ResultByTime]))
-> Maybe [ResultByTime] -> f (Maybe [ResultByTime]))
-> (Maybe [ResultByTime] -> f (Maybe [ResultByTime]))
-> GetCostAndUsageWithResourcesResponse
-> f GetCostAndUsageWithResourcesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ResultByTime] [ResultByTime] [ResultByTime] [ResultByTime]
-> Iso
(Maybe [ResultByTime])
(Maybe [ResultByTime])
(Maybe [ResultByTime])
(Maybe [ResultByTime])
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 AnIso [ResultByTime] [ResultByTime] [ResultByTime] [ResultByTime]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getCostAndUsageWithResourcesResponse_nextPageToken :: Lens.Lens' GetCostAndUsageWithResourcesResponse (Prelude.Maybe Prelude.Text)
getCostAndUsageWithResourcesResponse_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> GetCostAndUsageWithResourcesResponse
-> f GetCostAndUsageWithResourcesResponse
getCostAndUsageWithResourcesResponse_nextPageToken = (GetCostAndUsageWithResourcesResponse -> Maybe Text)
-> (GetCostAndUsageWithResourcesResponse
-> Maybe Text -> GetCostAndUsageWithResourcesResponse)
-> Lens
GetCostAndUsageWithResourcesResponse
GetCostAndUsageWithResourcesResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageWithResourcesResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:GetCostAndUsageWithResourcesResponse' :: GetCostAndUsageWithResourcesResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: GetCostAndUsageWithResourcesResponse
s@GetCostAndUsageWithResourcesResponse' {} Maybe Text
a -> GetCostAndUsageWithResourcesResponse
s {$sel:nextPageToken:GetCostAndUsageWithResourcesResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: GetCostAndUsageWithResourcesResponse)
getCostAndUsageWithResourcesResponse_dimensionValueAttributes :: Lens.Lens' GetCostAndUsageWithResourcesResponse (Prelude.Maybe [DimensionValuesWithAttributes])
getCostAndUsageWithResourcesResponse_dimensionValueAttributes :: (Maybe [DimensionValuesWithAttributes]
-> f (Maybe [DimensionValuesWithAttributes]))
-> GetCostAndUsageWithResourcesResponse
-> f GetCostAndUsageWithResourcesResponse
getCostAndUsageWithResourcesResponse_dimensionValueAttributes = (GetCostAndUsageWithResourcesResponse
-> Maybe [DimensionValuesWithAttributes])
-> (GetCostAndUsageWithResourcesResponse
-> Maybe [DimensionValuesWithAttributes]
-> GetCostAndUsageWithResourcesResponse)
-> Lens
GetCostAndUsageWithResourcesResponse
GetCostAndUsageWithResourcesResponse
(Maybe [DimensionValuesWithAttributes])
(Maybe [DimensionValuesWithAttributes])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageWithResourcesResponse' {Maybe [DimensionValuesWithAttributes]
dimensionValueAttributes :: Maybe [DimensionValuesWithAttributes]
$sel:dimensionValueAttributes:GetCostAndUsageWithResourcesResponse' :: GetCostAndUsageWithResourcesResponse
-> Maybe [DimensionValuesWithAttributes]
dimensionValueAttributes} -> Maybe [DimensionValuesWithAttributes]
dimensionValueAttributes) (\s :: GetCostAndUsageWithResourcesResponse
s@GetCostAndUsageWithResourcesResponse' {} Maybe [DimensionValuesWithAttributes]
a -> GetCostAndUsageWithResourcesResponse
s {$sel:dimensionValueAttributes:GetCostAndUsageWithResourcesResponse' :: Maybe [DimensionValuesWithAttributes]
dimensionValueAttributes = Maybe [DimensionValuesWithAttributes]
a} :: GetCostAndUsageWithResourcesResponse) ((Maybe [DimensionValuesWithAttributes]
-> f (Maybe [DimensionValuesWithAttributes]))
-> GetCostAndUsageWithResourcesResponse
-> f GetCostAndUsageWithResourcesResponse)
-> ((Maybe [DimensionValuesWithAttributes]
-> f (Maybe [DimensionValuesWithAttributes]))
-> Maybe [DimensionValuesWithAttributes]
-> f (Maybe [DimensionValuesWithAttributes]))
-> (Maybe [DimensionValuesWithAttributes]
-> f (Maybe [DimensionValuesWithAttributes]))
-> GetCostAndUsageWithResourcesResponse
-> f GetCostAndUsageWithResourcesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[DimensionValuesWithAttributes]
[DimensionValuesWithAttributes]
[DimensionValuesWithAttributes]
[DimensionValuesWithAttributes]
-> Iso
(Maybe [DimensionValuesWithAttributes])
(Maybe [DimensionValuesWithAttributes])
(Maybe [DimensionValuesWithAttributes])
(Maybe [DimensionValuesWithAttributes])
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 AnIso
[DimensionValuesWithAttributes]
[DimensionValuesWithAttributes]
[DimensionValuesWithAttributes]
[DimensionValuesWithAttributes]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getCostAndUsageWithResourcesResponse_groupDefinitions :: Lens.Lens' GetCostAndUsageWithResourcesResponse (Prelude.Maybe [GroupDefinition])
getCostAndUsageWithResourcesResponse_groupDefinitions :: (Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> GetCostAndUsageWithResourcesResponse
-> f GetCostAndUsageWithResourcesResponse
getCostAndUsageWithResourcesResponse_groupDefinitions = (GetCostAndUsageWithResourcesResponse -> Maybe [GroupDefinition])
-> (GetCostAndUsageWithResourcesResponse
-> Maybe [GroupDefinition] -> GetCostAndUsageWithResourcesResponse)
-> Lens
GetCostAndUsageWithResourcesResponse
GetCostAndUsageWithResourcesResponse
(Maybe [GroupDefinition])
(Maybe [GroupDefinition])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageWithResourcesResponse' {Maybe [GroupDefinition]
groupDefinitions :: Maybe [GroupDefinition]
$sel:groupDefinitions:GetCostAndUsageWithResourcesResponse' :: GetCostAndUsageWithResourcesResponse -> Maybe [GroupDefinition]
groupDefinitions} -> Maybe [GroupDefinition]
groupDefinitions) (\s :: GetCostAndUsageWithResourcesResponse
s@GetCostAndUsageWithResourcesResponse' {} Maybe [GroupDefinition]
a -> GetCostAndUsageWithResourcesResponse
s {$sel:groupDefinitions:GetCostAndUsageWithResourcesResponse' :: Maybe [GroupDefinition]
groupDefinitions = Maybe [GroupDefinition]
a} :: GetCostAndUsageWithResourcesResponse) ((Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> GetCostAndUsageWithResourcesResponse
-> f GetCostAndUsageWithResourcesResponse)
-> ((Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> (Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> GetCostAndUsageWithResourcesResponse
-> f GetCostAndUsageWithResourcesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[GroupDefinition]
[GroupDefinition]
[GroupDefinition]
[GroupDefinition]
-> Iso
(Maybe [GroupDefinition])
(Maybe [GroupDefinition])
(Maybe [GroupDefinition])
(Maybe [GroupDefinition])
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 AnIso
[GroupDefinition]
[GroupDefinition]
[GroupDefinition]
[GroupDefinition]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getCostAndUsageWithResourcesResponse_httpStatus :: Lens.Lens' GetCostAndUsageWithResourcesResponse Prelude.Int
getCostAndUsageWithResourcesResponse_httpStatus :: (Int -> f Int)
-> GetCostAndUsageWithResourcesResponse
-> f GetCostAndUsageWithResourcesResponse
getCostAndUsageWithResourcesResponse_httpStatus = (GetCostAndUsageWithResourcesResponse -> Int)
-> (GetCostAndUsageWithResourcesResponse
-> Int -> GetCostAndUsageWithResourcesResponse)
-> Lens
GetCostAndUsageWithResourcesResponse
GetCostAndUsageWithResourcesResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageWithResourcesResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetCostAndUsageWithResourcesResponse' :: GetCostAndUsageWithResourcesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetCostAndUsageWithResourcesResponse
s@GetCostAndUsageWithResourcesResponse' {} Int
a -> GetCostAndUsageWithResourcesResponse
s {$sel:httpStatus:GetCostAndUsageWithResourcesResponse' :: Int
httpStatus = Int
a} :: GetCostAndUsageWithResourcesResponse)
instance
Prelude.NFData
GetCostAndUsageWithResourcesResponse