{-# 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.ApplicationCostProfiler.PutReportDefinition
(
PutReportDefinition (..),
newPutReportDefinition,
putReportDefinition_reportId,
putReportDefinition_reportDescription,
putReportDefinition_reportFrequency,
putReportDefinition_format,
putReportDefinition_destinationS3Location,
PutReportDefinitionResponse (..),
newPutReportDefinitionResponse,
putReportDefinitionResponse_reportId,
putReportDefinitionResponse_httpStatus,
)
where
import Amazonka.ApplicationCostProfiler.Types
import qualified Amazonka.Core as Core
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 PutReportDefinition = PutReportDefinition'
{
PutReportDefinition -> Text
reportId :: Prelude.Text,
PutReportDefinition -> Text
reportDescription :: Prelude.Text,
PutReportDefinition -> ReportFrequency
reportFrequency :: ReportFrequency,
PutReportDefinition -> Format
format :: Format,
PutReportDefinition -> S3Location
destinationS3Location :: S3Location
}
deriving (PutReportDefinition -> PutReportDefinition -> Bool
(PutReportDefinition -> PutReportDefinition -> Bool)
-> (PutReportDefinition -> PutReportDefinition -> Bool)
-> Eq PutReportDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutReportDefinition -> PutReportDefinition -> Bool
$c/= :: PutReportDefinition -> PutReportDefinition -> Bool
== :: PutReportDefinition -> PutReportDefinition -> Bool
$c== :: PutReportDefinition -> PutReportDefinition -> Bool
Prelude.Eq, ReadPrec [PutReportDefinition]
ReadPrec PutReportDefinition
Int -> ReadS PutReportDefinition
ReadS [PutReportDefinition]
(Int -> ReadS PutReportDefinition)
-> ReadS [PutReportDefinition]
-> ReadPrec PutReportDefinition
-> ReadPrec [PutReportDefinition]
-> Read PutReportDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutReportDefinition]
$creadListPrec :: ReadPrec [PutReportDefinition]
readPrec :: ReadPrec PutReportDefinition
$creadPrec :: ReadPrec PutReportDefinition
readList :: ReadS [PutReportDefinition]
$creadList :: ReadS [PutReportDefinition]
readsPrec :: Int -> ReadS PutReportDefinition
$creadsPrec :: Int -> ReadS PutReportDefinition
Prelude.Read, Int -> PutReportDefinition -> ShowS
[PutReportDefinition] -> ShowS
PutReportDefinition -> String
(Int -> PutReportDefinition -> ShowS)
-> (PutReportDefinition -> String)
-> ([PutReportDefinition] -> ShowS)
-> Show PutReportDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutReportDefinition] -> ShowS
$cshowList :: [PutReportDefinition] -> ShowS
show :: PutReportDefinition -> String
$cshow :: PutReportDefinition -> String
showsPrec :: Int -> PutReportDefinition -> ShowS
$cshowsPrec :: Int -> PutReportDefinition -> ShowS
Prelude.Show, (forall x. PutReportDefinition -> Rep PutReportDefinition x)
-> (forall x. Rep PutReportDefinition x -> PutReportDefinition)
-> Generic PutReportDefinition
forall x. Rep PutReportDefinition x -> PutReportDefinition
forall x. PutReportDefinition -> Rep PutReportDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutReportDefinition x -> PutReportDefinition
$cfrom :: forall x. PutReportDefinition -> Rep PutReportDefinition x
Prelude.Generic)
newPutReportDefinition ::
Prelude.Text ->
Prelude.Text ->
ReportFrequency ->
Format ->
S3Location ->
PutReportDefinition
newPutReportDefinition :: Text
-> Text
-> ReportFrequency
-> Format
-> S3Location
-> PutReportDefinition
newPutReportDefinition
Text
pReportId_
Text
pReportDescription_
ReportFrequency
pReportFrequency_
Format
pFormat_
S3Location
pDestinationS3Location_ =
PutReportDefinition' :: Text
-> Text
-> ReportFrequency
-> Format
-> S3Location
-> PutReportDefinition
PutReportDefinition'
{ $sel:reportId:PutReportDefinition' :: Text
reportId = Text
pReportId_,
$sel:reportDescription:PutReportDefinition' :: Text
reportDescription = Text
pReportDescription_,
$sel:reportFrequency:PutReportDefinition' :: ReportFrequency
reportFrequency = ReportFrequency
pReportFrequency_,
$sel:format:PutReportDefinition' :: Format
format = Format
pFormat_,
$sel:destinationS3Location:PutReportDefinition' :: S3Location
destinationS3Location = S3Location
pDestinationS3Location_
}
putReportDefinition_reportId :: Lens.Lens' PutReportDefinition Prelude.Text
putReportDefinition_reportId :: (Text -> f Text) -> PutReportDefinition -> f PutReportDefinition
putReportDefinition_reportId = (PutReportDefinition -> Text)
-> (PutReportDefinition -> Text -> PutReportDefinition)
-> Lens PutReportDefinition PutReportDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutReportDefinition' {Text
reportId :: Text
$sel:reportId:PutReportDefinition' :: PutReportDefinition -> Text
reportId} -> Text
reportId) (\s :: PutReportDefinition
s@PutReportDefinition' {} Text
a -> PutReportDefinition
s {$sel:reportId:PutReportDefinition' :: Text
reportId = Text
a} :: PutReportDefinition)
putReportDefinition_reportDescription :: Lens.Lens' PutReportDefinition Prelude.Text
putReportDefinition_reportDescription :: (Text -> f Text) -> PutReportDefinition -> f PutReportDefinition
putReportDefinition_reportDescription = (PutReportDefinition -> Text)
-> (PutReportDefinition -> Text -> PutReportDefinition)
-> Lens PutReportDefinition PutReportDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutReportDefinition' {Text
reportDescription :: Text
$sel:reportDescription:PutReportDefinition' :: PutReportDefinition -> Text
reportDescription} -> Text
reportDescription) (\s :: PutReportDefinition
s@PutReportDefinition' {} Text
a -> PutReportDefinition
s {$sel:reportDescription:PutReportDefinition' :: Text
reportDescription = Text
a} :: PutReportDefinition)
putReportDefinition_reportFrequency :: Lens.Lens' PutReportDefinition ReportFrequency
putReportDefinition_reportFrequency :: (ReportFrequency -> f ReportFrequency)
-> PutReportDefinition -> f PutReportDefinition
putReportDefinition_reportFrequency = (PutReportDefinition -> ReportFrequency)
-> (PutReportDefinition -> ReportFrequency -> PutReportDefinition)
-> Lens
PutReportDefinition
PutReportDefinition
ReportFrequency
ReportFrequency
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutReportDefinition' {ReportFrequency
reportFrequency :: ReportFrequency
$sel:reportFrequency:PutReportDefinition' :: PutReportDefinition -> ReportFrequency
reportFrequency} -> ReportFrequency
reportFrequency) (\s :: PutReportDefinition
s@PutReportDefinition' {} ReportFrequency
a -> PutReportDefinition
s {$sel:reportFrequency:PutReportDefinition' :: ReportFrequency
reportFrequency = ReportFrequency
a} :: PutReportDefinition)
putReportDefinition_format :: Lens.Lens' PutReportDefinition Format
putReportDefinition_format :: (Format -> f Format)
-> PutReportDefinition -> f PutReportDefinition
putReportDefinition_format = (PutReportDefinition -> Format)
-> (PutReportDefinition -> Format -> PutReportDefinition)
-> Lens PutReportDefinition PutReportDefinition Format Format
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutReportDefinition' {Format
format :: Format
$sel:format:PutReportDefinition' :: PutReportDefinition -> Format
format} -> Format
format) (\s :: PutReportDefinition
s@PutReportDefinition' {} Format
a -> PutReportDefinition
s {$sel:format:PutReportDefinition' :: Format
format = Format
a} :: PutReportDefinition)
putReportDefinition_destinationS3Location :: Lens.Lens' PutReportDefinition S3Location
putReportDefinition_destinationS3Location :: (S3Location -> f S3Location)
-> PutReportDefinition -> f PutReportDefinition
putReportDefinition_destinationS3Location = (PutReportDefinition -> S3Location)
-> (PutReportDefinition -> S3Location -> PutReportDefinition)
-> Lens
PutReportDefinition PutReportDefinition S3Location S3Location
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutReportDefinition' {S3Location
destinationS3Location :: S3Location
$sel:destinationS3Location:PutReportDefinition' :: PutReportDefinition -> S3Location
destinationS3Location} -> S3Location
destinationS3Location) (\s :: PutReportDefinition
s@PutReportDefinition' {} S3Location
a -> PutReportDefinition
s {$sel:destinationS3Location:PutReportDefinition' :: S3Location
destinationS3Location = S3Location
a} :: PutReportDefinition)
instance Core.AWSRequest PutReportDefinition where
type
AWSResponse PutReportDefinition =
PutReportDefinitionResponse
request :: PutReportDefinition -> Request PutReportDefinition
request = Service -> PutReportDefinition -> Request PutReportDefinition
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutReportDefinition
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutReportDefinition)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutReportDefinition))
-> Logger
-> Service
-> Proxy PutReportDefinition
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutReportDefinition)))
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 Text -> Int -> PutReportDefinitionResponse
PutReportDefinitionResponse'
(Maybe Text -> Int -> PutReportDefinitionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> PutReportDefinitionResponse)
forall (f :: * -> *) a b. Functor 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
"reportId")
Either String (Int -> PutReportDefinitionResponse)
-> Either String Int -> Either String PutReportDefinitionResponse
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 PutReportDefinition
instance Prelude.NFData PutReportDefinition
instance Core.ToHeaders PutReportDefinition where
toHeaders :: PutReportDefinition -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutReportDefinition -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 PutReportDefinition where
toJSON :: PutReportDefinition -> Value
toJSON PutReportDefinition' {Text
Format
ReportFrequency
S3Location
destinationS3Location :: S3Location
format :: Format
reportFrequency :: ReportFrequency
reportDescription :: Text
reportId :: Text
$sel:destinationS3Location:PutReportDefinition' :: PutReportDefinition -> S3Location
$sel:format:PutReportDefinition' :: PutReportDefinition -> Format
$sel:reportFrequency:PutReportDefinition' :: PutReportDefinition -> ReportFrequency
$sel:reportDescription:PutReportDefinition' :: PutReportDefinition -> Text
$sel:reportId:PutReportDefinition' :: PutReportDefinition -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"reportId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
reportId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"reportDescription" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
reportDescription),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"reportFrequency" Text -> ReportFrequency -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ReportFrequency
reportFrequency),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"format" Text -> Format -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Format
format),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"destinationS3Location"
Text -> S3Location -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= S3Location
destinationS3Location
)
]
)
instance Core.ToPath PutReportDefinition where
toPath :: PutReportDefinition -> ByteString
toPath = ByteString -> PutReportDefinition -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/reportDefinition"
instance Core.ToQuery PutReportDefinition where
toQuery :: PutReportDefinition -> QueryString
toQuery = QueryString -> PutReportDefinition -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutReportDefinitionResponse = PutReportDefinitionResponse'
{
PutReportDefinitionResponse -> Maybe Text
reportId :: Prelude.Maybe Prelude.Text,
PutReportDefinitionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutReportDefinitionResponse -> PutReportDefinitionResponse -> Bool
(PutReportDefinitionResponse
-> PutReportDefinitionResponse -> Bool)
-> (PutReportDefinitionResponse
-> PutReportDefinitionResponse -> Bool)
-> Eq PutReportDefinitionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutReportDefinitionResponse -> PutReportDefinitionResponse -> Bool
$c/= :: PutReportDefinitionResponse -> PutReportDefinitionResponse -> Bool
== :: PutReportDefinitionResponse -> PutReportDefinitionResponse -> Bool
$c== :: PutReportDefinitionResponse -> PutReportDefinitionResponse -> Bool
Prelude.Eq, ReadPrec [PutReportDefinitionResponse]
ReadPrec PutReportDefinitionResponse
Int -> ReadS PutReportDefinitionResponse
ReadS [PutReportDefinitionResponse]
(Int -> ReadS PutReportDefinitionResponse)
-> ReadS [PutReportDefinitionResponse]
-> ReadPrec PutReportDefinitionResponse
-> ReadPrec [PutReportDefinitionResponse]
-> Read PutReportDefinitionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutReportDefinitionResponse]
$creadListPrec :: ReadPrec [PutReportDefinitionResponse]
readPrec :: ReadPrec PutReportDefinitionResponse
$creadPrec :: ReadPrec PutReportDefinitionResponse
readList :: ReadS [PutReportDefinitionResponse]
$creadList :: ReadS [PutReportDefinitionResponse]
readsPrec :: Int -> ReadS PutReportDefinitionResponse
$creadsPrec :: Int -> ReadS PutReportDefinitionResponse
Prelude.Read, Int -> PutReportDefinitionResponse -> ShowS
[PutReportDefinitionResponse] -> ShowS
PutReportDefinitionResponse -> String
(Int -> PutReportDefinitionResponse -> ShowS)
-> (PutReportDefinitionResponse -> String)
-> ([PutReportDefinitionResponse] -> ShowS)
-> Show PutReportDefinitionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutReportDefinitionResponse] -> ShowS
$cshowList :: [PutReportDefinitionResponse] -> ShowS
show :: PutReportDefinitionResponse -> String
$cshow :: PutReportDefinitionResponse -> String
showsPrec :: Int -> PutReportDefinitionResponse -> ShowS
$cshowsPrec :: Int -> PutReportDefinitionResponse -> ShowS
Prelude.Show, (forall x.
PutReportDefinitionResponse -> Rep PutReportDefinitionResponse x)
-> (forall x.
Rep PutReportDefinitionResponse x -> PutReportDefinitionResponse)
-> Generic PutReportDefinitionResponse
forall x.
Rep PutReportDefinitionResponse x -> PutReportDefinitionResponse
forall x.
PutReportDefinitionResponse -> Rep PutReportDefinitionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutReportDefinitionResponse x -> PutReportDefinitionResponse
$cfrom :: forall x.
PutReportDefinitionResponse -> Rep PutReportDefinitionResponse x
Prelude.Generic)
newPutReportDefinitionResponse ::
Prelude.Int ->
PutReportDefinitionResponse
newPutReportDefinitionResponse :: Int -> PutReportDefinitionResponse
newPutReportDefinitionResponse Int
pHttpStatus_ =
PutReportDefinitionResponse' :: Maybe Text -> Int -> PutReportDefinitionResponse
PutReportDefinitionResponse'
{ $sel:reportId:PutReportDefinitionResponse' :: Maybe Text
reportId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutReportDefinitionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putReportDefinitionResponse_reportId :: Lens.Lens' PutReportDefinitionResponse (Prelude.Maybe Prelude.Text)
putReportDefinitionResponse_reportId :: (Maybe Text -> f (Maybe Text))
-> PutReportDefinitionResponse -> f PutReportDefinitionResponse
putReportDefinitionResponse_reportId = (PutReportDefinitionResponse -> Maybe Text)
-> (PutReportDefinitionResponse
-> Maybe Text -> PutReportDefinitionResponse)
-> Lens
PutReportDefinitionResponse
PutReportDefinitionResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutReportDefinitionResponse' {Maybe Text
reportId :: Maybe Text
$sel:reportId:PutReportDefinitionResponse' :: PutReportDefinitionResponse -> Maybe Text
reportId} -> Maybe Text
reportId) (\s :: PutReportDefinitionResponse
s@PutReportDefinitionResponse' {} Maybe Text
a -> PutReportDefinitionResponse
s {$sel:reportId:PutReportDefinitionResponse' :: Maybe Text
reportId = Maybe Text
a} :: PutReportDefinitionResponse)
putReportDefinitionResponse_httpStatus :: Lens.Lens' PutReportDefinitionResponse Prelude.Int
putReportDefinitionResponse_httpStatus :: (Int -> f Int)
-> PutReportDefinitionResponse -> f PutReportDefinitionResponse
putReportDefinitionResponse_httpStatus = (PutReportDefinitionResponse -> Int)
-> (PutReportDefinitionResponse
-> Int -> PutReportDefinitionResponse)
-> Lens
PutReportDefinitionResponse PutReportDefinitionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutReportDefinitionResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutReportDefinitionResponse' :: PutReportDefinitionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutReportDefinitionResponse
s@PutReportDefinitionResponse' {} Int
a -> PutReportDefinitionResponse
s {$sel:httpStatus:PutReportDefinitionResponse' :: Int
httpStatus = Int
a} :: PutReportDefinitionResponse)
instance Prelude.NFData PutReportDefinitionResponse