{-# 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.LookoutMetrics.GetAnomalyGroup
(
GetAnomalyGroup (..),
newGetAnomalyGroup,
getAnomalyGroup_anomalyGroupId,
getAnomalyGroup_anomalyDetectorArn,
GetAnomalyGroupResponse (..),
newGetAnomalyGroupResponse,
getAnomalyGroupResponse_anomalyGroup,
getAnomalyGroupResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LookoutMetrics.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetAnomalyGroup = GetAnomalyGroup'
{
GetAnomalyGroup -> Text
anomalyGroupId :: Prelude.Text,
GetAnomalyGroup -> Text
anomalyDetectorArn :: Prelude.Text
}
deriving (GetAnomalyGroup -> GetAnomalyGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAnomalyGroup -> GetAnomalyGroup -> Bool
$c/= :: GetAnomalyGroup -> GetAnomalyGroup -> Bool
== :: GetAnomalyGroup -> GetAnomalyGroup -> Bool
$c== :: GetAnomalyGroup -> GetAnomalyGroup -> Bool
Prelude.Eq, ReadPrec [GetAnomalyGroup]
ReadPrec GetAnomalyGroup
Int -> ReadS GetAnomalyGroup
ReadS [GetAnomalyGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAnomalyGroup]
$creadListPrec :: ReadPrec [GetAnomalyGroup]
readPrec :: ReadPrec GetAnomalyGroup
$creadPrec :: ReadPrec GetAnomalyGroup
readList :: ReadS [GetAnomalyGroup]
$creadList :: ReadS [GetAnomalyGroup]
readsPrec :: Int -> ReadS GetAnomalyGroup
$creadsPrec :: Int -> ReadS GetAnomalyGroup
Prelude.Read, Int -> GetAnomalyGroup -> ShowS
[GetAnomalyGroup] -> ShowS
GetAnomalyGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAnomalyGroup] -> ShowS
$cshowList :: [GetAnomalyGroup] -> ShowS
show :: GetAnomalyGroup -> String
$cshow :: GetAnomalyGroup -> String
showsPrec :: Int -> GetAnomalyGroup -> ShowS
$cshowsPrec :: Int -> GetAnomalyGroup -> ShowS
Prelude.Show, forall x. Rep GetAnomalyGroup x -> GetAnomalyGroup
forall x. GetAnomalyGroup -> Rep GetAnomalyGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAnomalyGroup x -> GetAnomalyGroup
$cfrom :: forall x. GetAnomalyGroup -> Rep GetAnomalyGroup x
Prelude.Generic)
newGetAnomalyGroup ::
Prelude.Text ->
Prelude.Text ->
GetAnomalyGroup
newGetAnomalyGroup :: Text -> Text -> GetAnomalyGroup
newGetAnomalyGroup
Text
pAnomalyGroupId_
Text
pAnomalyDetectorArn_ =
GetAnomalyGroup'
{ $sel:anomalyGroupId:GetAnomalyGroup' :: Text
anomalyGroupId = Text
pAnomalyGroupId_,
$sel:anomalyDetectorArn:GetAnomalyGroup' :: Text
anomalyDetectorArn = Text
pAnomalyDetectorArn_
}
getAnomalyGroup_anomalyGroupId :: Lens.Lens' GetAnomalyGroup Prelude.Text
getAnomalyGroup_anomalyGroupId :: Lens' GetAnomalyGroup Text
getAnomalyGroup_anomalyGroupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAnomalyGroup' {Text
anomalyGroupId :: Text
$sel:anomalyGroupId:GetAnomalyGroup' :: GetAnomalyGroup -> Text
anomalyGroupId} -> Text
anomalyGroupId) (\s :: GetAnomalyGroup
s@GetAnomalyGroup' {} Text
a -> GetAnomalyGroup
s {$sel:anomalyGroupId:GetAnomalyGroup' :: Text
anomalyGroupId = Text
a} :: GetAnomalyGroup)
getAnomalyGroup_anomalyDetectorArn :: Lens.Lens' GetAnomalyGroup Prelude.Text
getAnomalyGroup_anomalyDetectorArn :: Lens' GetAnomalyGroup Text
getAnomalyGroup_anomalyDetectorArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAnomalyGroup' {Text
anomalyDetectorArn :: Text
$sel:anomalyDetectorArn:GetAnomalyGroup' :: GetAnomalyGroup -> Text
anomalyDetectorArn} -> Text
anomalyDetectorArn) (\s :: GetAnomalyGroup
s@GetAnomalyGroup' {} Text
a -> GetAnomalyGroup
s {$sel:anomalyDetectorArn:GetAnomalyGroup' :: Text
anomalyDetectorArn = Text
a} :: GetAnomalyGroup)
instance Core.AWSRequest GetAnomalyGroup where
type
AWSResponse GetAnomalyGroup =
GetAnomalyGroupResponse
request :: (Service -> Service) -> GetAnomalyGroup -> Request GetAnomalyGroup
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetAnomalyGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAnomalyGroup)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe AnomalyGroup -> Int -> GetAnomalyGroupResponse
GetAnomalyGroupResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"AnomalyGroup")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetAnomalyGroup where
hashWithSalt :: Int -> GetAnomalyGroup -> Int
hashWithSalt Int
_salt GetAnomalyGroup' {Text
anomalyDetectorArn :: Text
anomalyGroupId :: Text
$sel:anomalyDetectorArn:GetAnomalyGroup' :: GetAnomalyGroup -> Text
$sel:anomalyGroupId:GetAnomalyGroup' :: GetAnomalyGroup -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
anomalyGroupId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
anomalyDetectorArn
instance Prelude.NFData GetAnomalyGroup where
rnf :: GetAnomalyGroup -> ()
rnf GetAnomalyGroup' {Text
anomalyDetectorArn :: Text
anomalyGroupId :: Text
$sel:anomalyDetectorArn:GetAnomalyGroup' :: GetAnomalyGroup -> Text
$sel:anomalyGroupId:GetAnomalyGroup' :: GetAnomalyGroup -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
anomalyGroupId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
anomalyDetectorArn
instance Data.ToHeaders GetAnomalyGroup where
toHeaders :: GetAnomalyGroup -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetAnomalyGroup where
toJSON :: GetAnomalyGroup -> Value
toJSON GetAnomalyGroup' {Text
anomalyDetectorArn :: Text
anomalyGroupId :: Text
$sel:anomalyDetectorArn:GetAnomalyGroup' :: GetAnomalyGroup -> Text
$sel:anomalyGroupId:GetAnomalyGroup' :: GetAnomalyGroup -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"AnomalyGroupId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
anomalyGroupId),
forall a. a -> Maybe a
Prelude.Just
(Key
"AnomalyDetectorArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
anomalyDetectorArn)
]
)
instance Data.ToPath GetAnomalyGroup where
toPath :: GetAnomalyGroup -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/GetAnomalyGroup"
instance Data.ToQuery GetAnomalyGroup where
toQuery :: GetAnomalyGroup -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetAnomalyGroupResponse = GetAnomalyGroupResponse'
{
GetAnomalyGroupResponse -> Maybe AnomalyGroup
anomalyGroup :: Prelude.Maybe AnomalyGroup,
GetAnomalyGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetAnomalyGroupResponse -> GetAnomalyGroupResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAnomalyGroupResponse -> GetAnomalyGroupResponse -> Bool
$c/= :: GetAnomalyGroupResponse -> GetAnomalyGroupResponse -> Bool
== :: GetAnomalyGroupResponse -> GetAnomalyGroupResponse -> Bool
$c== :: GetAnomalyGroupResponse -> GetAnomalyGroupResponse -> Bool
Prelude.Eq, ReadPrec [GetAnomalyGroupResponse]
ReadPrec GetAnomalyGroupResponse
Int -> ReadS GetAnomalyGroupResponse
ReadS [GetAnomalyGroupResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAnomalyGroupResponse]
$creadListPrec :: ReadPrec [GetAnomalyGroupResponse]
readPrec :: ReadPrec GetAnomalyGroupResponse
$creadPrec :: ReadPrec GetAnomalyGroupResponse
readList :: ReadS [GetAnomalyGroupResponse]
$creadList :: ReadS [GetAnomalyGroupResponse]
readsPrec :: Int -> ReadS GetAnomalyGroupResponse
$creadsPrec :: Int -> ReadS GetAnomalyGroupResponse
Prelude.Read, Int -> GetAnomalyGroupResponse -> ShowS
[GetAnomalyGroupResponse] -> ShowS
GetAnomalyGroupResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAnomalyGroupResponse] -> ShowS
$cshowList :: [GetAnomalyGroupResponse] -> ShowS
show :: GetAnomalyGroupResponse -> String
$cshow :: GetAnomalyGroupResponse -> String
showsPrec :: Int -> GetAnomalyGroupResponse -> ShowS
$cshowsPrec :: Int -> GetAnomalyGroupResponse -> ShowS
Prelude.Show, forall x. Rep GetAnomalyGroupResponse x -> GetAnomalyGroupResponse
forall x. GetAnomalyGroupResponse -> Rep GetAnomalyGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAnomalyGroupResponse x -> GetAnomalyGroupResponse
$cfrom :: forall x. GetAnomalyGroupResponse -> Rep GetAnomalyGroupResponse x
Prelude.Generic)
newGetAnomalyGroupResponse ::
Prelude.Int ->
GetAnomalyGroupResponse
newGetAnomalyGroupResponse :: Int -> GetAnomalyGroupResponse
newGetAnomalyGroupResponse Int
pHttpStatus_ =
GetAnomalyGroupResponse'
{ $sel:anomalyGroup:GetAnomalyGroupResponse' :: Maybe AnomalyGroup
anomalyGroup =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetAnomalyGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getAnomalyGroupResponse_anomalyGroup :: Lens.Lens' GetAnomalyGroupResponse (Prelude.Maybe AnomalyGroup)
getAnomalyGroupResponse_anomalyGroup :: Lens' GetAnomalyGroupResponse (Maybe AnomalyGroup)
getAnomalyGroupResponse_anomalyGroup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAnomalyGroupResponse' {Maybe AnomalyGroup
anomalyGroup :: Maybe AnomalyGroup
$sel:anomalyGroup:GetAnomalyGroupResponse' :: GetAnomalyGroupResponse -> Maybe AnomalyGroup
anomalyGroup} -> Maybe AnomalyGroup
anomalyGroup) (\s :: GetAnomalyGroupResponse
s@GetAnomalyGroupResponse' {} Maybe AnomalyGroup
a -> GetAnomalyGroupResponse
s {$sel:anomalyGroup:GetAnomalyGroupResponse' :: Maybe AnomalyGroup
anomalyGroup = Maybe AnomalyGroup
a} :: GetAnomalyGroupResponse)
getAnomalyGroupResponse_httpStatus :: Lens.Lens' GetAnomalyGroupResponse Prelude.Int
getAnomalyGroupResponse_httpStatus :: Lens' GetAnomalyGroupResponse Int
getAnomalyGroupResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAnomalyGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetAnomalyGroupResponse' :: GetAnomalyGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetAnomalyGroupResponse
s@GetAnomalyGroupResponse' {} Int
a -> GetAnomalyGroupResponse
s {$sel:httpStatus:GetAnomalyGroupResponse' :: Int
httpStatus = Int
a} :: GetAnomalyGroupResponse)
instance Prelude.NFData GetAnomalyGroupResponse where
rnf :: GetAnomalyGroupResponse -> ()
rnf GetAnomalyGroupResponse' {Int
Maybe AnomalyGroup
httpStatus :: Int
anomalyGroup :: Maybe AnomalyGroup
$sel:httpStatus:GetAnomalyGroupResponse' :: GetAnomalyGroupResponse -> Int
$sel:anomalyGroup:GetAnomalyGroupResponse' :: GetAnomalyGroupResponse -> Maybe AnomalyGroup
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe AnomalyGroup
anomalyGroup
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus