{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.IotTwinMaker.UpdateScene
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates a scene.
module Amazonka.IotTwinMaker.UpdateScene
  ( -- * Creating a Request
    UpdateScene (..),
    newUpdateScene,

    -- * Request Lenses
    updateScene_capabilities,
    updateScene_contentLocation,
    updateScene_description,
    updateScene_workspaceId,
    updateScene_sceneId,

    -- * Destructuring the Response
    UpdateSceneResponse (..),
    newUpdateSceneResponse,

    -- * Response Lenses
    updateSceneResponse_httpStatus,
    updateSceneResponse_updateDateTime,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IotTwinMaker.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newUpdateScene' smart constructor.
data UpdateScene = UpdateScene'
  { -- | A list of capabilities that the scene uses to render.
    UpdateScene -> Maybe [Text]
capabilities :: Prelude.Maybe [Prelude.Text],
    -- | The relative path that specifies the location of the content definition
    -- file.
    UpdateScene -> Maybe Text
contentLocation :: Prelude.Maybe Prelude.Text,
    -- | The description of this scene.
    UpdateScene -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The ID of the workspace that contains the scene.
    UpdateScene -> Text
workspaceId :: Prelude.Text,
    -- | The ID of the scene.
    UpdateScene -> Text
sceneId :: Prelude.Text
  }
  deriving (UpdateScene -> UpdateScene -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateScene -> UpdateScene -> Bool
$c/= :: UpdateScene -> UpdateScene -> Bool
== :: UpdateScene -> UpdateScene -> Bool
$c== :: UpdateScene -> UpdateScene -> Bool
Prelude.Eq, ReadPrec [UpdateScene]
ReadPrec UpdateScene
Int -> ReadS UpdateScene
ReadS [UpdateScene]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateScene]
$creadListPrec :: ReadPrec [UpdateScene]
readPrec :: ReadPrec UpdateScene
$creadPrec :: ReadPrec UpdateScene
readList :: ReadS [UpdateScene]
$creadList :: ReadS [UpdateScene]
readsPrec :: Int -> ReadS UpdateScene
$creadsPrec :: Int -> ReadS UpdateScene
Prelude.Read, Int -> UpdateScene -> ShowS
[UpdateScene] -> ShowS
UpdateScene -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateScene] -> ShowS
$cshowList :: [UpdateScene] -> ShowS
show :: UpdateScene -> String
$cshow :: UpdateScene -> String
showsPrec :: Int -> UpdateScene -> ShowS
$cshowsPrec :: Int -> UpdateScene -> ShowS
Prelude.Show, forall x. Rep UpdateScene x -> UpdateScene
forall x. UpdateScene -> Rep UpdateScene x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateScene x -> UpdateScene
$cfrom :: forall x. UpdateScene -> Rep UpdateScene x
Prelude.Generic)

-- |
-- Create a value of 'UpdateScene' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'capabilities', 'updateScene_capabilities' - A list of capabilities that the scene uses to render.
--
-- 'contentLocation', 'updateScene_contentLocation' - The relative path that specifies the location of the content definition
-- file.
--
-- 'description', 'updateScene_description' - The description of this scene.
--
-- 'workspaceId', 'updateScene_workspaceId' - The ID of the workspace that contains the scene.
--
-- 'sceneId', 'updateScene_sceneId' - The ID of the scene.
newUpdateScene ::
  -- | 'workspaceId'
  Prelude.Text ->
  -- | 'sceneId'
  Prelude.Text ->
  UpdateScene
newUpdateScene :: Text -> Text -> UpdateScene
newUpdateScene Text
pWorkspaceId_ Text
pSceneId_ =
  UpdateScene'
    { $sel:capabilities:UpdateScene' :: Maybe [Text]
capabilities = forall a. Maybe a
Prelude.Nothing,
      $sel:contentLocation:UpdateScene' :: Maybe Text
contentLocation = forall a. Maybe a
Prelude.Nothing,
      $sel:description:UpdateScene' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:workspaceId:UpdateScene' :: Text
workspaceId = Text
pWorkspaceId_,
      $sel:sceneId:UpdateScene' :: Text
sceneId = Text
pSceneId_
    }

