{-# 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.GetMetricWidgetImage
(
GetMetricWidgetImage (..),
newGetMetricWidgetImage,
getMetricWidgetImage_outputFormat,
getMetricWidgetImage_metricWidget,
GetMetricWidgetImageResponse (..),
newGetMetricWidgetImageResponse,
getMetricWidgetImageResponse_metricWidgetImage,
getMetricWidgetImageResponse_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 GetMetricWidgetImage = GetMetricWidgetImage'
{
GetMetricWidgetImage -> Maybe Text
outputFormat :: Prelude.Maybe Prelude.Text,
GetMetricWidgetImage -> Text
metricWidget :: Prelude.Text
}
deriving (GetMetricWidgetImage -> GetMetricWidgetImage -> Bool
(GetMetricWidgetImage -> GetMetricWidgetImage -> Bool)
-> (GetMetricWidgetImage -> GetMetricWidgetImage -> Bool)
-> Eq GetMetricWidgetImage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMetricWidgetImage -> GetMetricWidgetImage -> Bool
$c/= :: GetMetricWidgetImage -> GetMetricWidgetImage -> Bool
== :: GetMetricWidgetImage -> GetMetricWidgetImage -> Bool
$c== :: GetMetricWidgetImage -> GetMetricWidgetImage -> Bool
Prelude.Eq, ReadPrec [GetMetricWidgetImage]
ReadPrec GetMetricWidgetImage
Int -> ReadS GetMetricWidgetImage
ReadS [GetMetricWidgetImage]
(Int -> ReadS GetMetricWidgetImage)
-> ReadS [GetMetricWidgetImage]
-> ReadPrec GetMetricWidgetImage
-> ReadPrec [GetMetricWidgetImage]
-> Read GetMetricWidgetImage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMetricWidgetImage]
$creadListPrec :: ReadPrec [GetMetricWidgetImage]
readPrec :: ReadPrec GetMetricWidgetImage
$creadPrec :: ReadPrec GetMetricWidgetImage
readList :: ReadS [GetMetricWidgetImage]
$creadList :: ReadS [GetMetricWidgetImage]
readsPrec :: Int -> ReadS GetMetricWidgetImage
$creadsPrec :: Int -> ReadS GetMetricWidgetImage
Prelude.Read, Int -> GetMetricWidgetImage -> ShowS
[GetMetricWidgetImage] -> ShowS
GetMetricWidgetImage -> String
(Int -> GetMetricWidgetImage -> ShowS)
-> (GetMetricWidgetImage -> String)
-> ([GetMetricWidgetImage] -> ShowS)
-> Show GetMetricWidgetImage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMetricWidgetImage] -> ShowS
$cshowList :: [GetMetricWidgetImage] -> ShowS
show :: GetMetricWidgetImage -> String
$cshow :: GetMetricWidgetImage -> String
showsPrec :: Int -> GetMetricWidgetImage -> ShowS
$cshowsPrec :: Int -> GetMetricWidgetImage -> ShowS
Prelude.Show, (forall x. GetMetricWidgetImage -> Rep GetMetricWidgetImage x)
-> (forall x. Rep GetMetricWidgetImage x -> GetMetricWidgetImage)
-> Generic GetMetricWidgetImage
forall x. Rep GetMetricWidgetImage x -> GetMetricWidgetImage
forall x. GetMetricWidgetImage -> Rep GetMetricWidgetImage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMetricWidgetImage x -> GetMetricWidgetImage
$cfrom :: forall x. GetMetricWidgetImage -> Rep GetMetricWidgetImage x
Prelude.Generic)
newGetMetricWidgetImage ::
Prelude.Text ->
GetMetricWidgetImage
newGetMetricWidgetImage :: Text -> GetMetricWidgetImage
newGetMetricWidgetImage Text
pMetricWidget_ =
GetMetricWidgetImage' :: Maybe Text -> Text -> GetMetricWidgetImage
GetMetricWidgetImage'
{ $sel:outputFormat:GetMetricWidgetImage' :: Maybe Text
outputFormat =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:metricWidget:GetMetricWidgetImage' :: Text
metricWidget = Text
pMetricWidget_
}
getMetricWidgetImage_outputFormat :: Lens.Lens' GetMetricWidgetImage (Prelude.Maybe Prelude.Text)
getMetricWidgetImage_outputFormat :: (Maybe Text -> f (Maybe Text))
-> GetMetricWidgetImage -> f GetMetricWidgetImage
getMetricWidgetImage_outputFormat = (GetMetricWidgetImage -> Maybe Text)
-> (GetMetricWidgetImage -> Maybe Text -> GetMetricWidgetImage)
-> Lens
GetMetricWidgetImage GetMetricWidgetImage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricWidgetImage' {Maybe Text
outputFormat :: Maybe Text
$sel:outputFormat:GetMetricWidgetImage' :: GetMetricWidgetImage -> Maybe Text
outputFormat} -> Maybe Text
outputFormat) (\s :: GetMetricWidgetImage
s@GetMetricWidgetImage' {} Maybe Text
a -> GetMetricWidgetImage
s {$sel:outputFormat:GetMetricWidgetImage' :: Maybe Text
outputFormat = Maybe Text
a} :: GetMetricWidgetImage)
getMetricWidgetImage_metricWidget :: Lens.Lens' GetMetricWidgetImage Prelude.Text
getMetricWidgetImage_metricWidget :: (Text -> f Text) -> GetMetricWidgetImage -> f GetMetricWidgetImage
getMetricWidgetImage_metricWidget = (GetMetricWidgetImage -> Text)
-> (GetMetricWidgetImage -> Text -> GetMetricWidgetImage)
-> Lens GetMetricWidgetImage GetMetricWidgetImage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricWidgetImage' {Text
metricWidget :: Text
$sel:metricWidget:GetMetricWidgetImage' :: GetMetricWidgetImage -> Text
metricWidget} -> Text
metricWidget) (\s :: GetMetricWidgetImage
s@GetMetricWidgetImage' {} Text
a -> GetMetricWidgetImage
s {$sel:metricWidget:GetMetricWidgetImage' :: Text
metricWidget = Text
a} :: GetMetricWidgetImage)
instance Core.AWSRequest GetMetricWidgetImage where
type
AWSResponse GetMetricWidgetImage =
GetMetricWidgetImageResponse
request :: GetMetricWidgetImage -> Request GetMetricWidgetImage
request = Service -> GetMetricWidgetImage -> Request GetMetricWidgetImage
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy GetMetricWidgetImage
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetMetricWidgetImage)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetMetricWidgetImage))
-> Logger
-> Service
-> Proxy GetMetricWidgetImage
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetMetricWidgetImage)))
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
"GetMetricWidgetImageResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Base64 -> Int -> GetMetricWidgetImageResponse
GetMetricWidgetImageResponse'
(Maybe Base64 -> Int -> GetMetricWidgetImageResponse)
-> Either String (Maybe Base64)
-> Either String (Int -> GetMetricWidgetImageResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Base64)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"MetricWidgetImage")
Either String (Int -> GetMetricWidgetImageResponse)
-> Either String Int -> Either String GetMetricWidgetImageResponse
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 GetMetricWidgetImage
instance Prelude.NFData GetMetricWidgetImage
instance Core.ToHeaders GetMetricWidgetImage where
toHeaders :: GetMetricWidgetImage -> ResponseHeaders
toHeaders = ResponseHeaders -> GetMetricWidgetImage -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetMetricWidgetImage where
toPath :: GetMetricWidgetImage -> ByteString
toPath = ByteString -> GetMetricWidgetImage -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetMetricWidgetImage where
toQuery :: GetMetricWidgetImage -> QueryString
toQuery GetMetricWidgetImage' {Maybe Text
Text
metricWidget :: Text
outputFormat :: Maybe Text
$sel:metricWidget:GetMetricWidgetImage' :: GetMetricWidgetImage -> Text
$sel:outputFormat:GetMetricWidgetImage' :: GetMetricWidgetImage -> Maybe 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
"GetMetricWidgetImage" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-08-01" :: Prelude.ByteString),
ByteString
"OutputFormat" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
outputFormat,
ByteString
"MetricWidget" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
metricWidget
]
data GetMetricWidgetImageResponse = GetMetricWidgetImageResponse'
{
GetMetricWidgetImageResponse -> Maybe Base64
metricWidgetImage :: Prelude.Maybe Core.Base64,
GetMetricWidgetImageResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetMetricWidgetImageResponse
-> GetMetricWidgetImageResponse -> Bool
(GetMetricWidgetImageResponse
-> GetMetricWidgetImageResponse -> Bool)
-> (GetMetricWidgetImageResponse
-> GetMetricWidgetImageResponse -> Bool)
-> Eq GetMetricWidgetImageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMetricWidgetImageResponse
-> GetMetricWidgetImageResponse -> Bool
$c/= :: GetMetricWidgetImageResponse
-> GetMetricWidgetImageResponse -> Bool
== :: GetMetricWidgetImageResponse
-> GetMetricWidgetImageResponse -> Bool
$c== :: GetMetricWidgetImageResponse
-> GetMetricWidgetImageResponse -> Bool
Prelude.Eq, ReadPrec [GetMetricWidgetImageResponse]
ReadPrec GetMetricWidgetImageResponse
Int -> ReadS GetMetricWidgetImageResponse
ReadS [GetMetricWidgetImageResponse]
(Int -> ReadS GetMetricWidgetImageResponse)
-> ReadS [GetMetricWidgetImageResponse]
-> ReadPrec GetMetricWidgetImageResponse
-> ReadPrec [GetMetricWidgetImageResponse]
-> Read GetMetricWidgetImageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMetricWidgetImageResponse]
$creadListPrec :: ReadPrec [GetMetricWidgetImageResponse]
readPrec :: ReadPrec GetMetricWidgetImageResponse
$creadPrec :: ReadPrec GetMetricWidgetImageResponse
readList :: ReadS [GetMetricWidgetImageResponse]
$creadList :: ReadS [GetMetricWidgetImageResponse]
readsPrec :: Int -> ReadS GetMetricWidgetImageResponse
$creadsPrec :: Int -> ReadS GetMetricWidgetImageResponse
Prelude.Read, Int -> GetMetricWidgetImageResponse -> ShowS
[GetMetricWidgetImageResponse] -> ShowS
GetMetricWidgetImageResponse -> String
(Int -> GetMetricWidgetImageResponse -> ShowS)
-> (GetMetricWidgetImageResponse -> String)
-> ([GetMetricWidgetImageResponse] -> ShowS)
-> Show GetMetricWidgetImageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMetricWidgetImageResponse] -> ShowS
$cshowList :: [GetMetricWidgetImageResponse] -> ShowS
show :: GetMetricWidgetImageResponse -> String
$cshow :: GetMetricWidgetImageResponse -> String
showsPrec :: Int -> GetMetricWidgetImageResponse -> ShowS
$cshowsPrec :: Int -> GetMetricWidgetImageResponse -> ShowS
Prelude.Show, (forall x.
GetMetricWidgetImageResponse -> Rep GetMetricWidgetImageResponse x)
-> (forall x.
Rep GetMetricWidgetImageResponse x -> GetMetricWidgetImageResponse)
-> Generic GetMetricWidgetImageResponse
forall x.
Rep GetMetricWidgetImageResponse x -> GetMetricWidgetImageResponse
forall x.
GetMetricWidgetImageResponse -> Rep GetMetricWidgetImageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetMetricWidgetImageResponse x -> GetMetricWidgetImageResponse
$cfrom :: forall x.
GetMetricWidgetImageResponse -> Rep GetMetricWidgetImageResponse x
Prelude.Generic)
newGetMetricWidgetImageResponse ::
Prelude.Int ->
GetMetricWidgetImageResponse
newGetMetricWidgetImageResponse :: Int -> GetMetricWidgetImageResponse
newGetMetricWidgetImageResponse Int
pHttpStatus_ =
GetMetricWidgetImageResponse' :: Maybe Base64 -> Int -> GetMetricWidgetImageResponse
GetMetricWidgetImageResponse'
{ $sel:metricWidgetImage:GetMetricWidgetImageResponse' :: Maybe Base64
metricWidgetImage =
Maybe Base64
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetMetricWidgetImageResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getMetricWidgetImageResponse_metricWidgetImage :: Lens.Lens' GetMetricWidgetImageResponse (Prelude.Maybe Prelude.ByteString)
getMetricWidgetImageResponse_metricWidgetImage :: (Maybe ByteString -> f (Maybe ByteString))
-> GetMetricWidgetImageResponse -> f GetMetricWidgetImageResponse
getMetricWidgetImageResponse_metricWidgetImage = (GetMetricWidgetImageResponse -> Maybe Base64)
-> (GetMetricWidgetImageResponse
-> Maybe Base64 -> GetMetricWidgetImageResponse)
-> Lens
GetMetricWidgetImageResponse
GetMetricWidgetImageResponse
(Maybe Base64)
(Maybe Base64)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricWidgetImageResponse' {Maybe Base64
metricWidgetImage :: Maybe Base64
$sel:metricWidgetImage:GetMetricWidgetImageResponse' :: GetMetricWidgetImageResponse -> Maybe Base64
metricWidgetImage} -> Maybe Base64
metricWidgetImage) (\s :: GetMetricWidgetImageResponse
s@GetMetricWidgetImageResponse' {} Maybe Base64
a -> GetMetricWidgetImageResponse
s {$sel:metricWidgetImage:GetMetricWidgetImageResponse' :: Maybe Base64
metricWidgetImage = Maybe Base64
a} :: GetMetricWidgetImageResponse) ((Maybe Base64 -> f (Maybe Base64))
-> GetMetricWidgetImageResponse -> f GetMetricWidgetImageResponse)
-> ((Maybe ByteString -> f (Maybe ByteString))
-> Maybe Base64 -> f (Maybe Base64))
-> (Maybe ByteString -> f (Maybe ByteString))
-> GetMetricWidgetImageResponse
-> f GetMetricWidgetImageResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso Base64 Base64 ByteString ByteString
-> Iso
(Maybe Base64) (Maybe Base64) (Maybe ByteString) (Maybe ByteString)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso Base64 Base64 ByteString ByteString
Iso' Base64 ByteString
Core._Base64
getMetricWidgetImageResponse_httpStatus :: Lens.Lens' GetMetricWidgetImageResponse Prelude.Int
getMetricWidgetImageResponse_httpStatus :: (Int -> f Int)
-> GetMetricWidgetImageResponse -> f GetMetricWidgetImageResponse
getMetricWidgetImageResponse_httpStatus = (GetMetricWidgetImageResponse -> Int)
-> (GetMetricWidgetImageResponse
-> Int -> GetMetricWidgetImageResponse)
-> Lens
GetMetricWidgetImageResponse GetMetricWidgetImageResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricWidgetImageResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetMetricWidgetImageResponse' :: GetMetricWidgetImageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetMetricWidgetImageResponse
s@GetMetricWidgetImageResponse' {} Int
a -> GetMetricWidgetImageResponse
s {$sel:httpStatus:GetMetricWidgetImageResponse' :: Int
httpStatus = Int
a} :: GetMetricWidgetImageResponse)
instance Prelude.NFData GetMetricWidgetImageResponse