{-# 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.CloudWatch.GetDashboard
(
GetDashboard (..),
newGetDashboard,
getDashboard_dashboardName,
GetDashboardResponse (..),
newGetDashboardResponse,
getDashboardResponse_dashboardName,
getDashboardResponse_dashboardBody,
getDashboardResponse_dashboardArn,
getDashboardResponse_httpStatus,
)
where
import Amazonka.CloudWatch.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 GetDashboard = GetDashboard'
{
GetDashboard -> Text
dashboardName :: Prelude.Text
}
deriving (GetDashboard -> GetDashboard -> Bool
(GetDashboard -> GetDashboard -> Bool)
-> (GetDashboard -> GetDashboard -> Bool) -> Eq GetDashboard
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDashboard -> GetDashboard -> Bool
$c/= :: GetDashboard -> GetDashboard -> Bool
== :: GetDashboard -> GetDashboard -> Bool
$c== :: GetDashboard -> GetDashboard -> Bool
Prelude.Eq, ReadPrec [GetDashboard]
ReadPrec GetDashboard
Int -> ReadS GetDashboard
ReadS [GetDashboard]
(Int -> ReadS GetDashboard)
-> ReadS [GetDashboard]
-> ReadPrec GetDashboard
-> ReadPrec [GetDashboard]
-> Read GetDashboard
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDashboard]
$creadListPrec :: ReadPrec [GetDashboard]
readPrec :: ReadPrec GetDashboard
$creadPrec :: ReadPrec GetDashboard
readList :: ReadS [GetDashboard]
$creadList :: ReadS [GetDashboard]
readsPrec :: Int -> ReadS GetDashboard
$creadsPrec :: Int -> ReadS GetDashboard
Prelude.Read, Int -> GetDashboard -> ShowS
[GetDashboard] -> ShowS
GetDashboard -> String
(Int -> GetDashboard -> ShowS)
-> (GetDashboard -> String)
-> ([GetDashboard] -> ShowS)
-> Show GetDashboard
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDashboard] -> ShowS
$cshowList :: [GetDashboard] -> ShowS
show :: GetDashboard -> String
$cshow :: GetDashboard -> String
showsPrec :: Int -> GetDashboard -> ShowS
$cshowsPrec :: Int -> GetDashboard -> ShowS
Prelude.Show, (forall x. GetDashboard -> Rep GetDashboard x)
-> (forall x. Rep GetDashboard x -> GetDashboard)
-> Generic GetDashboard
forall x. Rep GetDashboard x -> GetDashboard
forall x. GetDashboard -> Rep GetDashboard x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDashboard x -> GetDashboard
$cfrom :: forall x. GetDashboard -> Rep GetDashboard x
Prelude.Generic)
newGetDashboard ::
Prelude.Text ->
GetDashboard
newGetDashboard :: Text -> GetDashboard
newGetDashboard Text
pDashboardName_ =
GetDashboard' :: Text -> GetDashboard
GetDashboard' {$sel:dashboardName:GetDashboard' :: Text
dashboardName = Text
pDashboardName_}
getDashboard_dashboardName :: Lens.Lens' GetDashboard Prelude.Text
getDashboard_dashboardName :: (Text -> f Text) -> GetDashboard -> f GetDashboard
getDashboard_dashboardName = (GetDashboard -> Text)
-> (GetDashboard -> Text -> GetDashboard)
-> Lens GetDashboard GetDashboard Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDashboard' {Text
dashboardName :: Text
$sel:dashboardName:GetDashboard' :: GetDashboard -> Text
dashboardName} -> Text
dashboardName) (\s :: GetDashboard
s@GetDashboard' {} Text
a -> GetDashboard
s {$sel:dashboardName:GetDashboard' :: Text
dashboardName = Text
a} :: GetDashboard)
instance Core.AWSRequest GetDashboard where
type AWSResponse GetDashboard = GetDashboardResponse
request :: GetDashboard -> Request GetDashboard
request = Service -> GetDashboard -> Request GetDashboard
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy GetDashboard
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDashboard)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetDashboard))
-> Logger
-> Service
-> Proxy GetDashboard
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDashboard)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"GetDashboardResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Text
-> Maybe Text -> Maybe Text -> Int -> GetDashboardResponse
GetDashboardResponse'
(Maybe Text
-> Maybe Text -> Maybe Text -> Int -> GetDashboardResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe Text -> Maybe Text -> Int -> GetDashboardResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DashboardName")
Either
String (Maybe Text -> Maybe Text -> Int -> GetDashboardResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> GetDashboardResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DashboardBody")
Either String (Maybe Text -> Int -> GetDashboardResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetDashboardResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DashboardArn")
Either String (Int -> GetDashboardResponse)
-> Either String Int -> Either String GetDashboardResponse
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 GetDashboard
instance Prelude.NFData GetDashboard
instance Core.ToHeaders GetDashboard where
toHeaders :: GetDashboard -> ResponseHeaders
toHeaders = ResponseHeaders -> GetDashboard -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetDashboard where
toPath :: GetDashboard -> ByteString
toPath = ByteString -> GetDashboard -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetDashboard where
toQuery :: GetDashboard -> QueryString
toQuery GetDashboard' {Text
dashboardName :: Text
$sel:dashboardName:GetDashboard' :: GetDashboard -> Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"GetDashboard" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-08-01" :: Prelude.ByteString),
ByteString
"DashboardName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dashboardName
]
data GetDashboardResponse = GetDashboardResponse'
{
GetDashboardResponse -> Maybe Text
dashboardName :: Prelude.Maybe Prelude.Text,
GetDashboardResponse -> Maybe Text
dashboardBody :: Prelude.Maybe Prelude.Text,
GetDashboardResponse -> Maybe Text
dashboardArn :: Prelude.Maybe Prelude.Text,
GetDashboardResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetDashboardResponse -> GetDashboardResponse -> Bool
(GetDashboardResponse -> GetDashboardResponse -> Bool)
-> (GetDashboardResponse -> GetDashboardResponse -> Bool)
-> Eq GetDashboardResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDashboardResponse -> GetDashboardResponse -> Bool
$c/= :: GetDashboardResponse -> GetDashboardResponse -> Bool
== :: GetDashboardResponse -> GetDashboardResponse -> Bool
$c== :: GetDashboardResponse -> GetDashboardResponse -> Bool
Prelude.Eq, ReadPrec [GetDashboardResponse]
ReadPrec GetDashboardResponse
Int -> ReadS GetDashboardResponse
ReadS [GetDashboardResponse]
(Int -> ReadS GetDashboardResponse)
-> ReadS [GetDashboardResponse]
-> ReadPrec GetDashboardResponse
-> ReadPrec [GetDashboardResponse]
-> Read GetDashboardResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDashboardResponse]
$creadListPrec :: ReadPrec [GetDashboardResponse]
readPrec :: ReadPrec GetDashboardResponse
$creadPrec :: ReadPrec GetDashboardResponse
readList :: ReadS [GetDashboardResponse]
$creadList :: ReadS [GetDashboardResponse]
readsPrec :: Int -> ReadS GetDashboardResponse
$creadsPrec :: Int -> ReadS GetDashboardResponse
Prelude.Read, Int -> GetDashboardResponse -> ShowS
[GetDashboardResponse] -> ShowS
GetDashboardResponse -> String
(Int -> GetDashboardResponse -> ShowS)
-> (GetDashboardResponse -> String)
-> ([GetDashboardResponse] -> ShowS)
-> Show GetDashboardResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDashboardResponse] -> ShowS
$cshowList :: [GetDashboardResponse] -> ShowS
show :: GetDashboardResponse -> String
$cshow :: GetDashboardResponse -> String
showsPrec :: Int -> GetDashboardResponse -> ShowS
$cshowsPrec :: Int -> GetDashboardResponse -> ShowS
Prelude.Show, (forall x. GetDashboardResponse -> Rep GetDashboardResponse x)
-> (forall x. Rep GetDashboardResponse x -> GetDashboardResponse)
-> Generic GetDashboardResponse
forall x. Rep GetDashboardResponse x -> GetDashboardResponse
forall x. GetDashboardResponse -> Rep GetDashboardResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDashboardResponse x -> GetDashboardResponse
$cfrom :: forall x. GetDashboardResponse -> Rep GetDashboardResponse x
Prelude.Generic)
newGetDashboardResponse ::
Prelude.Int ->
GetDashboardResponse
newGetDashboardResponse :: Int -> GetDashboardResponse
newGetDashboardResponse Int
pHttpStatus_ =
GetDashboardResponse' :: Maybe Text
-> Maybe Text -> Maybe Text -> Int -> GetDashboardResponse
GetDashboardResponse'
{ $sel:dashboardName:GetDashboardResponse' :: Maybe Text
dashboardName =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:dashboardBody:GetDashboardResponse' :: Maybe Text
dashboardBody = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:dashboardArn:GetDashboardResponse' :: Maybe Text
dashboardArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetDashboardResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getDashboardResponse_dashboardName :: Lens.Lens' GetDashboardResponse (Prelude.Maybe Prelude.Text)
getDashboardResponse_dashboardName :: (Maybe Text -> f (Maybe Text))
-> GetDashboardResponse -> f GetDashboardResponse
getDashboardResponse_dashboardName = (GetDashboardResponse -> Maybe Text)
-> (GetDashboardResponse -> Maybe Text -> GetDashboardResponse)
-> Lens
GetDashboardResponse GetDashboardResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDashboardResponse' {Maybe Text
dashboardName :: Maybe Text
$sel:dashboardName:GetDashboardResponse' :: GetDashboardResponse -> Maybe Text
dashboardName} -> Maybe Text
dashboardName) (\s :: GetDashboardResponse
s@GetDashboardResponse' {} Maybe Text
a -> GetDashboardResponse
s {$sel:dashboardName:GetDashboardResponse' :: Maybe Text
dashboardName = Maybe Text
a} :: GetDashboardResponse)
getDashboardResponse_dashboardBody :: Lens.Lens' GetDashboardResponse (Prelude.Maybe Prelude.Text)
getDashboardResponse_dashboardBody :: (Maybe Text -> f (Maybe Text))
-> GetDashboardResponse -> f GetDashboardResponse
getDashboardResponse_dashboardBody = (GetDashboardResponse -> Maybe Text)
-> (GetDashboardResponse -> Maybe Text -> GetDashboardResponse)
-> Lens
GetDashboardResponse GetDashboardResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDashboardResponse' {Maybe Text
dashboardBody :: Maybe Text
$sel:dashboardBody:GetDashboardResponse' :: GetDashboardResponse -> Maybe Text
dashboardBody} -> Maybe Text
dashboardBody) (\s :: GetDashboardResponse
s@GetDashboardResponse' {} Maybe Text
a -> GetDashboardResponse
s {$sel:dashboardBody:GetDashboardResponse' :: Maybe Text
dashboardBody = Maybe Text
a} :: GetDashboardResponse)
getDashboardResponse_dashboardArn :: Lens.Lens' GetDashboardResponse (Prelude.Maybe Prelude.Text)
getDashboardResponse_dashboardArn :: (Maybe Text -> f (Maybe Text))
-> GetDashboardResponse -> f GetDashboardResponse
getDashboardResponse_dashboardArn = (GetDashboardResponse -> Maybe Text)
-> (GetDashboardResponse -> Maybe Text -> GetDashboardResponse)
-> Lens
GetDashboardResponse GetDashboardResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDashboardResponse' {Maybe Text
dashboardArn :: Maybe Text
$sel:dashboardArn:GetDashboardResponse' :: GetDashboardResponse -> Maybe Text
dashboardArn} -> Maybe Text
dashboardArn) (\s :: GetDashboardResponse
s@GetDashboardResponse' {} Maybe Text
a -> GetDashboardResponse
s {$sel:dashboardArn:GetDashboardResponse' :: Maybe Text
dashboardArn = Maybe Text
a} :: GetDashboardResponse)
getDashboardResponse_httpStatus :: Lens.Lens' GetDashboardResponse Prelude.Int
getDashboardResponse_httpStatus :: (Int -> f Int) -> GetDashboardResponse -> f GetDashboardResponse
getDashboardResponse_httpStatus = (GetDashboardResponse -> Int)
-> (GetDashboardResponse -> Int -> GetDashboardResponse)
-> Lens GetDashboardResponse GetDashboardResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDashboardResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetDashboardResponse' :: GetDashboardResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetDashboardResponse
s@GetDashboardResponse' {} Int
a -> GetDashboardResponse
s {$sel:httpStatus:GetDashboardResponse' :: Int
httpStatus = Int
a} :: GetDashboardResponse)
instance Prelude.NFData GetDashboardResponse