{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:dashboardName:PutDashboard' :: Text
dashboardName = Text
pDashboardName_,
$sel:dashboardBody:PutDashboard' :: Text
dashboardBody = Text
pDashboardBody_
}
putDashboard_dashboardName :: Lens.Lens' PutDashboard Prelude.Text
putDashboard_dashboardName :: Lens' PutDashboard Text
putDashboard_dashboardName = 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 :: Lens' PutDashboard Text
putDashboard_dashboardBody = 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 :: (Service -> Service) -> PutDashboard -> Request PutDashboard
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutDashboard
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutDashboard)))
response =
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> 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'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"DashboardValidationMessages"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable PutDashboard where
hashWithSalt :: Int -> PutDashboard -> Int
hashWithSalt Int
_salt PutDashboard' {Text
dashboardBody :: Text
dashboardName :: Text
$sel:dashboardBody:PutDashboard' :: PutDashboard -> Text
$sel:dashboardName:PutDashboard' :: PutDashboard -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
dashboardName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
dashboardBody
instance Prelude.NFData PutDashboard where
rnf :: PutDashboard -> ()
rnf PutDashboard' {Text
dashboardBody :: Text
dashboardName :: Text
$sel:dashboardBody:PutDashboard' :: PutDashboard -> Text
$sel:dashboardName:PutDashboard' :: PutDashboard -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
dashboardName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
dashboardBody
instance Data.ToHeaders PutDashboard where
toHeaders :: PutDashboard -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath PutDashboard where
toPath :: PutDashboard -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery PutDashboard where
toQuery :: PutDashboard -> QueryString
toQuery PutDashboard' {Text
dashboardBody :: Text
dashboardName :: Text
$sel:dashboardBody:PutDashboard' :: PutDashboard -> Text
$sel:dashboardName:PutDashboard' :: PutDashboard -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"PutDashboard" :: Prelude.ByteString),
ByteString
"Version"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-08-01" :: Prelude.ByteString),
ByteString
"DashboardName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
dashboardName,
ByteString
"DashboardBody" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
dashboardBody
]
data PutDashboardResponse = PutDashboardResponse'
{
PutDashboardResponse -> Maybe [DashboardValidationMessage]
dashboardValidationMessages :: Prelude.Maybe [DashboardValidationMessage],
PutDashboardResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutDashboardResponse -> PutDashboardResponse -> Bool
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]
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
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. 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'
{ $sel:dashboardValidationMessages:PutDashboardResponse' :: Maybe [DashboardValidationMessage]
dashboardValidationMessages =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutDashboardResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putDashboardResponse_dashboardValidationMessages :: Lens.Lens' PutDashboardResponse (Prelude.Maybe [DashboardValidationMessage])
putDashboardResponse_dashboardValidationMessages :: Lens' PutDashboardResponse (Maybe [DashboardValidationMessage])
putDashboardResponse_dashboardValidationMessages = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' PutDashboardResponse Int
putDashboardResponse_httpStatus = 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 where
rnf :: PutDashboardResponse -> ()
rnf PutDashboardResponse' {Int
Maybe [DashboardValidationMessage]
httpStatus :: Int
dashboardValidationMessages :: Maybe [DashboardValidationMessage]
$sel:httpStatus:PutDashboardResponse' :: PutDashboardResponse -> Int
$sel:dashboardValidationMessages:PutDashboardResponse' :: PutDashboardResponse -> Maybe [DashboardValidationMessage]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [DashboardValidationMessage]
dashboardValidationMessages
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus