{-# 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.CreateAnomalyMonitor
(
CreateAnomalyMonitor (..),
newCreateAnomalyMonitor,
createAnomalyMonitor_anomalyMonitor,
CreateAnomalyMonitorResponse (..),
newCreateAnomalyMonitorResponse,
createAnomalyMonitorResponse_httpStatus,
createAnomalyMonitorResponse_monitorArn,
)
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 CreateAnomalyMonitor = CreateAnomalyMonitor'
{
CreateAnomalyMonitor -> AnomalyMonitor
anomalyMonitor :: AnomalyMonitor
}
deriving (CreateAnomalyMonitor -> CreateAnomalyMonitor -> Bool
(CreateAnomalyMonitor -> CreateAnomalyMonitor -> Bool)
-> (CreateAnomalyMonitor -> CreateAnomalyMonitor -> Bool)
-> Eq CreateAnomalyMonitor
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAnomalyMonitor -> CreateAnomalyMonitor -> Bool
$c/= :: CreateAnomalyMonitor -> CreateAnomalyMonitor -> Bool
== :: CreateAnomalyMonitor -> CreateAnomalyMonitor -> Bool
$c== :: CreateAnomalyMonitor -> CreateAnomalyMonitor -> Bool
Prelude.Eq, ReadPrec [CreateAnomalyMonitor]
ReadPrec CreateAnomalyMonitor
Int -> ReadS CreateAnomalyMonitor
ReadS [CreateAnomalyMonitor]
(Int -> ReadS CreateAnomalyMonitor)
-> ReadS [CreateAnomalyMonitor]
-> ReadPrec CreateAnomalyMonitor
-> ReadPrec [CreateAnomalyMonitor]
-> Read CreateAnomalyMonitor
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAnomalyMonitor]
$creadListPrec :: ReadPrec [CreateAnomalyMonitor]
readPrec :: ReadPrec CreateAnomalyMonitor
$creadPrec :: ReadPrec CreateAnomalyMonitor
readList :: ReadS [CreateAnomalyMonitor]
$creadList :: ReadS [CreateAnomalyMonitor]
readsPrec :: Int -> ReadS CreateAnomalyMonitor
$creadsPrec :: Int -> ReadS CreateAnomalyMonitor
Prelude.Read, Int -> CreateAnomalyMonitor -> ShowS
[CreateAnomalyMonitor] -> ShowS
CreateAnomalyMonitor -> String
(Int -> CreateAnomalyMonitor -> ShowS)
-> (CreateAnomalyMonitor -> String)
-> ([CreateAnomalyMonitor] -> ShowS)
-> Show CreateAnomalyMonitor
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAnomalyMonitor] -> ShowS
$cshowList :: [CreateAnomalyMonitor] -> ShowS
show :: CreateAnomalyMonitor -> String
$cshow :: CreateAnomalyMonitor -> String
showsPrec :: Int -> CreateAnomalyMonitor -> ShowS
$cshowsPrec :: Int -> CreateAnomalyMonitor -> ShowS
Prelude.Show, (forall x. CreateAnomalyMonitor -> Rep CreateAnomalyMonitor x)
-> (forall x. Rep CreateAnomalyMonitor x -> CreateAnomalyMonitor)
-> Generic CreateAnomalyMonitor
forall x. Rep CreateAnomalyMonitor x -> CreateAnomalyMonitor
forall x. CreateAnomalyMonitor -> Rep CreateAnomalyMonitor x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAnomalyMonitor x -> CreateAnomalyMonitor
$cfrom :: forall x. CreateAnomalyMonitor -> Rep CreateAnomalyMonitor x
Prelude.Generic)
newCreateAnomalyMonitor ::
AnomalyMonitor ->
CreateAnomalyMonitor
newCreateAnomalyMonitor :: AnomalyMonitor -> CreateAnomalyMonitor
newCreateAnomalyMonitor AnomalyMonitor
pAnomalyMonitor_ =
CreateAnomalyMonitor' :: AnomalyMonitor -> CreateAnomalyMonitor
CreateAnomalyMonitor'
{ $sel:anomalyMonitor:CreateAnomalyMonitor' :: AnomalyMonitor
anomalyMonitor =
AnomalyMonitor
pAnomalyMonitor_
}
createAnomalyMonitor_anomalyMonitor :: Lens.Lens' CreateAnomalyMonitor AnomalyMonitor
createAnomalyMonitor_anomalyMonitor :: (AnomalyMonitor -> f AnomalyMonitor)
-> CreateAnomalyMonitor -> f CreateAnomalyMonitor
createAnomalyMonitor_anomalyMonitor = (CreateAnomalyMonitor -> AnomalyMonitor)
-> (CreateAnomalyMonitor -> AnomalyMonitor -> CreateAnomalyMonitor)
-> Lens
CreateAnomalyMonitor
CreateAnomalyMonitor
AnomalyMonitor
AnomalyMonitor
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAnomalyMonitor' {AnomalyMonitor
anomalyMonitor :: AnomalyMonitor
$sel:anomalyMonitor:CreateAnomalyMonitor' :: CreateAnomalyMonitor -> AnomalyMonitor
anomalyMonitor} -> AnomalyMonitor
anomalyMonitor) (\s :: CreateAnomalyMonitor
s@CreateAnomalyMonitor' {} AnomalyMonitor
a -> CreateAnomalyMonitor
s {$sel:anomalyMonitor:CreateAnomalyMonitor' :: AnomalyMonitor
anomalyMonitor = AnomalyMonitor
a} :: CreateAnomalyMonitor)
instance Core.AWSRequest CreateAnomalyMonitor where
type
AWSResponse CreateAnomalyMonitor =
CreateAnomalyMonitorResponse
request :: CreateAnomalyMonitor -> Request CreateAnomalyMonitor
request = Service -> CreateAnomalyMonitor -> Request CreateAnomalyMonitor
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateAnomalyMonitor
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateAnomalyMonitor)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateAnomalyMonitor))
-> Logger
-> Service
-> Proxy CreateAnomalyMonitor
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateAnomalyMonitor)))
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 -> CreateAnomalyMonitorResponse
CreateAnomalyMonitorResponse'
(Int -> Text -> CreateAnomalyMonitorResponse)
-> Either String Int
-> Either String (Text -> CreateAnomalyMonitorResponse)
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 -> CreateAnomalyMonitorResponse)
-> Either String Text -> Either String CreateAnomalyMonitorResponse
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
"MonitorArn")
)
instance Prelude.Hashable CreateAnomalyMonitor
instance Prelude.NFData CreateAnomalyMonitor
instance Core.ToHeaders CreateAnomalyMonitor where
toHeaders :: CreateAnomalyMonitor -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateAnomalyMonitor -> 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.CreateAnomalyMonitor" ::
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 CreateAnomalyMonitor where
toJSON :: CreateAnomalyMonitor -> Value
toJSON CreateAnomalyMonitor' {AnomalyMonitor
anomalyMonitor :: AnomalyMonitor
$sel:anomalyMonitor:CreateAnomalyMonitor' :: CreateAnomalyMonitor -> AnomalyMonitor
..} =
[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
"AnomalyMonitor" Text -> AnomalyMonitor -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AnomalyMonitor
anomalyMonitor)
]
)
instance Core.ToPath CreateAnomalyMonitor where
toPath :: CreateAnomalyMonitor -> ByteString
toPath = ByteString -> CreateAnomalyMonitor -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateAnomalyMonitor where
toQuery :: CreateAnomalyMonitor -> QueryString
toQuery = QueryString -> CreateAnomalyMonitor -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateAnomalyMonitorResponse = CreateAnomalyMonitorResponse'
{
CreateAnomalyMonitorResponse -> Int
httpStatus :: Prelude.Int,
CreateAnomalyMonitorResponse -> Text
monitorArn :: Prelude.Text
}
deriving (CreateAnomalyMonitorResponse
-> CreateAnomalyMonitorResponse -> Bool
(CreateAnomalyMonitorResponse
-> CreateAnomalyMonitorResponse -> Bool)
-> (CreateAnomalyMonitorResponse
-> CreateAnomalyMonitorResponse -> Bool)
-> Eq CreateAnomalyMonitorResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAnomalyMonitorResponse
-> CreateAnomalyMonitorResponse -> Bool
$c/= :: CreateAnomalyMonitorResponse
-> CreateAnomalyMonitorResponse -> Bool
== :: CreateAnomalyMonitorResponse
-> CreateAnomalyMonitorResponse -> Bool
$c== :: CreateAnomalyMonitorResponse
-> CreateAnomalyMonitorResponse -> Bool
Prelude.Eq, ReadPrec [CreateAnomalyMonitorResponse]
ReadPrec CreateAnomalyMonitorResponse
Int -> ReadS CreateAnomalyMonitorResponse
ReadS [CreateAnomalyMonitorResponse]
(Int -> ReadS CreateAnomalyMonitorResponse)
-> ReadS [CreateAnomalyMonitorResponse]
-> ReadPrec CreateAnomalyMonitorResponse
-> ReadPrec [CreateAnomalyMonitorResponse]
-> Read CreateAnomalyMonitorResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAnomalyMonitorResponse]
$creadListPrec :: ReadPrec [CreateAnomalyMonitorResponse]
readPrec :: ReadPrec CreateAnomalyMonitorResponse
$creadPrec :: ReadPrec CreateAnomalyMonitorResponse
readList :: ReadS [CreateAnomalyMonitorResponse]
$creadList :: ReadS [CreateAnomalyMonitorResponse]
readsPrec :: Int -> ReadS CreateAnomalyMonitorResponse
$creadsPrec :: Int -> ReadS CreateAnomalyMonitorResponse
Prelude.Read, Int -> CreateAnomalyMonitorResponse -> ShowS
[CreateAnomalyMonitorResponse] -> ShowS
CreateAnomalyMonitorResponse -> String
(Int -> CreateAnomalyMonitorResponse -> ShowS)
-> (CreateAnomalyMonitorResponse -> String)
-> ([CreateAnomalyMonitorResponse] -> ShowS)
-> Show CreateAnomalyMonitorResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAnomalyMonitorResponse] -> ShowS
$cshowList :: [CreateAnomalyMonitorResponse] -> ShowS
show :: CreateAnomalyMonitorResponse -> String
$cshow :: CreateAnomalyMonitorResponse -> String
showsPrec :: Int -> CreateAnomalyMonitorResponse -> ShowS
$cshowsPrec :: Int -> CreateAnomalyMonitorResponse -> ShowS
Prelude.Show, (forall x.
CreateAnomalyMonitorResponse -> Rep CreateAnomalyMonitorResponse x)
-> (forall x.
Rep CreateAnomalyMonitorResponse x -> CreateAnomalyMonitorResponse)
-> Generic CreateAnomalyMonitorResponse
forall x.
Rep CreateAnomalyMonitorResponse x -> CreateAnomalyMonitorResponse
forall x.
CreateAnomalyMonitorResponse -> Rep CreateAnomalyMonitorResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateAnomalyMonitorResponse x -> CreateAnomalyMonitorResponse
$cfrom :: forall x.
CreateAnomalyMonitorResponse -> Rep CreateAnomalyMonitorResponse x
Prelude.Generic)
newCreateAnomalyMonitorResponse ::
Prelude.Int ->
Prelude.Text ->
CreateAnomalyMonitorResponse
newCreateAnomalyMonitorResponse :: Int -> Text -> CreateAnomalyMonitorResponse
newCreateAnomalyMonitorResponse
Int
pHttpStatus_
Text
pMonitorArn_ =
CreateAnomalyMonitorResponse' :: Int -> Text -> CreateAnomalyMonitorResponse
CreateAnomalyMonitorResponse'
{ $sel:httpStatus:CreateAnomalyMonitorResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:monitorArn:CreateAnomalyMonitorResponse' :: Text
monitorArn = Text
pMonitorArn_
}
createAnomalyMonitorResponse_httpStatus :: Lens.Lens' CreateAnomalyMonitorResponse Prelude.Int
createAnomalyMonitorResponse_httpStatus :: (Int -> f Int)
-> CreateAnomalyMonitorResponse -> f CreateAnomalyMonitorResponse
createAnomalyMonitorResponse_httpStatus = (CreateAnomalyMonitorResponse -> Int)
-> (CreateAnomalyMonitorResponse
-> Int -> CreateAnomalyMonitorResponse)
-> Lens
CreateAnomalyMonitorResponse CreateAnomalyMonitorResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAnomalyMonitorResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateAnomalyMonitorResponse' :: CreateAnomalyMonitorResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateAnomalyMonitorResponse
s@CreateAnomalyMonitorResponse' {} Int
a -> CreateAnomalyMonitorResponse
s {$sel:httpStatus:CreateAnomalyMonitorResponse' :: Int
httpStatus = Int
a} :: CreateAnomalyMonitorResponse)
createAnomalyMonitorResponse_monitorArn :: Lens.Lens' CreateAnomalyMonitorResponse Prelude.Text
createAnomalyMonitorResponse_monitorArn :: (Text -> f Text)
-> CreateAnomalyMonitorResponse -> f CreateAnomalyMonitorResponse
createAnomalyMonitorResponse_monitorArn = (CreateAnomalyMonitorResponse -> Text)
-> (CreateAnomalyMonitorResponse
-> Text -> CreateAnomalyMonitorResponse)
-> Lens
CreateAnomalyMonitorResponse CreateAnomalyMonitorResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAnomalyMonitorResponse' {Text
monitorArn :: Text
$sel:monitorArn:CreateAnomalyMonitorResponse' :: CreateAnomalyMonitorResponse -> Text
monitorArn} -> Text
monitorArn) (\s :: CreateAnomalyMonitorResponse
s@CreateAnomalyMonitorResponse' {} Text
a -> CreateAnomalyMonitorResponse
s {$sel:monitorArn:CreateAnomalyMonitorResponse' :: Text
monitorArn = Text
a} :: CreateAnomalyMonitorResponse)
instance Prelude.NFData CreateAnomalyMonitorResponse