-- | A list of capabilities that the scene uses to render.
updateScene_capabilities :: Lens.Lens' UpdateScene (Prelude.Maybe [Prelude.Text])
updateScene_capabilities :: Lens' UpdateScene (Maybe [Text])
updateScene_capabilities = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateScene' {Maybe [Text]
capabilities :: Maybe [Text]
$sel:capabilities:UpdateScene' :: UpdateScene -> Maybe [Text]
capabilities} -> Maybe [Text]
capabilities) (\s :: UpdateScene
s@UpdateScene' {} Maybe [Text]
a -> UpdateScene
s {$sel:capabilities:UpdateScene' :: Maybe [Text]
capabilities = Maybe [Text]
a} :: UpdateScene) 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

-- | The relative path that specifies the location of the content definition
-- file.
updateScene_contentLocation :: Lens.Lens' UpdateScene (Prelude.Maybe Prelude.Text)
updateScene_contentLocation :: Lens' UpdateScene (Maybe Text)
updateScene_contentLocation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateScene' {Maybe Text
contentLocation :: Maybe Text
$sel:contentLocation:UpdateScene' :: UpdateScene -> Maybe Text
contentLocation} -> Maybe Text
contentLocation) (\s :: UpdateScene
s@UpdateScene' {} Maybe Text
a -> UpdateScene
s {$sel:contentLocation:UpdateScene' :: Maybe Text
contentLocation = Maybe Text
a} :: UpdateScene)

-- | The description of this scene.
updateScene_description :: Lens.Lens' UpdateScene (Prelude.Maybe Prelude.Text)
updateScene_description :: Lens' UpdateScene (Maybe Text)
updateScene_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateScene' {Maybe Text
description :: Maybe Text
$sel:description:UpdateScene' :: UpdateScene -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateScene
s@UpdateScene' {} Maybe Text
a -> UpdateScene
s {$sel:description:UpdateScene' :: Maybe Text
description = Maybe Text
a} :: UpdateScene)

-- | The ID of the workspace that contains the scene.
updateScene_workspaceId :: Lens.Lens' UpdateScene Prelude.Text
updateScene_workspaceId :: Lens' UpdateScene Text
updateScene_workspaceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateScene' {Text
workspaceId :: Text
$sel:workspaceId:UpdateScene' :: UpdateScene -> Text
workspaceId} -> Text
workspaceId) (\s :: UpdateScene
s@UpdateScene' {} Text
a -> UpdateScene
s {$sel:workspaceId:UpdateScene' :: Text
workspaceId = Text
a} :: UpdateScene)

-- | The ID of the scene.
updateScene_sceneId :: Lens.Lens' UpdateScene Prelude.Text
updateScene_sceneId :: Lens' UpdateScene Text
updateScene_sceneId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateScene' {Text
sceneId :: Text
$sel:sceneId:UpdateScene' :: UpdateScene -> Text
sceneId} -> Text
sceneId) (\s :: UpdateScene
s@UpdateScene' {} Text
a -> UpdateScene
s {$sel:sceneId:UpdateScene' :: Text
sceneId = Text
a} :: UpdateScene)

instance Core.AWSRequest UpdateScene where
  type AWSResponse UpdateScene = UpdateSceneResponse
  request :: (Service -> Service) -> UpdateScene -> Request UpdateScene
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateScene
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateScene)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> POSIX -> UpdateSceneResponse
UpdateSceneResponse'
            forall (f :: * -> *) a b. Functor 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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"updateDateTime")
      )

instance Prelude.Hashable UpdateScene where
  hashWithSalt :: Int -> UpdateScene -> Int
