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