{-# 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.IoTSiteWise.UpdateDashboard
(
UpdateDashboard (..),
newUpdateDashboard,
updateDashboard_clientToken,
updateDashboard_dashboardDescription,
updateDashboard_dashboardId,
updateDashboard_dashboardName,
updateDashboard_dashboardDefinition,
UpdateDashboardResponse (..),
newUpdateDashboardResponse,
updateDashboardResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoTSiteWise.Types
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 UpdateDashboard = UpdateDashboard'
{
UpdateDashboard -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
UpdateDashboard -> Maybe Text
dashboardDescription :: Prelude.Maybe Prelude.Text,
UpdateDashboard -> Text
dashboardId :: Prelude.Text,
UpdateDashboard -> Text
dashboardName :: Prelude.Text,
UpdateDashboard -> Text
dashboardDefinition :: Prelude.Text
}
deriving (UpdateDashboard -> UpdateDashboard -> Bool
(UpdateDashboard -> UpdateDashboard -> Bool)
-> (UpdateDashboard -> UpdateDashboard -> Bool)
-> Eq UpdateDashboard
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDashboard -> UpdateDashboard -> Bool
$c/= :: UpdateDashboard -> UpdateDashboard -> Bool
== :: UpdateDashboard -> UpdateDashboard -> Bool
$c== :: UpdateDashboard -> UpdateDashboard -> Bool
Prelude.Eq, ReadPrec [UpdateDashboard]
ReadPrec UpdateDashboard
Int -> ReadS UpdateDashboard
ReadS [UpdateDashboard]
(Int -> ReadS UpdateDashboard)
-> ReadS [UpdateDashboard]
-> ReadPrec UpdateDashboard
-> ReadPrec [UpdateDashboard]
-> Read UpdateDashboard
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDashboard]
$creadListPrec :: ReadPrec [UpdateDashboard]
readPrec :: ReadPrec UpdateDashboard
$creadPrec :: ReadPrec UpdateDashboard
readList :: ReadS [UpdateDashboard]
$creadList :: ReadS [UpdateDashboard]
readsPrec :: Int -> ReadS UpdateDashboard
$creadsPrec :: Int -> ReadS UpdateDashboard
Prelude.Read, Int -> UpdateDashboard -> ShowS
[UpdateDashboard] -> ShowS
UpdateDashboard -> String
(Int -> UpdateDashboard -> ShowS)
-> (UpdateDashboard -> String)
-> ([UpdateDashboard] -> ShowS)
-> Show UpdateDashboard
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDashboard] -> ShowS
$cshowList :: [UpdateDashboard] -> ShowS
show :: UpdateDashboard -> String
$cshow :: UpdateDashboard -> String
showsPrec :: Int -> UpdateDashboard -> ShowS
$cshowsPrec :: Int -> UpdateDashboard -> ShowS
Prelude.Show, (forall x. UpdateDashboard -> Rep UpdateDashboard x)
-> (forall x. Rep UpdateDashboard x -> UpdateDashboard)
-> Generic UpdateDashboard
forall x. Rep UpdateDashboard x -> UpdateDashboard
forall x. UpdateDashboard -> Rep UpdateDashboard x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateDashboard x -> UpdateDashboard
$cfrom :: forall x. UpdateDashboard -> Rep UpdateDashboard x
Prelude.Generic)
newUpdateDashboard ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
UpdateDashboard
newUpdateDashboard :: Text -> Text -> Text -> UpdateDashboard
newUpdateDashboard
Text
pDashboardId_
Text
pDashboardName_
Text
pDashboardDefinition_ =
UpdateDashboard' :: Maybe Text -> Maybe Text -> Text -> Text -> Text -> UpdateDashboard
UpdateDashboard'
{ $sel:clientToken:UpdateDashboard' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:dashboardDescription:UpdateDashboard' :: Maybe Text
dashboardDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:dashboardId:UpdateDashboard' :: Text
dashboardId = Text
pDashboardId_,
$sel:dashboardName:UpdateDashboard' :: Text
dashboardName = Text
pDashboardName_,
$sel:dashboardDefinition:UpdateDashboard' :: Text
dashboardDefinition = Text
pDashboardDefinition_
}
updateDashboard_clientToken :: Lens.Lens' UpdateDashboard (Prelude.Maybe Prelude.Text)
updateDashboard_clientToken :: (Maybe Text -> f (Maybe Text))
-> UpdateDashboard -> f UpdateDashboard
updateDashboard_clientToken = (UpdateDashboard -> Maybe Text)
-> (UpdateDashboard -> Maybe Text -> UpdateDashboard)
-> Lens UpdateDashboard UpdateDashboard (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDashboard' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:UpdateDashboard' :: UpdateDashboard -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: UpdateDashboard
s@UpdateDashboard' {} Maybe Text
a -> UpdateDashboard
s {$sel:clientToken:UpdateDashboard' :: Maybe Text
clientToken = Maybe Text
a} :: UpdateDashboard)
updateDashboard_dashboardDescription :: Lens.Lens' UpdateDashboard (Prelude.Maybe Prelude.Text)
updateDashboard_dashboardDescription :: (Maybe Text -> f (Maybe Text))
-> UpdateDashboard -> f UpdateDashboard
updateDashboard_dashboardDescription = (UpdateDashboard -> Maybe Text)
-> (UpdateDashboard -> Maybe Text -> UpdateDashboard)
-> Lens UpdateDashboard UpdateDashboard (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDashboard' {Maybe Text
dashboardDescription :: Maybe Text
$sel:dashboardDescription:UpdateDashboard' :: UpdateDashboard -> Maybe Text
dashboardDescription} -> Maybe Text
dashboardDescription) (\s :: UpdateDashboard
s@UpdateDashboard' {} Maybe Text
a -> UpdateDashboard
s {$sel:dashboardDescription:UpdateDashboard' :: Maybe Text
dashboardDescription = Maybe Text
a} :: UpdateDashboard)
updateDashboard_dashboardId :: Lens.Lens' UpdateDashboard Prelude.Text
updateDashboard_dashboardId :: (Text -> f Text) -> UpdateDashboard -> f UpdateDashboard
updateDashboard_dashboardId = (UpdateDashboard -> Text)
-> (UpdateDashboard -> Text -> UpdateDashboard)
-> Lens UpdateDashboard UpdateDashboard Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDashboard' {Text
dashboardId :: Text
$sel:dashboardId:UpdateDashboard' :: UpdateDashboard -> Text
dashboardId} -> Text
dashboardId) (\s :: UpdateDashboard
s@UpdateDashboard' {} Text
a -> UpdateDashboard
s {$sel:dashboardId:UpdateDashboard' :: Text
dashboardId = Text
a} :: UpdateDashboard)
updateDashboard_dashboardName :: Lens.Lens' UpdateDashboard Prelude.Text
updateDashboard_dashboardName :: (Text -> f Text) -> UpdateDashboard -> f UpdateDashboard
updateDashboard_dashboardName = (UpdateDashboard -> Text)
-> (UpdateDashboard -> Text -> UpdateDashboard)
-> Lens UpdateDashboard UpdateDashboard Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDashboard' {Text
dashboardName :: Text
$sel:dashboardName:UpdateDashboard' :: UpdateDashboard -> Text
dashboardName} -> Text
dashboardName) (\s :: UpdateDashboard
s@UpdateDashboard' {} Text
a -> UpdateDashboard
s {$sel:dashboardName:UpdateDashboard' :: Text
dashboardName = Text
a} :: UpdateDashboard)
updateDashboard_dashboardDefinition :: Lens.Lens' UpdateDashboard Prelude.Text
updateDashboard_dashboardDefinition :: (Text -> f Text) -> UpdateDashboard -> f UpdateDashboard
updateDashboard_dashboardDefinition = (UpdateDashboard -> Text)
-> (UpdateDashboard -> Text -> UpdateDashboard)
-> Lens UpdateDashboard UpdateDashboard Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDashboard' {Text
dashboardDefinition :: Text
$sel:dashboardDefinition:UpdateDashboard' :: UpdateDashboard -> Text
dashboardDefinition} -> Text
dashboardDefinition) (\s :: UpdateDashboard
s@UpdateDashboard' {} Text
a -> UpdateDashboard
s {$sel:dashboardDefinition:UpdateDashboard' :: Text
dashboardDefinition = Text
a} :: UpdateDashboard)
instance Core.AWSRequest UpdateDashboard where
type
AWSResponse UpdateDashboard =
UpdateDashboardResponse
request :: UpdateDashboard -> Request UpdateDashboard
request = Service -> UpdateDashboard -> Request UpdateDashboard
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateDashboard
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateDashboard)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateDashboard))
-> Logger
-> Service
-> Proxy UpdateDashboard
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateDashboard)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> UpdateDashboardResponse
UpdateDashboardResponse'
(Int -> UpdateDashboardResponse)
-> Either String Int -> Either String UpdateDashboardResponse
forall (f :: * -> *) a b. Functor 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 UpdateDashboard
instance Prelude.NFData UpdateDashboard
instance Core.ToHeaders UpdateDashboard where
toHeaders :: UpdateDashboard -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateDashboard -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 UpdateDashboard where
toJSON :: UpdateDashboard -> Value
toJSON UpdateDashboard' {Maybe Text
Text
dashboardDefinition :: Text
dashboardName :: Text
dashboardId :: Text
dashboardDescription :: Maybe Text
clientToken :: Maybe Text
$sel:dashboardDefinition:UpdateDashboard' :: UpdateDashboard -> Text
$sel:dashboardName:UpdateDashboard' :: UpdateDashboard -> Text
$sel:dashboardId:UpdateDashboard' :: UpdateDashboard -> Text
$sel:dashboardDescription:UpdateDashboard' :: UpdateDashboard -> Maybe Text
$sel:clientToken:UpdateDashboard' :: UpdateDashboard -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"clientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken,
(Text
"dashboardDescription" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
dashboardDescription,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"dashboardName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
dashboardName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"dashboardDefinition" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
dashboardDefinition)
]
)
instance Core.ToPath UpdateDashboard where
toPath :: UpdateDashboard -> ByteString
toPath UpdateDashboard' {Maybe Text
Text
dashboardDefinition :: Text
dashboardName :: Text
dashboardId :: Text
dashboardDescription :: Maybe Text
clientToken :: Maybe Text
$sel:dashboardDefinition:UpdateDashboard' :: UpdateDashboard -> Text
$sel:dashboardName:UpdateDashboard' :: UpdateDashboard -> Text
$sel:dashboardId:UpdateDashboard' :: UpdateDashboard -> Text
$sel:dashboardDescription:UpdateDashboard' :: UpdateDashboard -> Maybe Text
$sel:clientToken:UpdateDashboard' :: UpdateDashboard -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/dashboards/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
dashboardId]
instance Core.ToQuery UpdateDashboard where
toQuery :: UpdateDashboard -> QueryString
toQuery = QueryString -> UpdateDashboard -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateDashboardResponse = UpdateDashboardResponse'
{
UpdateDashboardResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateDashboardResponse -> UpdateDashboardResponse -> Bool
(UpdateDashboardResponse -> UpdateDashboardResponse -> Bool)
-> (UpdateDashboardResponse -> UpdateDashboardResponse -> Bool)
-> Eq UpdateDashboardResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDashboardResponse -> UpdateDashboardResponse -> Bool
$c/= :: UpdateDashboardResponse -> UpdateDashboardResponse -> Bool
== :: UpdateDashboardResponse -> UpdateDashboardResponse -> Bool
$c== :: UpdateDashboardResponse -> UpdateDashboardResponse -> Bool
Prelude.Eq, ReadPrec [UpdateDashboardResponse]
ReadPrec UpdateDashboardResponse
Int -> ReadS UpdateDashboardResponse
ReadS [UpdateDashboardResponse]
(Int -> ReadS UpdateDashboardResponse)
-> ReadS [UpdateDashboardResponse]
-> ReadPrec UpdateDashboardResponse
-> ReadPrec [UpdateDashboardResponse]
-> Read UpdateDashboardResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDashboardResponse]
$creadListPrec :: ReadPrec [UpdateDashboardResponse]
readPrec :: ReadPrec UpdateDashboardResponse
$creadPrec :: ReadPrec UpdateDashboardResponse
readList :: ReadS [UpdateDashboardResponse]
$creadList :: ReadS [UpdateDashboardResponse]
readsPrec :: Int -> ReadS UpdateDashboardResponse
$creadsPrec :: Int -> ReadS UpdateDashboardResponse
Prelude.Read, Int -> UpdateDashboardResponse -> ShowS
[UpdateDashboardResponse] -> ShowS
UpdateDashboardResponse -> String
(Int -> UpdateDashboardResponse -> ShowS)
-> (UpdateDashboardResponse -> String)
-> ([UpdateDashboardResponse] -> ShowS)
-> Show UpdateDashboardResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDashboardResponse] -> ShowS
$cshowList :: [UpdateDashboardResponse] -> ShowS
show :: UpdateDashboardResponse -> String
$cshow :: UpdateDashboardResponse -> String
showsPrec :: Int -> UpdateDashboardResponse -> ShowS
$cshowsPrec :: Int -> UpdateDashboardResponse -> ShowS
Prelude.Show, (forall x.
UpdateDashboardResponse -> Rep UpdateDashboardResponse x)
-> (forall x.
Rep UpdateDashboardResponse x -> UpdateDashboardResponse)
-> Generic UpdateDashboardResponse
forall x. Rep UpdateDashboardResponse x -> UpdateDashboardResponse
forall x. UpdateDashboardResponse -> Rep UpdateDashboardResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateDashboardResponse x -> UpdateDashboardResponse
$cfrom :: forall x. UpdateDashboardResponse -> Rep UpdateDashboardResponse x
Prelude.Generic)
newUpdateDashboardResponse ::
Prelude.Int ->
UpdateDashboardResponse
newUpdateDashboardResponse :: Int -> UpdateDashboardResponse
newUpdateDashboardResponse Int
pHttpStatus_ =
UpdateDashboardResponse' :: Int -> UpdateDashboardResponse
UpdateDashboardResponse' {$sel:httpStatus:UpdateDashboardResponse' :: Int
httpStatus = Int
pHttpStatus_}
updateDashboardResponse_httpStatus :: Lens.Lens' UpdateDashboardResponse Prelude.Int
updateDashboardResponse_httpStatus :: (Int -> f Int)
-> UpdateDashboardResponse -> f UpdateDashboardResponse
updateDashboardResponse_httpStatus = (UpdateDashboardResponse -> Int)
-> (UpdateDashboardResponse -> Int -> UpdateDashboardResponse)
-> Lens UpdateDashboardResponse UpdateDashboardResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDashboardResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateDashboardResponse' :: UpdateDashboardResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateDashboardResponse
s@UpdateDashboardResponse' {} Int
a -> UpdateDashboardResponse
s {$sel:httpStatus:UpdateDashboardResponse' :: Int
httpStatus = Int
a} :: UpdateDashboardResponse)
instance Prelude.NFData UpdateDashboardResponse