{-# 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.Lens as Lens
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
(GetAnomalyGroup -> GetAnomalyGroup -> Bool)
-> (GetAnomalyGroup -> GetAnomalyGroup -> Bool)
-> Eq GetAnomalyGroup
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]
(Int -> ReadS GetAnomalyGroup)
-> ReadS [GetAnomalyGroup]
-> ReadPrec GetAnomalyGroup
-> ReadPrec [GetAnomalyGroup]
-> Read 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
(Int -> GetAnomalyGroup -> ShowS)
-> (GetAnomalyGroup -> String)
-> ([GetAnomalyGroup] -> ShowS)
-> Show GetAnomalyGroup
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. GetAnomalyGroup -> Rep GetAnomalyGroup x)
-> (forall x. Rep GetAnomalyGroup x -> GetAnomalyGroup)
-> Generic GetAnomalyGroup
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' :: Text -> Text -> GetAnomalyGroup
GetAnomalyGroup'
{ $sel:anomalyGroupId:GetAnomalyGroup' :: Text
anomalyGroupId = Text
pAnomalyGroupId_,
$sel:anomalyDetectorArn:GetAnomalyGroup' :: Text
anomalyDetectorArn = Text
pAnomalyDetectorArn_
}
getAnomalyGroup_anomalyGroupId :: Lens.Lens' GetAnomalyGroup Prelude.Text
getAnomalyGroup_anomalyGroupId :: (Text -> f Text) -> GetAnomalyGroup -> f GetAnomalyGroup
getAnomalyGroup_anomalyGroupId = (GetAnomalyGroup -> Text)
-> (GetAnomalyGroup -> Text -> GetAnomalyGroup)
-> Lens GetAnomalyGroup GetAnomalyGroup Text Text
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 :: (Text -> f Text) -> GetAnomalyGroup -> f GetAnomalyGroup
getAnomalyGroup_anomalyDetectorArn = (GetAnomalyGroup -> Text)
-> (GetAnomalyGroup -> Text -> GetAnomalyGroup)
-> Lens GetAnomalyGroup GetAnomalyGroup Text Text
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 :: GetAnomalyGroup -> Request GetAnomalyGroup
request = Service -> GetAnomalyGroup -> Request GetAnomalyGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetAnomalyGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAnomalyGroup)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetAnomalyGroup))
-> Logger
-> Service
-> Proxy GetAnomalyGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAnomalyGroup)))
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 AnomalyGroup -> Int -> GetAnomalyGroupResponse
GetAnomalyGroupResponse'
(Maybe AnomalyGroup -> Int -> GetAnomalyGroupResponse)
-> Either String (Maybe AnomalyGroup)
-> Either String (Int -> GetAnomalyGroupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe AnomalyGroup)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AnomalyGroup")
Either String (Int -> GetAnomalyGroupResponse)
-> Either String Int -> Either String GetAnomalyGroupResponse
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 GetAnomalyGroup
instance Prelude.NFData GetAnomalyGroup
instance Core.ToHeaders GetAnomalyGroup where
toHeaders :: GetAnomalyGroup -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetAnomalyGroup -> 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 GetAnomalyGroup where
toJSON :: GetAnomalyGroup -> Value
toJSON GetAnomalyGroup' {Text
anomalyDetectorArn :: Text
anomalyGroupId :: Text
$sel:anomalyDetectorArn:GetAnomalyGroup' :: GetAnomalyGroup -> Text
$sel:anomalyGroupId:GetAnomalyGroup' :: GetAnomalyGroup -> 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
"AnomalyGroupId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
anomalyGroupId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"AnomalyDetectorArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
anomalyDetectorArn)
]
)
instance Core.ToPath GetAnomalyGroup where
toPath :: GetAnomalyGroup -> ByteString
toPath = ByteString -> GetAnomalyGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/GetAnomalyGroup"
instance Core.ToQuery GetAnomalyGroup where
toQuery :: GetAnomalyGroup -> QueryString
toQuery = QueryString -> GetAnomalyGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetAnomalyGroupResponse -> GetAnomalyGroupResponse -> Bool)
-> (GetAnomalyGroupResponse -> GetAnomalyGroupResponse -> Bool)
-> Eq GetAnomalyGroupResponse
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]
(Int -> ReadS GetAnomalyGroupResponse)
-> ReadS [GetAnomalyGroupResponse]
-> ReadPrec GetAnomalyGroupResponse
-> ReadPrec [GetAnomalyGroupResponse]
-> Read 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
(Int -> GetAnomalyGroupResponse -> ShowS)
-> (GetAnomalyGroupResponse -> String)
-> ([GetAnomalyGroupResponse] -> ShowS)
-> Show GetAnomalyGroupResponse
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.
GetAnomalyGroupResponse -> Rep GetAnomalyGroupResponse x)
-> (forall x.
Rep GetAnomalyGroupResponse x -> GetAnomalyGroupResponse)
-> Generic GetAnomalyGroupResponse
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' :: Maybe AnomalyGroup -> Int -> GetAnomalyGroupResponse
GetAnomalyGroupResponse'
{ $sel:anomalyGroup:GetAnomalyGroupResponse' :: Maybe AnomalyGroup
anomalyGroup =
Maybe AnomalyGroup
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetAnomalyGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getAnomalyGroupResponse_anomalyGroup :: Lens.Lens' GetAnomalyGroupResponse (Prelude.Maybe AnomalyGroup)
getAnomalyGroupResponse_anomalyGroup :: (Maybe AnomalyGroup -> f (Maybe AnomalyGroup))
-> GetAnomalyGroupResponse -> f GetAnomalyGroupResponse
getAnomalyGroupResponse_anomalyGroup = (GetAnomalyGroupResponse -> Maybe AnomalyGroup)
-> (GetAnomalyGroupResponse
-> Maybe AnomalyGroup -> GetAnomalyGroupResponse)
-> Lens
GetAnomalyGroupResponse
GetAnomalyGroupResponse
(Maybe AnomalyGroup)
(Maybe 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 :: (Int -> f Int)
-> GetAnomalyGroupResponse -> f GetAnomalyGroupResponse
getAnomalyGroupResponse_httpStatus = (GetAnomalyGroupResponse -> Int)
-> (GetAnomalyGroupResponse -> Int -> GetAnomalyGroupResponse)
-> Lens GetAnomalyGroupResponse GetAnomalyGroupResponse Int Int
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