{-# 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.ImportApplicationUsage
(
ImportApplicationUsage (..),
newImportApplicationUsage,
importApplicationUsage_sourceS3Location,
ImportApplicationUsageResponse (..),
newImportApplicationUsageResponse,
importApplicationUsageResponse_httpStatus,
importApplicationUsageResponse_importId,
)
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 ImportApplicationUsage = ImportApplicationUsage'
{
ImportApplicationUsage -> SourceS3Location
sourceS3Location :: SourceS3Location
}
deriving (ImportApplicationUsage -> ImportApplicationUsage -> Bool
(ImportApplicationUsage -> ImportApplicationUsage -> Bool)
-> (ImportApplicationUsage -> ImportApplicationUsage -> Bool)
-> Eq ImportApplicationUsage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportApplicationUsage -> ImportApplicationUsage -> Bool
$c/= :: ImportApplicationUsage -> ImportApplicationUsage -> Bool
== :: ImportApplicationUsage -> ImportApplicationUsage -> Bool
$c== :: ImportApplicationUsage -> ImportApplicationUsage -> Bool
Prelude.Eq, ReadPrec [ImportApplicationUsage]
ReadPrec ImportApplicationUsage
Int -> ReadS ImportApplicationUsage
ReadS [ImportApplicationUsage]
(Int -> ReadS ImportApplicationUsage)
-> ReadS [ImportApplicationUsage]
-> ReadPrec ImportApplicationUsage
-> ReadPrec [ImportApplicationUsage]
-> Read ImportApplicationUsage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImportApplicationUsage]
$creadListPrec :: ReadPrec [ImportApplicationUsage]
readPrec :: ReadPrec ImportApplicationUsage
$creadPrec :: ReadPrec ImportApplicationUsage
readList :: ReadS [ImportApplicationUsage]
$creadList :: ReadS [ImportApplicationUsage]
readsPrec :: Int -> ReadS ImportApplicationUsage
$creadsPrec :: Int -> ReadS ImportApplicationUsage
Prelude.Read, Int -> ImportApplicationUsage -> ShowS
[ImportApplicationUsage] -> ShowS
ImportApplicationUsage -> String
(Int -> ImportApplicationUsage -> ShowS)
-> (ImportApplicationUsage -> String)
-> ([ImportApplicationUsage] -> ShowS)
-> Show ImportApplicationUsage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportApplicationUsage] -> ShowS
$cshowList :: [ImportApplicationUsage] -> ShowS
show :: ImportApplicationUsage -> String
$cshow :: ImportApplicationUsage -> String
showsPrec :: Int -> ImportApplicationUsage -> ShowS
$cshowsPrec :: Int -> ImportApplicationUsage -> ShowS
Prelude.Show, (forall x. ImportApplicationUsage -> Rep ImportApplicationUsage x)
-> (forall x.
Rep ImportApplicationUsage x -> ImportApplicationUsage)
-> Generic ImportApplicationUsage
forall x. Rep ImportApplicationUsage x -> ImportApplicationUsage
forall x. ImportApplicationUsage -> Rep ImportApplicationUsage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImportApplicationUsage x -> ImportApplicationUsage
$cfrom :: forall x. ImportApplicationUsage -> Rep ImportApplicationUsage x
Prelude.Generic)
newImportApplicationUsage ::
SourceS3Location ->
ImportApplicationUsage
newImportApplicationUsage :: SourceS3Location -> ImportApplicationUsage
newImportApplicationUsage SourceS3Location
pSourceS3Location_ =
ImportApplicationUsage' :: SourceS3Location -> ImportApplicationUsage
ImportApplicationUsage'
{ $sel:sourceS3Location:ImportApplicationUsage' :: SourceS3Location
sourceS3Location =
SourceS3Location
pSourceS3Location_
}
importApplicationUsage_sourceS3Location :: Lens.Lens' ImportApplicationUsage SourceS3Location
importApplicationUsage_sourceS3Location :: (SourceS3Location -> f SourceS3Location)
-> ImportApplicationUsage -> f ImportApplicationUsage
importApplicationUsage_sourceS3Location = (ImportApplicationUsage -> SourceS3Location)
-> (ImportApplicationUsage
-> SourceS3Location -> ImportApplicationUsage)
-> Lens
ImportApplicationUsage
ImportApplicationUsage
SourceS3Location
SourceS3Location
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportApplicationUsage' {SourceS3Location
sourceS3Location :: SourceS3Location
$sel:sourceS3Location:ImportApplicationUsage' :: ImportApplicationUsage -> SourceS3Location
sourceS3Location} -> SourceS3Location
sourceS3Location) (\s :: ImportApplicationUsage
s@ImportApplicationUsage' {} SourceS3Location
a -> ImportApplicationUsage
s {$sel:sourceS3Location:ImportApplicationUsage' :: SourceS3Location
sourceS3Location = SourceS3Location
a} :: ImportApplicationUsage)
instance Core.AWSRequest ImportApplicationUsage where
type
AWSResponse ImportApplicationUsage =
ImportApplicationUsageResponse
request :: ImportApplicationUsage -> Request ImportApplicationUsage
request = Service -> ImportApplicationUsage -> Request ImportApplicationUsage
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ImportApplicationUsage
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ImportApplicationUsage)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ImportApplicationUsage))
-> Logger
-> Service
-> Proxy ImportApplicationUsage
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ImportApplicationUsage)))
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 ->
Int -> Text -> ImportApplicationUsageResponse
ImportApplicationUsageResponse'
(Int -> Text -> ImportApplicationUsageResponse)
-> Either String Int
-> Either String (Text -> ImportApplicationUsageResponse)
forall (f :: * -> *) a b. Functor 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))
Either String (Text -> ImportApplicationUsageResponse)
-> Either String Text
-> Either String ImportApplicationUsageResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"importId")
)
instance Prelude.Hashable ImportApplicationUsage
instance Prelude.NFData ImportApplicationUsage
instance Core.ToHeaders ImportApplicationUsage where
toHeaders :: ImportApplicationUsage -> ResponseHeaders
toHeaders =
ResponseHeaders -> ImportApplicationUsage -> 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 ImportApplicationUsage where
toJSON :: ImportApplicationUsage -> Value
toJSON ImportApplicationUsage' {SourceS3Location
sourceS3Location :: SourceS3Location
$sel:sourceS3Location:ImportApplicationUsage' :: ImportApplicationUsage -> SourceS3Location
..} =
[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
"sourceS3Location" Text -> SourceS3Location -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SourceS3Location
sourceS3Location)
]
)
instance Core.ToPath ImportApplicationUsage where
toPath :: ImportApplicationUsage -> ByteString
toPath = ByteString -> ImportApplicationUsage -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/importApplicationUsage"
instance Core.ToQuery ImportApplicationUsage where
toQuery :: ImportApplicationUsage -> QueryString
toQuery = QueryString -> ImportApplicationUsage -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ImportApplicationUsageResponse = ImportApplicationUsageResponse'
{
ImportApplicationUsageResponse -> Int
httpStatus :: Prelude.Int,
ImportApplicationUsageResponse -> Text
importId :: Prelude.Text
}
deriving (ImportApplicationUsageResponse
-> ImportApplicationUsageResponse -> Bool
(ImportApplicationUsageResponse
-> ImportApplicationUsageResponse -> Bool)
-> (ImportApplicationUsageResponse
-> ImportApplicationUsageResponse -> Bool)
-> Eq ImportApplicationUsageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportApplicationUsageResponse
-> ImportApplicationUsageResponse -> Bool
$c/= :: ImportApplicationUsageResponse
-> ImportApplicationUsageResponse -> Bool
== :: ImportApplicationUsageResponse
-> ImportApplicationUsageResponse -> Bool
$c== :: ImportApplicationUsageResponse
-> ImportApplicationUsageResponse -> Bool
Prelude.Eq, ReadPrec [ImportApplicationUsageResponse]
ReadPrec ImportApplicationUsageResponse
Int -> ReadS ImportApplicationUsageResponse
ReadS [ImportApplicationUsageResponse]
(Int -> ReadS ImportApplicationUsageResponse)
-> ReadS [ImportApplicationUsageResponse]
-> ReadPrec ImportApplicationUsageResponse
-> ReadPrec [ImportApplicationUsageResponse]
-> Read ImportApplicationUsageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImportApplicationUsageResponse]
$creadListPrec :: ReadPrec [ImportApplicationUsageResponse]
readPrec :: ReadPrec ImportApplicationUsageResponse
$creadPrec :: ReadPrec ImportApplicationUsageResponse
readList :: ReadS [ImportApplicationUsageResponse]
$creadList :: ReadS [ImportApplicationUsageResponse]
readsPrec :: Int -> ReadS ImportApplicationUsageResponse
$creadsPrec :: Int -> ReadS ImportApplicationUsageResponse
Prelude.Read, Int -> ImportApplicationUsageResponse -> ShowS
[ImportApplicationUsageResponse] -> ShowS
ImportApplicationUsageResponse -> String
(Int -> ImportApplicationUsageResponse -> ShowS)
-> (ImportApplicationUsageResponse -> String)
-> ([ImportApplicationUsageResponse] -> ShowS)
-> Show ImportApplicationUsageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportApplicationUsageResponse] -> ShowS
$cshowList :: [ImportApplicationUsageResponse] -> ShowS
show :: ImportApplicationUsageResponse -> String
$cshow :: ImportApplicationUsageResponse -> String
showsPrec :: Int -> ImportApplicationUsageResponse -> ShowS
$cshowsPrec :: Int -> ImportApplicationUsageResponse -> ShowS
Prelude.Show, (forall x.
ImportApplicationUsageResponse
-> Rep ImportApplicationUsageResponse x)
-> (forall x.
Rep ImportApplicationUsageResponse x
-> ImportApplicationUsageResponse)
-> Generic ImportApplicationUsageResponse
forall x.
Rep ImportApplicationUsageResponse x
-> ImportApplicationUsageResponse
forall x.
ImportApplicationUsageResponse
-> Rep ImportApplicationUsageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ImportApplicationUsageResponse x
-> ImportApplicationUsageResponse
$cfrom :: forall x.
ImportApplicationUsageResponse
-> Rep ImportApplicationUsageResponse x
Prelude.Generic)
newImportApplicationUsageResponse ::
Prelude.Int ->
Prelude.Text ->
ImportApplicationUsageResponse
newImportApplicationUsageResponse :: Int -> Text -> ImportApplicationUsageResponse
newImportApplicationUsageResponse
Int
pHttpStatus_
Text
pImportId_ =
ImportApplicationUsageResponse' :: Int -> Text -> ImportApplicationUsageResponse
ImportApplicationUsageResponse'
{ $sel:httpStatus:ImportApplicationUsageResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:importId:ImportApplicationUsageResponse' :: Text
importId = Text
pImportId_
}
importApplicationUsageResponse_httpStatus :: Lens.Lens' ImportApplicationUsageResponse Prelude.Int
importApplicationUsageResponse_httpStatus :: (Int -> f Int)
-> ImportApplicationUsageResponse
-> f ImportApplicationUsageResponse
importApplicationUsageResponse_httpStatus = (ImportApplicationUsageResponse -> Int)
-> (ImportApplicationUsageResponse
-> Int -> ImportApplicationUsageResponse)
-> Lens
ImportApplicationUsageResponse
ImportApplicationUsageResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportApplicationUsageResponse' {Int
httpStatus :: Int
$sel:httpStatus:ImportApplicationUsageResponse' :: ImportApplicationUsageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ImportApplicationUsageResponse
s@ImportApplicationUsageResponse' {} Int
a -> ImportApplicationUsageResponse
s {$sel:httpStatus:ImportApplicationUsageResponse' :: Int
httpStatus = Int
a} :: ImportApplicationUsageResponse)
importApplicationUsageResponse_importId :: Lens.Lens' ImportApplicationUsageResponse Prelude.Text
importApplicationUsageResponse_importId :: (Text -> f Text)
-> ImportApplicationUsageResponse
-> f ImportApplicationUsageResponse
importApplicationUsageResponse_importId = (ImportApplicationUsageResponse -> Text)
-> (ImportApplicationUsageResponse
-> Text -> ImportApplicationUsageResponse)
-> Lens
ImportApplicationUsageResponse
ImportApplicationUsageResponse
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportApplicationUsageResponse' {Text
importId :: Text
$sel:importId:ImportApplicationUsageResponse' :: ImportApplicationUsageResponse -> Text
importId} -> Text
importId) (\s :: ImportApplicationUsageResponse
s@ImportApplicationUsageResponse' {} Text
a -> ImportApplicationUsageResponse
s {$sel:importId:ImportApplicationUsageResponse' :: Text
importId = Text
a} :: ImportApplicationUsageResponse)
instance
Prelude.NFData
ImportApplicationUsageResponse