{-# 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.ApplicationInsights.DescribeApplication
(
DescribeApplication (..),
newDescribeApplication,
describeApplication_resourceGroupName,
DescribeApplicationResponse (..),
newDescribeApplicationResponse,
describeApplicationResponse_applicationInfo,
describeApplicationResponse_httpStatus,
)
where
import Amazonka.ApplicationInsights.Types
import qualified Amazonka.Core as Core
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 DescribeApplication = DescribeApplication'
{
DescribeApplication -> Text
resourceGroupName :: Prelude.Text
}
deriving (DescribeApplication -> DescribeApplication -> Bool
(DescribeApplication -> DescribeApplication -> Bool)
-> (DescribeApplication -> DescribeApplication -> Bool)
-> Eq DescribeApplication
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeApplication -> DescribeApplication -> Bool
$c/= :: DescribeApplication -> DescribeApplication -> Bool
== :: DescribeApplication -> DescribeApplication -> Bool
$c== :: DescribeApplication -> DescribeApplication -> Bool
Prelude.Eq, ReadPrec [DescribeApplication]
ReadPrec DescribeApplication
Int -> ReadS DescribeApplication
ReadS [DescribeApplication]
(Int -> ReadS DescribeApplication)
-> ReadS [DescribeApplication]
-> ReadPrec DescribeApplication
-> ReadPrec [DescribeApplication]
-> Read DescribeApplication
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeApplication]
$creadListPrec :: ReadPrec [DescribeApplication]
readPrec :: ReadPrec DescribeApplication
$creadPrec :: ReadPrec DescribeApplication
readList :: ReadS [DescribeApplication]
$creadList :: ReadS [DescribeApplication]
readsPrec :: Int -> ReadS DescribeApplication
$creadsPrec :: Int -> ReadS DescribeApplication
Prelude.Read, Int -> DescribeApplication -> ShowS
[DescribeApplication] -> ShowS
DescribeApplication -> String
(Int -> DescribeApplication -> ShowS)
-> (DescribeApplication -> String)
-> ([DescribeApplication] -> ShowS)
-> Show DescribeApplication
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeApplication] -> ShowS
$cshowList :: [DescribeApplication] -> ShowS
show :: DescribeApplication -> String
$cshow :: DescribeApplication -> String
showsPrec :: Int -> DescribeApplication -> ShowS
$cshowsPrec :: Int -> DescribeApplication -> ShowS
Prelude.Show, (forall x. DescribeApplication -> Rep DescribeApplication x)
-> (forall x. Rep DescribeApplication x -> DescribeApplication)
-> Generic DescribeApplication
forall x. Rep DescribeApplication x -> DescribeApplication
forall x. DescribeApplication -> Rep DescribeApplication x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeApplication x -> DescribeApplication
$cfrom :: forall x. DescribeApplication -> Rep DescribeApplication x
Prelude.Generic)
newDescribeApplication ::
Prelude.Text ->
DescribeApplication
newDescribeApplication :: Text -> DescribeApplication
newDescribeApplication Text
pResourceGroupName_ =
DescribeApplication' :: Text -> DescribeApplication
DescribeApplication'
{ $sel:resourceGroupName:DescribeApplication' :: Text
resourceGroupName =
Text
pResourceGroupName_
}
describeApplication_resourceGroupName :: Lens.Lens' DescribeApplication Prelude.Text
describeApplication_resourceGroupName :: (Text -> f Text) -> DescribeApplication -> f DescribeApplication
describeApplication_resourceGroupName = (DescribeApplication -> Text)
-> (DescribeApplication -> Text -> DescribeApplication)
-> Lens DescribeApplication DescribeApplication Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeApplication' {Text
resourceGroupName :: Text
$sel:resourceGroupName:DescribeApplication' :: DescribeApplication -> Text
resourceGroupName} -> Text
resourceGroupName) (\s :: DescribeApplication
s@DescribeApplication' {} Text
a -> DescribeApplication
s {$sel:resourceGroupName:DescribeApplication' :: Text
resourceGroupName = Text
a} :: DescribeApplication)
instance Core.AWSRequest DescribeApplication where
type
AWSResponse DescribeApplication =
DescribeApplicationResponse
request :: DescribeApplication -> Request DescribeApplication
request = Service -> DescribeApplication -> Request DescribeApplication
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeApplication
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeApplication)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeApplication))
-> Logger
-> Service
-> Proxy DescribeApplication
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeApplication)))
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 ApplicationInfo -> Int -> DescribeApplicationResponse
DescribeApplicationResponse'
(Maybe ApplicationInfo -> Int -> DescribeApplicationResponse)
-> Either String (Maybe ApplicationInfo)
-> Either String (Int -> DescribeApplicationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ApplicationInfo)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ApplicationInfo")
Either String (Int -> DescribeApplicationResponse)
-> Either String Int -> Either String DescribeApplicationResponse
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 DescribeApplication
instance Prelude.NFData DescribeApplication
instance Core.ToHeaders DescribeApplication where
toHeaders :: DescribeApplication -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeApplication -> 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
"EC2WindowsBarleyService.DescribeApplication" ::
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 DescribeApplication where
toJSON :: DescribeApplication -> Value
toJSON DescribeApplication' {Text
resourceGroupName :: Text
$sel:resourceGroupName:DescribeApplication' :: DescribeApplication -> 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
"ResourceGroupName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceGroupName)
]
)
instance Core.ToPath DescribeApplication where
toPath :: DescribeApplication -> ByteString
toPath = ByteString -> DescribeApplication -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeApplication where
toQuery :: DescribeApplication -> QueryString
toQuery = QueryString -> DescribeApplication -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeApplicationResponse = DescribeApplicationResponse'
{
DescribeApplicationResponse -> Maybe ApplicationInfo
applicationInfo :: Prelude.Maybe ApplicationInfo,
DescribeApplicationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeApplicationResponse -> DescribeApplicationResponse -> Bool
(DescribeApplicationResponse
-> DescribeApplicationResponse -> Bool)
-> (DescribeApplicationResponse
-> DescribeApplicationResponse -> Bool)
-> Eq DescribeApplicationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeApplicationResponse -> DescribeApplicationResponse -> Bool
$c/= :: DescribeApplicationResponse -> DescribeApplicationResponse -> Bool
== :: DescribeApplicationResponse -> DescribeApplicationResponse -> Bool
$c== :: DescribeApplicationResponse -> DescribeApplicationResponse -> Bool
Prelude.Eq, ReadPrec [DescribeApplicationResponse]
ReadPrec DescribeApplicationResponse
Int -> ReadS DescribeApplicationResponse
ReadS [DescribeApplicationResponse]
(Int -> ReadS DescribeApplicationResponse)
-> ReadS [DescribeApplicationResponse]
-> ReadPrec DescribeApplicationResponse
-> ReadPrec [DescribeApplicationResponse]
-> Read DescribeApplicationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeApplicationResponse]
$creadListPrec :: ReadPrec [DescribeApplicationResponse]
readPrec :: ReadPrec DescribeApplicationResponse
$creadPrec :: ReadPrec DescribeApplicationResponse
readList :: ReadS [DescribeApplicationResponse]
$creadList :: ReadS [DescribeApplicationResponse]
readsPrec :: Int -> ReadS DescribeApplicationResponse
$creadsPrec :: Int -> ReadS DescribeApplicationResponse
Prelude.Read, Int -> DescribeApplicationResponse -> ShowS
[DescribeApplicationResponse] -> ShowS
DescribeApplicationResponse -> String
(Int -> DescribeApplicationResponse -> ShowS)
-> (DescribeApplicationResponse -> String)
-> ([DescribeApplicationResponse] -> ShowS)
-> Show DescribeApplicationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeApplicationResponse] -> ShowS
$cshowList :: [DescribeApplicationResponse] -> ShowS
show :: DescribeApplicationResponse -> String
$cshow :: DescribeApplicationResponse -> String
showsPrec :: Int -> DescribeApplicationResponse -> ShowS
$cshowsPrec :: Int -> DescribeApplicationResponse -> ShowS
Prelude.Show, (forall x.
DescribeApplicationResponse -> Rep DescribeApplicationResponse x)
-> (forall x.
Rep DescribeApplicationResponse x -> DescribeApplicationResponse)
-> Generic DescribeApplicationResponse
forall x.
Rep DescribeApplicationResponse x -> DescribeApplicationResponse
forall x.
DescribeApplicationResponse -> Rep DescribeApplicationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeApplicationResponse x -> DescribeApplicationResponse
$cfrom :: forall x.
DescribeApplicationResponse -> Rep DescribeApplicationResponse x
Prelude.Generic)
newDescribeApplicationResponse ::
Prelude.Int ->
DescribeApplicationResponse
newDescribeApplicationResponse :: Int -> DescribeApplicationResponse
newDescribeApplicationResponse Int
pHttpStatus_ =
DescribeApplicationResponse' :: Maybe ApplicationInfo -> Int -> DescribeApplicationResponse
DescribeApplicationResponse'
{ $sel:applicationInfo:DescribeApplicationResponse' :: Maybe ApplicationInfo
applicationInfo =
Maybe ApplicationInfo
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeApplicationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeApplicationResponse_applicationInfo :: Lens.Lens' DescribeApplicationResponse (Prelude.Maybe ApplicationInfo)
describeApplicationResponse_applicationInfo :: (Maybe ApplicationInfo -> f (Maybe ApplicationInfo))
-> DescribeApplicationResponse -> f DescribeApplicationResponse
describeApplicationResponse_applicationInfo = (DescribeApplicationResponse -> Maybe ApplicationInfo)
-> (DescribeApplicationResponse
-> Maybe ApplicationInfo -> DescribeApplicationResponse)
-> Lens
DescribeApplicationResponse
DescribeApplicationResponse
(Maybe ApplicationInfo)
(Maybe ApplicationInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeApplicationResponse' {Maybe ApplicationInfo
applicationInfo :: Maybe ApplicationInfo
$sel:applicationInfo:DescribeApplicationResponse' :: DescribeApplicationResponse -> Maybe ApplicationInfo
applicationInfo} -> Maybe ApplicationInfo
applicationInfo) (\s :: DescribeApplicationResponse
s@DescribeApplicationResponse' {} Maybe ApplicationInfo
a -> DescribeApplicationResponse
s {$sel:applicationInfo:DescribeApplicationResponse' :: Maybe ApplicationInfo
applicationInfo = Maybe ApplicationInfo
a} :: DescribeApplicationResponse)
describeApplicationResponse_httpStatus :: Lens.Lens' DescribeApplicationResponse Prelude.Int
describeApplicationResponse_httpStatus :: (Int -> f Int)
-> DescribeApplicationResponse -> f DescribeApplicationResponse
describeApplicationResponse_httpStatus = (DescribeApplicationResponse -> Int)
-> (DescribeApplicationResponse
-> Int -> DescribeApplicationResponse)
-> Lens
DescribeApplicationResponse DescribeApplicationResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeApplicationResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeApplicationResponse' :: DescribeApplicationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeApplicationResponse
s@DescribeApplicationResponse' {} Int
a -> DescribeApplicationResponse
s {$sel:httpStatus:DescribeApplicationResponse' :: Int
httpStatus = Int
a} :: DescribeApplicationResponse)
instance Prelude.NFData DescribeApplicationResponse