hashWithSalt Int
_salt UpdateScene' {Maybe [Text]
Maybe Text
Text
sceneId :: Text
workspaceId :: Text
description :: Maybe Text
contentLocation :: Maybe Text
capabilities :: Maybe [Text]
$sel:sceneId:UpdateScene' :: UpdateScene -> Text
$sel:workspaceId:UpdateScene' :: UpdateScene -> Text
$sel:description:UpdateScene' :: UpdateScene -> Maybe Text
$sel:contentLocation:UpdateScene' :: UpdateScene -> Maybe Text
$sel:capabilities:UpdateScene' :: UpdateScene -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
capabilities
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
contentLocation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workspaceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sceneId

instance Prelude.NFData UpdateScene where
  rnf :: UpdateScene -> ()
rnf UpdateScene' {Maybe [Text]
Maybe Text
Text
sceneId :: Text
workspaceId :: Text
description :: Maybe Text
contentLocation :: Maybe Text
capabilities :: Maybe [Text]
$sel:sceneId:UpdateScene' :: UpdateScene -> Text
$sel:workspaceId:UpdateScene' :: UpdateScene -> Text
$sel:description:UpdateScene' :: UpdateScene -> Maybe Text
$sel:contentLocation:UpdateScene' :: UpdateScene -> Maybe Text
$sel:capabilities:UpdateScene' :: UpdateScene -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
capabilities
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
contentLocation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
workspaceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
sceneId

instance Data.ToHeaders UpdateScene where
  toHeaders :: UpdateScene -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON UpdateScene where
  toJSON :: UpdateScene -> Value
toJSON UpdateScene' {Maybe [Text]
Maybe Text
Text
sceneId :: Text
workspaceId :: Text
description :: Maybe Text
contentLocation :: Maybe Text
capabilities :: Maybe [Text]
$sel:sceneId:UpdateScene' :: UpdateScene -> Text
$sel:workspaceId:UpdateScene' :: UpdateScene -> Text
$sel:description:UpdateScene' :: UpdateScene -> Maybe Text
$sel:contentLocation:UpdateScene' :: UpdateScene -> Maybe Text
$sel:capabilities:UpdateScene' :: UpdateScene -> Maybe [Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"capabilities" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
capabilities,
            (Key
"contentLocation" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
contentLocation,
            (Key
"description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description
          ]
      )

instance Data.ToPath UpdateScene where
  toPath :: UpdateScene -> ByteString
toPath UpdateScene' {Maybe [Text]
Maybe Text
Text
sceneId :: Text
workspaceId :: Text
description :: Maybe Text
contentLocation :: Maybe Text
capabilities :: Maybe [Text]
$sel:sceneId:UpdateScene' :: UpdateScene -> Text
$sel:workspaceId:UpdateScene' :: UpdateScene -> Text
$sel:description:UpdateScene' :: UpdateScene -> Maybe Text
$sel:contentLocation:UpdateScene' :: UpdateScene -> Maybe Text
$sel:capabilities:UpdateScene' :: UpdateScene -> Maybe [Text]
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/workspaces/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
workspaceId,
        ByteString
"/scenes/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
sceneId
      ]

instance Data.ToQuery UpdateScene where
  toQuery :: UpdateScene -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newUpdateSceneResponse' smart constructor.
