{-# 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.PutDashboard
(
PutDashboard (..),
newPutDashboard,
putDashboard_dashboardName,
putDashboard_dashboardBody,
PutDashboardResponse (..),
newPutDashboardResponse,
putDashboardResponse_dashboardValidationMessages,
putDashboardResponse_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 PutDashboard = PutDashboard'
{
PutDashboard -> Text
dashboardName :: Prelude.Text,
PutDashboard -> Text
dashboardBody :: Prelude.Text
}
deriving (PutDashboard -> PutDashboard -> Bool
(PutDashboard -> PutDashboard -> Bool)
-> (PutDashboard -> PutDashboard -> Bool) -> Eq PutDashboard
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutDashboard -> PutDashboard -> Bool
$c/= :: PutDashboard -> PutDashboard -> Bool
== :: PutDashboard -> PutDashboard -> Bool
$c== :: PutDashboard -> PutDashboard -> Bool
Prelude.Eq, ReadPrec [PutDashboard]
ReadPrec PutDashboard
Int -> ReadS PutDashboard
ReadS [PutDashboard]
(Int -> ReadS PutDashboard)
-> ReadS [PutDashboard]
-> ReadPrec PutDashboard
-> ReadPrec [PutDashboard]
-> Read PutDashboard
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutDashboard]
$creadListPrec :: ReadPrec [PutDashboard]
readPrec :: ReadPrec PutDashboard
$creadPrec :: ReadPrec PutDashboard
readList :: ReadS [PutDashboard]
$creadList :: ReadS [PutDashboard]
readsPrec :: Int -> ReadS PutDashboard
$creadsPrec :: Int -> ReadS PutDashboard
Prelude.Read, Int -> PutDashboard -> ShowS
[PutDashboard] -> ShowS
PutDashboard -> String
(Int -> PutDashboard -> ShowS)
-> (PutDashboard -> String)
-> ([PutDashboard] -> ShowS)
-> Show PutDashboard
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutDashboard] -> ShowS
$cshowList :: [PutDashboard] -> ShowS
show :: PutDashboard -> String
$cshow :: PutDashboard -> String
showsPrec :: Int -> PutDashboard -> ShowS
$cshowsPrec :: Int -> PutDashboard -> ShowS
Prelude.Show, (forall x. PutDashboard -> Rep PutDashboard x)
-> (forall x. Rep PutDashboard x -> PutDashboard)
-> Generic PutDashboard
forall x. Rep PutDashboard x -> PutDashboard
forall x. PutDashboard -> Rep PutDashboard x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutDashboard x -> PutDashboard
$cfrom :: forall x. PutDashboard -> Rep PutDashboard x
Prelude.Generic)
newPutDashboard ::
Prelude.Text ->
Prelude.Text ->
PutDashboard
newPutDashboard :: Text -> Text -> PutDashboard
newPutDashboard Text
pDashboardName_ Text
pDashboardBody_ =
PutDashboard' :: Text -> Text -> PutDashboard
PutDashboard'
{ $sel:dashboardName:PutDashboard' :: Text
dashboardName = Text
pDashboardName_,
$sel:dashboardBody:PutDashboard' :: Text
dashboardBody = Text
pDashboardBody_
}
putDashboard_dashboardName :: Lens.Lens' PutDashboard Prelude.Text
putDashboard_dashboardName :: (Text -> f Text) -> PutDashboard -> f PutDashboard
putDashboard_dashboardName = (PutDashboard -> Text)
-> (PutDashboard -> Text -> PutDashboard)
-> Lens PutDashboard PutDashboard Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutDashboard' {Text
dashboardName :: Text
$sel:dashboardName:PutDashboard' :: PutDashboard -> Text
dashboardName} -> Text
dashboardName) (\s :: PutDashboard
s@PutDashboard' {} Text
a -> PutDashboard
s {$sel:dashboardName:PutDashboard' :: Text
dashboardName = Text
a} :: PutDashboard)
putDashboard_dashboardBody :: Lens.Lens' PutDashboard Prelude.Text
putDashboard_dashboardBody :: (Text -> f Text) -> PutDashboard -> f PutDashboard
putDashboard_dashboardBody = (PutDashboard -> Text)
-> (PutDashboard -> Text -> PutDashboard)
-> Lens PutDashboard PutDashboard Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutDashboard' {Text
dashboardBody :: Text
$sel:dashboardBody:PutDashboard' :: PutDashboard -> Text
dashboardBody} -> Text
dashboardBody) (\s :: PutDashboard
s@PutDashboard' {} Text
a -> PutDashboard
s {$sel:dashboardBody:PutDashboard' :: Text
dashboardBody = Text
a} :: PutDashboard)
instance Core.AWSRequest PutDashboard where
type AWSResponse PutDashboard = PutDashboardResponse
request :: PutDashboard -> Request PutDashboard
request = Service -> PutDashboard -> Request PutDashboard
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy PutDashboard
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutDashboard)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse PutDashboard))
-> Logger
-> Service
-> Proxy PutDashboard
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutDashboard)))
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
"PutDashboardResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe [DashboardValidationMessage] -> Int -> PutDashboardResponse
PutDashboardResponse'
(Maybe [DashboardValidationMessage] -> Int -> PutDashboardResponse)
-> Either String (Maybe [DashboardValidationMessage])
-> Either String (Int -> PutDashboardResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DashboardValidationMessages"
Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [DashboardValidationMessage]))
-> Either String (Maybe [DashboardValidationMessage])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [DashboardValidationMessage])
-> [Node] -> Either String (Maybe [DashboardValidationMessage])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [DashboardValidationMessage]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Int -> PutDashboardResponse)
-> Either String Int -> Either String PutDashboardResponse
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 PutDashboard
instance Prelude.NFData PutDashboard
instance Core.ToHeaders PutDashboard where
toHeaders :: PutDashboard -> ResponseHeaders
toHeaders = ResponseHeaders -> PutDashboard -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath PutDashboard where
toPath :: PutDashboard -> ByteString
toPath = ByteString -> PutDashboard -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutDashboard where
toQuery :: PutDashboard -> QueryString
toQuery PutDashboard' {Text
dashboardBody :: Text
dashboardName :: Text
$sel:dashboardBody:PutDashboard' :: PutDashboard -> Text
$sel:dashboardName:PutDashboard' :: PutDashboard -> 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
"PutDashboard" :: 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,
ByteString
"DashboardBody" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dashboardBody
]
data PutDashboardResponse = PutDashboardResponse'
{
PutDashboardResponse -> Maybe [DashboardValidationMessage]
dashboardValidationMessages :: Prelude.Maybe [DashboardValidationMessage],
PutDashboardResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutDashboardResponse -> PutDashboardResponse -> Bool
(PutDashboardResponse -> PutDashboardResponse -> Bool)
-> (PutDashboardResponse -> PutDashboardResponse -> Bool)
-> Eq PutDashboardResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutDashboardResponse -> PutDashboardResponse -> Bool
$c/= :: PutDashboardResponse -> PutDashboardResponse -> Bool
== :: PutDashboardResponse -> PutDashboardResponse -> Bool
$c== :: PutDashboardResponse -> PutDashboardResponse -> Bool
Prelude.Eq, ReadPrec [PutDashboardResponse]
ReadPrec PutDashboardResponse
Int -> ReadS PutDashboardResponse
ReadS [PutDashboardResponse]
(Int -> ReadS PutDashboardResponse)
-> ReadS [PutDashboardResponse]
-> ReadPrec PutDashboardResponse
-> ReadPrec [PutDashboardResponse]
-> Read PutDashboardResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutDashboardResponse]
$creadListPrec :: ReadPrec [PutDashboardResponse]
readPrec :: ReadPrec PutDashboardResponse
$creadPrec :: ReadPrec PutDashboardResponse
readList :: ReadS [PutDashboardResponse]
$creadList :: ReadS [PutDashboardResponse]
readsPrec :: Int -> ReadS PutDashboardResponse
$creadsPrec :: Int -> ReadS PutDashboardResponse
Prelude.Read, Int -> PutDashboardResponse -> ShowS
[PutDashboardResponse] -> ShowS
PutDashboardResponse -> String
(Int -> PutDashboardResponse -> ShowS)
-> (PutDashboardResponse -> String)
-> ([PutDashboardResponse] -> ShowS)
-> Show PutDashboardResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutDashboardResponse] -> ShowS
$cshowList :: [PutDashboardResponse] -> ShowS
show :: PutDashboardResponse -> String
$cshow :: PutDashboardResponse -> String
showsPrec :: Int -> PutDashboardResponse -> ShowS
$cshowsPrec :: Int -> PutDashboardResponse -> ShowS
Prelude.Show, (forall x. PutDashboardResponse -> Rep PutDashboardResponse x)
-> (forall x. Rep PutDashboardResponse x -> PutDashboardResponse)
-> Generic PutDashboardResponse
forall x. Rep PutDashboardResponse x -> PutDashboardResponse
forall x. PutDashboardResponse -> Rep PutDashboardResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutDashboardResponse x -> PutDashboardResponse
$cfrom :: forall x. PutDashboardResponse -> Rep PutDashboardResponse x
Prelude.Generic)
newPutDashboardResponse ::
Prelude.Int ->
PutDashboardResponse
newPutDashboardResponse :: Int -> PutDashboardResponse
newPutDashboardResponse Int
pHttpStatus_ =
PutDashboardResponse' :: Maybe [DashboardValidationMessage] -> Int -> PutDashboardResponse
PutDashboardResponse'
{ $sel:dashboardValidationMessages:PutDashboardResponse' :: Maybe [DashboardValidationMessage]
dashboardValidationMessages =
Maybe [DashboardValidationMessage]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutDashboardResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putDashboardResponse_dashboardValidationMessages :: Lens.Lens' PutDashboardResponse (Prelude.Maybe [DashboardValidationMessage])
putDashboardResponse_dashboardValidationMessages :: (Maybe [DashboardValidationMessage]
-> f (Maybe [DashboardValidationMessage]))
-> PutDashboardResponse -> f PutDashboardResponse
putDashboardResponse_dashboardValidationMessages = (PutDashboardResponse -> Maybe [DashboardValidationMessage])
-> (PutDashboardResponse
-> Maybe [DashboardValidationMessage] -> PutDashboardResponse)
-> Lens
PutDashboardResponse
PutDashboardResponse
(Maybe [DashboardValidationMessage])
(Maybe [DashboardValidationMessage])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutDashboardResponse' {Maybe [DashboardValidationMessage]
dashboardValidationMessages :: Maybe [DashboardValidationMessage]
$sel:dashboardValidationMessages:PutDashboardResponse' :: PutDashboardResponse -> Maybe [DashboardValidationMessage]
dashboardValidationMessages} -> Maybe [DashboardValidationMessage]
dashboardValidationMessages) (\s :: PutDashboardResponse
s@PutDashboardResponse' {} Maybe [DashboardValidationMessage]
a -> PutDashboardResponse
s {$sel:dashboardValidationMessages:PutDashboardResponse' :: Maybe [DashboardValidationMessage]
dashboardValidationMessages = Maybe [DashboardValidationMessage]
a} :: PutDashboardResponse) ((Maybe [DashboardValidationMessage]
-> f (Maybe [DashboardValidationMessage]))
-> PutDashboardResponse -> f PutDashboardResponse)
-> ((Maybe [DashboardValidationMessage]
-> f (Maybe [DashboardValidationMessage]))
-> Maybe [DashboardValidationMessage]
-> f (Maybe [DashboardValidationMessage]))
-> (Maybe [DashboardValidationMessage]
-> f (Maybe [DashboardValidationMessage]))
-> PutDashboardResponse
-> f PutDashboardResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[DashboardValidationMessage]
[DashboardValidationMessage]
[DashboardValidationMessage]
[DashboardValidationMessage]
-> Iso
(Maybe [DashboardValidationMessage])
(Maybe [DashboardValidationMessage])
(Maybe [DashboardValidationMessage])
(Maybe [DashboardValidationMessage])
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
[DashboardValidationMessage]
[DashboardValidationMessage]
[DashboardValidationMessage]
[DashboardValidationMessage]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
putDashboardResponse_httpStatus :: Lens.Lens' PutDashboardResponse Prelude.Int
putDashboardResponse_httpStatus :: (Int -> f Int) -> PutDashboardResponse -> f PutDashboardResponse
putDashboardResponse_httpStatus = (PutDashboardResponse -> Int)
-> (PutDashboardResponse -> Int -> PutDashboardResponse)
-> Lens PutDashboardResponse PutDashboardResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutDashboardResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutDashboardResponse' :: PutDashboardResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutDashboardResponse
s@PutDashboardResponse' {} Int
a -> PutDashboardResponse
s {$sel:httpStatus:PutDashboardResponse' :: Int
httpStatus = Int
a} :: PutDashboardResponse)
instance Prelude.NFData PutDashboardResponse