{-# 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.DevOpsGuru.DescribeInsight
(
DescribeInsight (..),
newDescribeInsight,
describeInsight_id,
DescribeInsightResponse (..),
newDescribeInsightResponse,
describeInsightResponse_proactiveInsight,
describeInsightResponse_reactiveInsight,
describeInsightResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DevOpsGuru.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 DescribeInsight = DescribeInsight'
{
DescribeInsight -> Text
id :: Prelude.Text
}
deriving (DescribeInsight -> DescribeInsight -> Bool
(DescribeInsight -> DescribeInsight -> Bool)
-> (DescribeInsight -> DescribeInsight -> Bool)
-> Eq DescribeInsight
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeInsight -> DescribeInsight -> Bool
$c/= :: DescribeInsight -> DescribeInsight -> Bool
== :: DescribeInsight -> DescribeInsight -> Bool
$c== :: DescribeInsight -> DescribeInsight -> Bool
Prelude.Eq, ReadPrec [DescribeInsight]
ReadPrec DescribeInsight
Int -> ReadS DescribeInsight
ReadS [DescribeInsight]
(Int -> ReadS DescribeInsight)
-> ReadS [DescribeInsight]
-> ReadPrec DescribeInsight
-> ReadPrec [DescribeInsight]
-> Read DescribeInsight
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeInsight]
$creadListPrec :: ReadPrec [DescribeInsight]
readPrec :: ReadPrec DescribeInsight
$creadPrec :: ReadPrec DescribeInsight
readList :: ReadS [DescribeInsight]
$creadList :: ReadS [DescribeInsight]
readsPrec :: Int -> ReadS DescribeInsight
$creadsPrec :: Int -> ReadS DescribeInsight
Prelude.Read, Int -> DescribeInsight -> ShowS
[DescribeInsight] -> ShowS
DescribeInsight -> String
(Int -> DescribeInsight -> ShowS)
-> (DescribeInsight -> String)
-> ([DescribeInsight] -> ShowS)
-> Show DescribeInsight
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeInsight] -> ShowS
$cshowList :: [DescribeInsight] -> ShowS
show :: DescribeInsight -> String
$cshow :: DescribeInsight -> String
showsPrec :: Int -> DescribeInsight -> ShowS
$cshowsPrec :: Int -> DescribeInsight -> ShowS
Prelude.Show, (forall x. DescribeInsight -> Rep DescribeInsight x)
-> (forall x. Rep DescribeInsight x -> DescribeInsight)
-> Generic DescribeInsight
forall x. Rep DescribeInsight x -> DescribeInsight
forall x. DescribeInsight -> Rep DescribeInsight x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeInsight x -> DescribeInsight
$cfrom :: forall x. DescribeInsight -> Rep DescribeInsight x
Prelude.Generic)
newDescribeInsight ::
Prelude.Text ->
DescribeInsight
newDescribeInsight :: Text -> DescribeInsight
newDescribeInsight Text
pId_ = DescribeInsight' :: Text -> DescribeInsight
DescribeInsight' {$sel:id:DescribeInsight' :: Text
id = Text
pId_}
describeInsight_id :: Lens.Lens' DescribeInsight Prelude.Text
describeInsight_id :: (Text -> f Text) -> DescribeInsight -> f DescribeInsight
describeInsight_id = (DescribeInsight -> Text)
-> (DescribeInsight -> Text -> DescribeInsight)
-> Lens DescribeInsight DescribeInsight Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInsight' {Text
id :: Text
$sel:id:DescribeInsight' :: DescribeInsight -> Text
id} -> Text
id) (\s :: DescribeInsight
s@DescribeInsight' {} Text
a -> DescribeInsight
s {$sel:id:DescribeInsight' :: Text
id = Text
a} :: DescribeInsight)
instance Core.AWSRequest DescribeInsight where
type
AWSResponse DescribeInsight =
DescribeInsightResponse
request :: DescribeInsight -> Request DescribeInsight
request = Service -> DescribeInsight -> Request DescribeInsight
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeInsight
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeInsight)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeInsight))
-> Logger
-> Service
-> Proxy DescribeInsight
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeInsight)))
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 ProactiveInsight
-> Maybe ReactiveInsight -> Int -> DescribeInsightResponse
DescribeInsightResponse'
(Maybe ProactiveInsight
-> Maybe ReactiveInsight -> Int -> DescribeInsightResponse)
-> Either String (Maybe ProactiveInsight)
-> Either
String (Maybe ReactiveInsight -> Int -> DescribeInsightResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ProactiveInsight)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ProactiveInsight")
Either
String (Maybe ReactiveInsight -> Int -> DescribeInsightResponse)
-> Either String (Maybe ReactiveInsight)
-> Either String (Int -> DescribeInsightResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe ReactiveInsight)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ReactiveInsight")
Either String (Int -> DescribeInsightResponse)
-> Either String Int -> Either String DescribeInsightResponse
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 DescribeInsight
instance Prelude.NFData DescribeInsight
instance Core.ToHeaders DescribeInsight where
toHeaders :: DescribeInsight -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeInsight -> 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.ToPath DescribeInsight where
toPath :: DescribeInsight -> ByteString
toPath DescribeInsight' {Text
id :: Text
$sel:id:DescribeInsight' :: DescribeInsight -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/insights/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
id]
instance Core.ToQuery DescribeInsight where
toQuery :: DescribeInsight -> QueryString
toQuery = QueryString -> DescribeInsight -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeInsightResponse = DescribeInsightResponse'
{
DescribeInsightResponse -> Maybe ProactiveInsight
proactiveInsight :: Prelude.Maybe ProactiveInsight,
DescribeInsightResponse -> Maybe ReactiveInsight
reactiveInsight :: Prelude.Maybe ReactiveInsight,
DescribeInsightResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeInsightResponse -> DescribeInsightResponse -> Bool
(DescribeInsightResponse -> DescribeInsightResponse -> Bool)
-> (DescribeInsightResponse -> DescribeInsightResponse -> Bool)
-> Eq DescribeInsightResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeInsightResponse -> DescribeInsightResponse -> Bool
$c/= :: DescribeInsightResponse -> DescribeInsightResponse -> Bool
== :: DescribeInsightResponse -> DescribeInsightResponse -> Bool
$c== :: DescribeInsightResponse -> DescribeInsightResponse -> Bool
Prelude.Eq, ReadPrec [DescribeInsightResponse]
ReadPrec DescribeInsightResponse
Int -> ReadS DescribeInsightResponse
ReadS [DescribeInsightResponse]
(Int -> ReadS DescribeInsightResponse)
-> ReadS [DescribeInsightResponse]
-> ReadPrec DescribeInsightResponse
-> ReadPrec [DescribeInsightResponse]
-> Read DescribeInsightResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeInsightResponse]
$creadListPrec :: ReadPrec [DescribeInsightResponse]
readPrec :: ReadPrec DescribeInsightResponse
$creadPrec :: ReadPrec DescribeInsightResponse
readList :: ReadS [DescribeInsightResponse]
$creadList :: ReadS [DescribeInsightResponse]
readsPrec :: Int -> ReadS DescribeInsightResponse
$creadsPrec :: Int -> ReadS DescribeInsightResponse
Prelude.Read, Int -> DescribeInsightResponse -> ShowS
[DescribeInsightResponse] -> ShowS
DescribeInsightResponse -> String
(Int -> DescribeInsightResponse -> ShowS)
-> (DescribeInsightResponse -> String)
-> ([DescribeInsightResponse] -> ShowS)
-> Show DescribeInsightResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeInsightResponse] -> ShowS
$cshowList :: [DescribeInsightResponse] -> ShowS
show :: DescribeInsightResponse -> String
$cshow :: DescribeInsightResponse -> String
showsPrec :: Int -> DescribeInsightResponse -> ShowS
$cshowsPrec :: Int -> DescribeInsightResponse -> ShowS
Prelude.Show, (forall x.
DescribeInsightResponse -> Rep DescribeInsightResponse x)
-> (forall x.
Rep DescribeInsightResponse x -> DescribeInsightResponse)
-> Generic DescribeInsightResponse
forall x. Rep DescribeInsightResponse x -> DescribeInsightResponse
forall x. DescribeInsightResponse -> Rep DescribeInsightResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeInsightResponse x -> DescribeInsightResponse
$cfrom :: forall x. DescribeInsightResponse -> Rep DescribeInsightResponse x
Prelude.Generic)
newDescribeInsightResponse ::
Prelude.Int ->
DescribeInsightResponse
newDescribeInsightResponse :: Int -> DescribeInsightResponse
newDescribeInsightResponse Int
pHttpStatus_ =
DescribeInsightResponse' :: Maybe ProactiveInsight
-> Maybe ReactiveInsight -> Int -> DescribeInsightResponse
DescribeInsightResponse'
{ $sel:proactiveInsight:DescribeInsightResponse' :: Maybe ProactiveInsight
proactiveInsight =
Maybe ProactiveInsight
forall a. Maybe a
Prelude.Nothing,
$sel:reactiveInsight:DescribeInsightResponse' :: Maybe ReactiveInsight
reactiveInsight = Maybe ReactiveInsight
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeInsightResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeInsightResponse_proactiveInsight :: Lens.Lens' DescribeInsightResponse (Prelude.Maybe ProactiveInsight)
describeInsightResponse_proactiveInsight :: (Maybe ProactiveInsight -> f (Maybe ProactiveInsight))
-> DescribeInsightResponse -> f DescribeInsightResponse
describeInsightResponse_proactiveInsight = (DescribeInsightResponse -> Maybe ProactiveInsight)
-> (DescribeInsightResponse
-> Maybe ProactiveInsight -> DescribeInsightResponse)
-> Lens
DescribeInsightResponse
DescribeInsightResponse
(Maybe ProactiveInsight)
(Maybe ProactiveInsight)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInsightResponse' {Maybe ProactiveInsight
proactiveInsight :: Maybe ProactiveInsight
$sel:proactiveInsight:DescribeInsightResponse' :: DescribeInsightResponse -> Maybe ProactiveInsight
proactiveInsight} -> Maybe ProactiveInsight
proactiveInsight) (\s :: DescribeInsightResponse
s@DescribeInsightResponse' {} Maybe ProactiveInsight
a -> DescribeInsightResponse
s {$sel:proactiveInsight:DescribeInsightResponse' :: Maybe ProactiveInsight
proactiveInsight = Maybe ProactiveInsight
a} :: DescribeInsightResponse)
describeInsightResponse_reactiveInsight :: Lens.Lens' DescribeInsightResponse (Prelude.Maybe ReactiveInsight)
describeInsightResponse_reactiveInsight :: (Maybe ReactiveInsight -> f (Maybe ReactiveInsight))
-> DescribeInsightResponse -> f DescribeInsightResponse
describeInsightResponse_reactiveInsight = (DescribeInsightResponse -> Maybe ReactiveInsight)
-> (DescribeInsightResponse
-> Maybe ReactiveInsight -> DescribeInsightResponse)
-> Lens
DescribeInsightResponse
DescribeInsightResponse
(Maybe ReactiveInsight)
(Maybe ReactiveInsight)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInsightResponse' {Maybe ReactiveInsight
reactiveInsight :: Maybe ReactiveInsight
$sel:reactiveInsight:DescribeInsightResponse' :: DescribeInsightResponse -> Maybe ReactiveInsight
reactiveInsight} -> Maybe ReactiveInsight
reactiveInsight) (\s :: DescribeInsightResponse
s@DescribeInsightResponse' {} Maybe ReactiveInsight
a -> DescribeInsightResponse
s {$sel:reactiveInsight:DescribeInsightResponse' :: Maybe ReactiveInsight
reactiveInsight = Maybe ReactiveInsight
a} :: DescribeInsightResponse)
describeInsightResponse_httpStatus :: Lens.Lens' DescribeInsightResponse Prelude.Int
describeInsightResponse_httpStatus :: (Int -> f Int)
-> DescribeInsightResponse -> f DescribeInsightResponse
describeInsightResponse_httpStatus = (DescribeInsightResponse -> Int)
-> (DescribeInsightResponse -> Int -> DescribeInsightResponse)
-> Lens DescribeInsightResponse DescribeInsightResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInsightResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeInsightResponse' :: DescribeInsightResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeInsightResponse
s@DescribeInsightResponse' {} Int
a -> DescribeInsightResponse
s {$sel:httpStatus:DescribeInsightResponse' :: Int
httpStatus = Int
a} :: DescribeInsightResponse)
instance Prelude.NFData DescribeInsightResponse