data UpdateSceneResponse = UpdateSceneResponse'
  { -- | The response's http status code.
    UpdateSceneResponse -> Int
httpStatus :: Prelude.Int,
    -- | The date and time when the scene was last updated.
    UpdateSceneResponse -> POSIX
updateDateTime :: Data.POSIX
  }
  deriving (UpdateSceneResponse -> UpdateSceneResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSceneResponse -> UpdateSceneResponse -> Bool
$c/= :: UpdateSceneResponse -> UpdateSceneResponse -> Bool
== :: UpdateSceneResponse -> UpdateSceneResponse -> Bool
$c== :: UpdateSceneResponse -> UpdateSceneResponse -> Bool
Prelude.Eq, ReadPrec [UpdateSceneResponse]
ReadPrec UpdateSceneResponse
Int -> ReadS UpdateSceneResponse
ReadS [UpdateSceneResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSceneResponse]
$creadListPrec :: ReadPrec [UpdateSceneResponse]
readPrec :: ReadPrec UpdateSceneResponse
$creadPrec :: ReadPrec UpdateSceneResponse
readList :: ReadS [UpdateSceneResponse]
$creadList :: ReadS [UpdateSceneResponse]
readsPrec :: Int -> ReadS UpdateSceneResponse
$creadsPrec :: Int -> ReadS UpdateSceneResponse
Prelude.Read, Int -> UpdateSceneResponse -> ShowS
[UpdateSceneResponse] -> ShowS
UpdateSceneResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSceneResponse] -> ShowS
$cshowList :: [UpdateSceneResponse] -> ShowS
show :: UpdateSceneResponse -> String
$cshow :: UpdateSceneResponse -> String
showsPrec :: Int -> UpdateSceneResponse -> ShowS
$cshowsPrec :: Int -> UpdateSceneResponse -> ShowS
Prelude.Show, forall x. Rep UpdateSceneResponse x -> UpdateSceneResponse
forall x. UpdateSceneResponse -> Rep UpdateSceneResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateSceneResponse x -> UpdateSceneResponse
$cfrom :: forall x. UpdateSceneResponse -> Rep UpdateSceneResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateSceneResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'httpStatus', 'updateSceneResponse_httpStatus' - The response's http status code.
--
-- 'updateDateTime', 'updateSceneResponse_updateDateTime' - The date and time when the scene was last updated.
newUpdateSceneResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'updateDateTime'
  Prelude.UTCTime ->
  UpdateSceneResponse
newUpdateSceneResponse :: Int -> UTCTime -> UpdateSceneResponse
newUpdateSceneResponse Int
pHttpStatus_ UTCTime
pUpdateDateTime_ =
  UpdateSceneResponse'
    { $sel:httpStatus:UpdateSceneResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:updateDateTime:UpdateSceneResponse' :: POSIX
updateDateTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pUpdateDateTime_
    }

-- | The response's http status code.
updateSceneResponse_httpStatus :: Lens.Lens' UpdateSceneResponse Prelude.Int
updateSceneResponse_httpStatus :: Lens' UpdateSceneResponse Int
updateSceneResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSceneResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateSceneResponse' :: UpdateSceneResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateSceneResponse
s@UpdateSceneResponse' {} Int
a -> UpdateSceneResponse
s {$sel:httpStatus:UpdateSceneResponse' :: Int
httpStatus = Int
a} :: UpdateSceneResponse)

-- | The date and time when the scene was last updated.
updateSceneResponse_updateDateTime :: Lens.Lens' UpdateSceneResponse Prelude.UTCTime
updateSceneResponse_updateDateTime :: Lens' UpdateSceneResponse UTCTime
updateSceneResponse_updateDateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSceneResponse' {POSIX
updateDateTime :: POSIX
$sel:updateDateTime:UpdateSceneResponse' :: UpdateSceneResponse -> POSIX
updateDateTime} -> POSIX
updateDateTime) (\s :: UpdateSceneResponse
s@UpdateSceneResponse' {} POSIX
a -> UpdateSceneResponse
s {$sel:updateDateTime:UpdateSceneResponse' :: POSIX
updateDateTime = POSIX
a} :: UpdateSceneResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Prelude.NFData UpdateSceneResponse where
  rnf :: UpdateSceneResponse -> ()
rnf UpdateSceneResponse' {Int
POSIX
updateDateTime :: POSIX
httpStatus :: Int
$sel:updateDateTime:UpdateSceneResponse' :: UpdateSceneResponse -> POSIX
$sel:httpStatus:UpdateSceneResponse' :: UpdateSceneResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
updateDateTime