{-# 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.IoTSiteWise.UpdateAssetModel
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates an asset model and all of the assets that were created from the
-- model. Each asset created from the model inherits the updated asset
-- model\'s property and hierarchy definitions. For more information, see
-- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/update-assets-and-models.html Updating assets and models>
-- in the /IoT SiteWise User Guide/.
--
-- This operation overwrites the existing model with the provided model. To
-- avoid deleting your asset model\'s properties or hierarchies, you must
-- include their IDs and definitions in the updated asset model payload.
-- For more information, see
-- <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_DescribeAssetModel.html DescribeAssetModel>.
--
-- If you remove a property from an asset model, IoT SiteWise deletes all
-- previous data for that property. If you remove a hierarchy definition
-- from an asset model, IoT SiteWise disassociates every asset associated
-- with that hierarchy. You can\'t change the type or data type of an
-- existing property.
module Amazonka.IoTSiteWise.UpdateAssetModel
  ( -- * Creating a Request
    UpdateAssetModel (..),
    newUpdateAssetModel,

    -- * Request Lenses
    updateAssetModel_clientToken,
    updateAssetModel_assetModelDescription,
    updateAssetModel_assetModelProperties,
    updateAssetModel_assetModelCompositeModels,
    updateAssetModel_assetModelHierarchies,
    updateAssetModel_assetModelId,
    updateAssetModel_assetModelName,

    -- * Destructuring the Response
    UpdateAssetModelResponse (..),
    newUpdateAssetModelResponse,

    -- * Response Lenses
    updateAssetModelResponse_httpStatus,
    updateAssetModelResponse_assetModelStatus,
  )
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

-- | /See:/ 'newUpdateAssetModel' smart constructor.
data UpdateAssetModel = UpdateAssetModel'
  { -- | A unique case-sensitive identifier that you can provide to ensure the
    -- idempotency of the request. Don\'t reuse this client token if a new
    -- idempotent request is required.
    UpdateAssetModel -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | A description for the asset model.
    UpdateAssetModel -> Maybe Text
assetModelDescription :: Prelude.Maybe Prelude.Text,
    -- | The updated property definitions of the asset model. For more
    -- information, see
    -- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/asset-properties.html Asset properties>
    -- in the /IoT SiteWise User Guide/.
    --
    -- You can specify up to 200 properties per asset model. For more
    -- information, see
    -- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/quotas.html Quotas>
    -- in the /IoT SiteWise User Guide/.
    UpdateAssetModel -> Maybe [AssetModelProperty]
assetModelProperties :: Prelude.Maybe [AssetModelProperty],
    -- | The composite asset models that are part of this asset model. Composite
    -- asset models are asset models that contain specific properties. Each
    -- composite model has a type that defines the properties that the
    -- composite model supports. Use composite asset models to define alarms on
    -- this asset model.
    UpdateAssetModel -> Maybe [AssetModelCompositeModel]
assetModelCompositeModels :: Prelude.Maybe [AssetModelCompositeModel],
    -- | The updated hierarchy definitions of the asset model. Each hierarchy
    -- specifies an asset model whose assets can be children of any other
    -- assets created from this asset model. For more information, see
    -- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/asset-hierarchies.html Asset hierarchies>
    -- in the /IoT SiteWise User Guide/.
    --
    -- You can specify up to 10 hierarchies per asset model. For more
    -- information, see
    -- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/quotas.html Quotas>
    -- in the /IoT SiteWise User Guide/.
    UpdateAssetModel -> Maybe [AssetModelHierarchy]
assetModelHierarchies :: Prelude.Maybe [AssetModelHierarchy],
    -- | The ID of the asset model to update.
    UpdateAssetModel -> Text
assetModelId :: Prelude.Text,
    -- | A unique, friendly name for the asset model.
    UpdateAssetModel -> Text
assetModelName :: Prelude.Text
  }
  deriving (UpdateAssetModel -> UpdateAssetModel -> Bool
(UpdateAssetModel -> UpdateAssetModel -> Bool)
-> (UpdateAssetModel -> UpdateAssetModel -> Bool)
-> Eq UpdateAssetModel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAssetModel -> UpdateAssetModel -> Bool
$c/= :: UpdateAssetModel -> UpdateAssetModel -> Bool
== :: UpdateAssetModel -> UpdateAssetModel -> Bool
$c== :: UpdateAssetModel -> UpdateAssetModel -> Bool
Prelude.Eq, ReadPrec [UpdateAssetModel]
ReadPrec UpdateAssetModel
Int -> ReadS UpdateAssetModel
ReadS [UpdateAssetModel]
(Int -> ReadS UpdateAssetModel)
-> ReadS [UpdateAssetModel]
-> ReadPrec UpdateAssetModel
-> ReadPrec [UpdateAssetModel]
-> Read UpdateAssetModel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAssetModel]
$creadListPrec :: ReadPrec [UpdateAssetModel]
readPrec :: ReadPrec UpdateAssetModel
$creadPrec :: ReadPrec UpdateAssetModel
readList :: ReadS [UpdateAssetModel]
$creadList :: ReadS [UpdateAssetModel]
readsPrec :: Int -> ReadS UpdateAssetModel
$creadsPrec :: Int -> ReadS UpdateAssetModel
Prelude.Read, Int -> UpdateAssetModel -> ShowS
[UpdateAssetModel] -> ShowS
UpdateAssetModel -> String
(Int -> UpdateAssetModel -> ShowS)
-> (UpdateAssetModel -> String)
-> ([UpdateAssetModel] -> ShowS)
-> Show UpdateAssetModel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAssetModel] -> ShowS
$cshowList :: [UpdateAssetModel] -> ShowS
show :: UpdateAssetModel -> String
$cshow :: UpdateAssetModel -> String
showsPrec :: Int -> UpdateAssetModel -> ShowS
$cshowsPrec :: Int -> UpdateAssetModel -> ShowS
Prelude.Show, (forall x. UpdateAssetModel -> Rep UpdateAssetModel x)
-> (forall x. Rep UpdateAssetModel x -> UpdateAssetModel)
-> Generic UpdateAssetModel
forall x. Rep UpdateAssetModel x -> UpdateAssetModel
forall x. UpdateAssetModel -> Rep UpdateAssetModel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateAssetModel x -> UpdateAssetModel
$cfrom :: forall x. UpdateAssetModel -> Rep UpdateAssetModel x
Prelude.Generic)

-- |
-- Create a value of 'UpdateAssetModel' 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:
--
-- 'clientToken', 'updateAssetModel_clientToken' - A unique case-sensitive identifier that you can provide to ensure the
-- idempotency of the request. Don\'t reuse this client token if a new
-- idempotent request is required.
--
-- 'assetModelDescription', 'updateAssetModel_assetModelDescription' - A description for the asset model.
--
-- 'assetModelProperties', 'updateAssetModel_assetModelProperties' - The updated property definitions of the asset model. For more
-- information, see
-- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/asset-properties.html Asset properties>
-- in the /IoT SiteWise User Guide/.
--
-- You can specify up to 200 properties per asset model. For more
-- information, see
-- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/quotas.html Quotas>
-- in the /IoT SiteWise User Guide/.
--
-- 'assetModelCompositeModels', 'updateAssetModel_assetModelCompositeModels' - The composite asset models that are part of this asset model. Composite
-- asset models are asset models that contain specific properties. Each
-- composite model has a type that defines the properties that the
-- composite model supports. Use composite asset models to define alarms on
-- this asset model.
--
-- 'assetModelHierarchies', 'updateAssetModel_assetModelHierarchies' - The updated hierarchy definitions of the asset model. Each hierarchy
-- specifies an asset model whose assets can be children of any other
-- assets created from this asset model. For more information, see
-- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/asset-hierarchies.html Asset hierarchies>
-- in the /IoT SiteWise User Guide/.
--
-- You can specify up to 10 hierarchies per asset model. For more
-- information, see
-- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/quotas.html Quotas>
-- in the /IoT SiteWise User Guide/.
--
-- 'assetModelId', 'updateAssetModel_assetModelId' - The ID of the asset model to update.
--
-- 'assetModelName', 'updateAssetModel_assetModelName' - A unique, friendly name for the asset model.
newUpdateAssetModel ::
  -- | 'assetModelId'
  Prelude.Text ->
  -- | 'assetModelName'
  Prelude.Text ->
  UpdateAssetModel
newUpdateAssetModel :: Text -> Text -> UpdateAssetModel
newUpdateAssetModel Text
pAssetModelId_ Text
pAssetModelName_ =
  UpdateAssetModel' :: Maybe Text
-> Maybe Text
-> Maybe [AssetModelProperty]
-> Maybe [AssetModelCompositeModel]
-> Maybe [AssetModelHierarchy]
-> Text
-> Text
-> UpdateAssetModel
UpdateAssetModel'
    { $sel:clientToken:UpdateAssetModel' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:assetModelDescription:UpdateAssetModel' :: Maybe Text
assetModelDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:assetModelProperties:UpdateAssetModel' :: Maybe [AssetModelProperty]
assetModelProperties = Maybe [AssetModelProperty]
forall a. Maybe a
Prelude.Nothing,
      $sel:assetModelCompositeModels:UpdateAssetModel' :: Maybe [AssetModelCompositeModel]
assetModelCompositeModels = Maybe [AssetModelCompositeModel]
forall a. Maybe a
Prelude.Nothing,
      $sel:assetModelHierarchies:UpdateAssetModel' :: Maybe [AssetModelHierarchy]
assetModelHierarchies = Maybe [AssetModelHierarchy]
forall a. Maybe a
Prelude.Nothing,
      $sel:assetModelId:UpdateAssetModel' :: Text
assetModelId = Text
pAssetModelId_,
      $sel:assetModelName:UpdateAssetModel' :: Text
assetModelName = Text
pAssetModelName_
    }

-- | A unique case-sensitive identifier that you can provide to ensure the
-- idempotency of the request. Don\'t reuse this client token if a new
-- idempotent request is required.
updateAssetModel_clientToken :: Lens.Lens' UpdateAssetModel (Prelude.Maybe Prelude.Text)
updateAssetModel_clientToken :: (Maybe Text -> f (Maybe Text))
-> UpdateAssetModel -> f UpdateAssetModel
updateAssetModel_clientToken = (UpdateAssetModel -> Maybe Text)
-> (UpdateAssetModel -> Maybe Text -> UpdateAssetModel)
-> Lens UpdateAssetModel UpdateAssetModel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssetModel' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:UpdateAssetModel' :: UpdateAssetModel -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: UpdateAssetModel
s@UpdateAssetModel' {} Maybe Text
a -> UpdateAssetModel
s {$sel:clientToken:UpdateAssetModel' :: Maybe Text
clientToken = Maybe Text
a} :: UpdateAssetModel)

-- | A description for the asset model.
updateAssetModel_assetModelDescription :: Lens.Lens' UpdateAssetModel (Prelude.Maybe Prelude.Text)
updateAssetModel_assetModelDescription :: (Maybe Text -> f (Maybe Text))
-> UpdateAssetModel -> f UpdateAssetModel
updateAssetModel_assetModelDescription = (UpdateAssetModel -> Maybe Text)
-> (UpdateAssetModel -> Maybe Text -> UpdateAssetModel)
-> Lens UpdateAssetModel UpdateAssetModel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssetModel' {Maybe Text
assetModelDescription :: Maybe Text
$sel:assetModelDescription:UpdateAssetModel' :: UpdateAssetModel -> Maybe Text
assetModelDescription} -> Maybe Text
assetModelDescription) (\s :: UpdateAssetModel
s@UpdateAssetModel' {} Maybe Text
a -> UpdateAssetModel
s {$sel:assetModelDescription:UpdateAssetModel' :: Maybe Text
assetModelDescription = Maybe Text
a} :: UpdateAssetModel)

-- | The updated property definitions of the asset model. For more
-- information, see
-- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/asset-properties.html Asset properties>
-- in the /IoT SiteWise User Guide/.
--
-- You can specify up to 200 properties per asset model. For more
-- information, see
-- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/quotas.html Quotas>
-- in the /IoT SiteWise User Guide/.
updateAssetModel_assetModelProperties :: Lens.Lens' UpdateAssetModel (Prelude.Maybe [AssetModelProperty])
updateAssetModel_assetModelProperties :: (Maybe [AssetModelProperty] -> f (Maybe [AssetModelProperty]))
-> UpdateAssetModel -> f UpdateAssetModel
updateAssetModel_assetModelProperties = (UpdateAssetModel -> Maybe [AssetModelProperty])
-> (UpdateAssetModel
    -> Maybe [AssetModelProperty] -> UpdateAssetModel)
-> Lens
     UpdateAssetModel
     UpdateAssetModel
     (Maybe [AssetModelProperty])
     (Maybe [AssetModelProperty])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssetModel' {Maybe [AssetModelProperty]
assetModelProperties :: Maybe [AssetModelProperty]
$sel:assetModelProperties:UpdateAssetModel' :: UpdateAssetModel -> Maybe [AssetModelProperty]
assetModelProperties} -> Maybe [AssetModelProperty]
assetModelProperties) (\s :: UpdateAssetModel
s@UpdateAssetModel' {} Maybe [AssetModelProperty]
a -> UpdateAssetModel
s {$sel:assetModelProperties:UpdateAssetModel' :: Maybe [AssetModelProperty]
assetModelProperties = Maybe [AssetModelProperty]
a} :: UpdateAssetModel) ((Maybe [AssetModelProperty] -> f (Maybe [AssetModelProperty]))
 -> UpdateAssetModel -> f UpdateAssetModel)
-> ((Maybe [AssetModelProperty] -> f (Maybe [AssetModelProperty]))
    -> Maybe [AssetModelProperty] -> f (Maybe [AssetModelProperty]))
-> (Maybe [AssetModelProperty] -> f (Maybe [AssetModelProperty]))
-> UpdateAssetModel
-> f UpdateAssetModel
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AssetModelProperty]
  [AssetModelProperty]
  [AssetModelProperty]
  [AssetModelProperty]
-> Iso
     (Maybe [AssetModelProperty])
     (Maybe [AssetModelProperty])
     (Maybe [AssetModelProperty])
     (Maybe [AssetModelProperty])
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
  [AssetModelProperty]
  [AssetModelProperty]
  [AssetModelProperty]
  [AssetModelProperty]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The composite asset models that are part of this asset model. Composite
-- asset models are asset models that contain specific properties. Each
-- composite model has a type that defines the properties that the
-- composite model supports. Use composite asset models to define alarms on
-- this asset model.
updateAssetModel_assetModelCompositeModels :: Lens.Lens' UpdateAssetModel (Prelude.Maybe [AssetModelCompositeModel])
updateAssetModel_assetModelCompositeModels :: (Maybe [AssetModelCompositeModel]
 -> f (Maybe [AssetModelCompositeModel]))
-> UpdateAssetModel -> f UpdateAssetModel
updateAssetModel_assetModelCompositeModels = (UpdateAssetModel -> Maybe [AssetModelCompositeModel])
-> (UpdateAssetModel
    -> Maybe [AssetModelCompositeModel] -> UpdateAssetModel)
-> Lens
     UpdateAssetModel
     UpdateAssetModel
     (Maybe [AssetModelCompositeModel])
     (Maybe [AssetModelCompositeModel])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssetModel' {Maybe [AssetModelCompositeModel]
assetModelCompositeModels :: Maybe [AssetModelCompositeModel]
$sel:assetModelCompositeModels:UpdateAssetModel' :: UpdateAssetModel -> Maybe [AssetModelCompositeModel]
assetModelCompositeModels} -> Maybe [AssetModelCompositeModel]
assetModelCompositeModels) (\s :: UpdateAssetModel
s@UpdateAssetModel' {} Maybe [AssetModelCompositeModel]
a -> UpdateAssetModel
s {$sel:assetModelCompositeModels:UpdateAssetModel' :: Maybe [AssetModelCompositeModel]
assetModelCompositeModels = Maybe [AssetModelCompositeModel]
a} :: UpdateAssetModel) ((Maybe [AssetModelCompositeModel]
  -> f (Maybe [AssetModelCompositeModel]))
 -> UpdateAssetModel -> f UpdateAssetModel)
-> ((Maybe [AssetModelCompositeModel]
     -> f (Maybe [AssetModelCompositeModel]))
    -> Maybe [AssetModelCompositeModel]
    -> f (Maybe [AssetModelCompositeModel]))
-> (Maybe [AssetModelCompositeModel]
    -> f (Maybe [AssetModelCompositeModel]))
-> UpdateAssetModel
-> f UpdateAssetModel
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AssetModelCompositeModel]
  [AssetModelCompositeModel]
  [AssetModelCompositeModel]
  [AssetModelCompositeModel]
-> Iso
     (Maybe [AssetModelCompositeModel])
     (Maybe [AssetModelCompositeModel])
     (Maybe [AssetModelCompositeModel])
     (Maybe [AssetModelCompositeModel])
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
  [AssetModelCompositeModel]
  [AssetModelCompositeModel]
  [AssetModelCompositeModel]
  [AssetModelCompositeModel]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The updated hierarchy definitions of the asset model. Each hierarchy
-- specifies an asset model whose assets can be children of any other
-- assets created from this asset model. For more information, see
-- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/asset-hierarchies.html Asset hierarchies>
-- in the /IoT SiteWise User Guide/.
--
-- You can specify up to 10 hierarchies per asset model. For more
-- information, see
-- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/quotas.html Quotas>
-- in the /IoT SiteWise User Guide/.
updateAssetModel_assetModelHierarchies :: Lens.Lens' UpdateAssetModel (Prelude.Maybe [AssetModelHierarchy])
updateAssetModel_assetModelHierarchies :: (Maybe [AssetModelHierarchy] -> f (Maybe [AssetModelHierarchy]))
-> UpdateAssetModel -> f UpdateAssetModel
updateAssetModel_assetModelHierarchies = (UpdateAssetModel -> Maybe [AssetModelHierarchy])
-> (UpdateAssetModel
    -> Maybe [AssetModelHierarchy] -> UpdateAssetModel)
-> Lens
     UpdateAssetModel
     UpdateAssetModel
     (Maybe [AssetModelHierarchy])
     (Maybe [AssetModelHierarchy])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssetModel' {Maybe [AssetModelHierarchy]
assetModelHierarchies :: Maybe [AssetModelHierarchy]
$sel:assetModelHierarchies:UpdateAssetModel' :: UpdateAssetModel -> Maybe [AssetModelHierarchy]
assetModelHierarchies} -> Maybe [AssetModelHierarchy]
assetModelHierarchies) (\s :: UpdateAssetModel
s@UpdateAssetModel' {} Maybe [AssetModelHierarchy]
a -> UpdateAssetModel
s {$sel:assetModelHierarchies:UpdateAssetModel' :: Maybe [AssetModelHierarchy]
assetModelHierarchies = Maybe [AssetModelHierarchy]
a} :: UpdateAssetModel) ((Maybe [AssetModelHierarchy] -> f (Maybe [AssetModelHierarchy]))
 -> UpdateAssetModel -> f UpdateAssetModel)
-> ((Maybe [AssetModelHierarchy]
     -> f (Maybe [AssetModelHierarchy]))
    -> Maybe [AssetModelHierarchy] -> f (Maybe [AssetModelHierarchy]))
-> (Maybe [AssetModelHierarchy] -> f (Maybe [AssetModelHierarchy]))
-> UpdateAssetModel
-> f UpdateAssetModel
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AssetModelHierarchy]
  [AssetModelHierarchy]
  [AssetModelHierarchy]
  [AssetModelHierarchy]
-> Iso
     (Maybe [AssetModelHierarchy])
     (Maybe [AssetModelHierarchy])
     (Maybe [AssetModelHierarchy])
     (Maybe [AssetModelHierarchy])
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
  [AssetModelHierarchy]
  [AssetModelHierarchy]
  [AssetModelHierarchy]
  [AssetModelHierarchy]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the asset model to update.
updateAssetModel_assetModelId :: Lens.Lens' UpdateAssetModel Prelude.Text
updateAssetModel_assetModelId :: (Text -> f Text) -> UpdateAssetModel -> f UpdateAssetModel
updateAssetModel_assetModelId = (UpdateAssetModel -> Text)
-> (UpdateAssetModel -> Text -> UpdateAssetModel)
-> Lens UpdateAssetModel UpdateAssetModel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssetModel' {Text
assetModelId :: Text
$sel:assetModelId:UpdateAssetModel' :: UpdateAssetModel -> Text
assetModelId} -> Text
assetModelId) (\s :: UpdateAssetModel
s@UpdateAssetModel' {} Text
a -> UpdateAssetModel
s {$sel:assetModelId:UpdateAssetModel' :: Text
assetModelId = Text
a} :: UpdateAssetModel)

-- | A unique, friendly name for the asset model.
updateAssetModel_assetModelName :: Lens.Lens' UpdateAssetModel Prelude.Text
updateAssetModel_assetModelName :: (Text -> f Text) -> UpdateAssetModel -> f UpdateAssetModel
updateAssetModel_assetModelName = (UpdateAssetModel -> Text)
-> (UpdateAssetModel -> Text -> UpdateAssetModel)
-> Lens UpdateAssetModel UpdateAssetModel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssetModel' {Text
assetModelName :: Text
$sel:assetModelName:UpdateAssetModel' :: UpdateAssetModel -> Text
assetModelName} -> Text
assetModelName) (\s :: UpdateAssetModel
s@UpdateAssetModel' {} Text
a -> UpdateAssetModel
s {$sel:assetModelName:UpdateAssetModel' :: Text
assetModelName = Text
a} :: UpdateAssetModel)

instance Core.AWSRequest UpdateAssetModel where
  type
    AWSResponse UpdateAssetModel =
      UpdateAssetModelResponse
  request :: UpdateAssetModel -> Request UpdateAssetModel
request = Service -> UpdateAssetModel -> Request UpdateAssetModel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateAssetModel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateAssetModel)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateAssetModel))
-> Logger
-> Service
-> Proxy UpdateAssetModel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateAssetModel)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> AssetModelStatus -> UpdateAssetModelResponse
UpdateAssetModelResponse'
            (Int -> AssetModelStatus -> UpdateAssetModelResponse)
-> Either String Int
-> Either String (AssetModelStatus -> UpdateAssetModelResponse)
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))
            Either String (AssetModelStatus -> UpdateAssetModelResponse)
-> Either String AssetModelStatus
-> Either String UpdateAssetModelResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String AssetModelStatus
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"assetModelStatus")
      )

instance Prelude.Hashable UpdateAssetModel

instance Prelude.NFData UpdateAssetModel

instance Core.ToHeaders UpdateAssetModel where
  toHeaders :: UpdateAssetModel -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateAssetModel -> 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 UpdateAssetModel where
  toJSON :: UpdateAssetModel -> Value
toJSON UpdateAssetModel' {Maybe [AssetModelHierarchy]
Maybe [AssetModelProperty]
Maybe [AssetModelCompositeModel]
Maybe Text
Text
assetModelName :: Text
assetModelId :: Text
assetModelHierarchies :: Maybe [AssetModelHierarchy]
assetModelCompositeModels :: Maybe [AssetModelCompositeModel]
assetModelProperties :: Maybe [AssetModelProperty]
assetModelDescription :: Maybe Text
clientToken :: Maybe Text
$sel:assetModelName:UpdateAssetModel' :: UpdateAssetModel -> Text
$sel:assetModelId:UpdateAssetModel' :: UpdateAssetModel -> Text
$sel:assetModelHierarchies:UpdateAssetModel' :: UpdateAssetModel -> Maybe [AssetModelHierarchy]
$sel:assetModelCompositeModels:UpdateAssetModel' :: UpdateAssetModel -> Maybe [AssetModelCompositeModel]
$sel:assetModelProperties:UpdateAssetModel' :: UpdateAssetModel -> Maybe [AssetModelProperty]
$sel:assetModelDescription:UpdateAssetModel' :: UpdateAssetModel -> Maybe Text
$sel:clientToken:UpdateAssetModel' :: UpdateAssetModel -> 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
"assetModelDescription" 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
assetModelDescription,
            (Text
"assetModelProperties" Text -> [AssetModelProperty] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([AssetModelProperty] -> Pair)
-> Maybe [AssetModelProperty] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AssetModelProperty]
assetModelProperties,
            (Text
"assetModelCompositeModels" Text -> [AssetModelCompositeModel] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([AssetModelCompositeModel] -> Pair)
-> Maybe [AssetModelCompositeModel] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AssetModelCompositeModel]
assetModelCompositeModels,
            (Text
"assetModelHierarchies" Text -> [AssetModelHierarchy] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([AssetModelHierarchy] -> Pair)
-> Maybe [AssetModelHierarchy] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AssetModelHierarchy]
assetModelHierarchies,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"assetModelName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
assetModelName)
          ]
      )

instance Core.ToPath UpdateAssetModel where
  toPath :: UpdateAssetModel -> ByteString
toPath UpdateAssetModel' {Maybe [AssetModelHierarchy]
Maybe [AssetModelProperty]
Maybe [AssetModelCompositeModel]
Maybe Text
Text
assetModelName :: Text
assetModelId :: Text
assetModelHierarchies :: Maybe [AssetModelHierarchy]
assetModelCompositeModels :: Maybe [AssetModelCompositeModel]
assetModelProperties :: Maybe [AssetModelProperty]
assetModelDescription :: Maybe Text
clientToken :: Maybe Text
$sel:assetModelName:UpdateAssetModel' :: UpdateAssetModel -> Text
$sel:assetModelId:UpdateAssetModel' :: UpdateAssetModel -> Text
$sel:assetModelHierarchies:UpdateAssetModel' :: UpdateAssetModel -> Maybe [AssetModelHierarchy]
$sel:assetModelCompositeModels:UpdateAssetModel' :: UpdateAssetModel -> Maybe [AssetModelCompositeModel]
$sel:assetModelProperties:UpdateAssetModel' :: UpdateAssetModel -> Maybe [AssetModelProperty]
$sel:assetModelDescription:UpdateAssetModel' :: UpdateAssetModel -> Maybe Text
$sel:clientToken:UpdateAssetModel' :: UpdateAssetModel -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/asset-models/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
assetModelId]

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

-- | /See:/ 'newUpdateAssetModelResponse' smart constructor.
data UpdateAssetModelResponse = UpdateAssetModelResponse'
  { -- | The response's http status code.
    UpdateAssetModelResponse -> Int
httpStatus :: Prelude.Int,
    -- | The status of the asset model, which contains a state (@UPDATING@ after
    -- successfully calling this operation) and any error message.
    UpdateAssetModelResponse -> AssetModelStatus
assetModelStatus :: AssetModelStatus
  }
  deriving (UpdateAssetModelResponse -> UpdateAssetModelResponse -> Bool
(UpdateAssetModelResponse -> UpdateAssetModelResponse -> Bool)
-> (UpdateAssetModelResponse -> UpdateAssetModelResponse -> Bool)
-> Eq UpdateAssetModelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAssetModelResponse -> UpdateAssetModelResponse -> Bool
$c/= :: UpdateAssetModelResponse -> UpdateAssetModelResponse -> Bool
== :: UpdateAssetModelResponse -> UpdateAssetModelResponse -> Bool
$c== :: UpdateAssetModelResponse -> UpdateAssetModelResponse -> Bool
Prelude.Eq, ReadPrec [UpdateAssetModelResponse]
ReadPrec UpdateAssetModelResponse
Int -> ReadS UpdateAssetModelResponse
ReadS [UpdateAssetModelResponse]
(Int -> ReadS UpdateAssetModelResponse)
-> ReadS [UpdateAssetModelResponse]
-> ReadPrec UpdateAssetModelResponse
-> ReadPrec [UpdateAssetModelResponse]
-> Read UpdateAssetModelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAssetModelResponse]
$creadListPrec :: ReadPrec [UpdateAssetModelResponse]
readPrec :: ReadPrec UpdateAssetModelResponse
$creadPrec :: ReadPrec UpdateAssetModelResponse
readList :: ReadS [UpdateAssetModelResponse]
$creadList :: ReadS [UpdateAssetModelResponse]
readsPrec :: Int -> ReadS UpdateAssetModelResponse
$creadsPrec :: Int -> ReadS UpdateAssetModelResponse
Prelude.Read, Int -> UpdateAssetModelResponse -> ShowS
[UpdateAssetModelResponse] -> ShowS
UpdateAssetModelResponse -> String
(Int -> UpdateAssetModelResponse -> ShowS)
-> (UpdateAssetModelResponse -> String)
-> ([UpdateAssetModelResponse] -> ShowS)
-> Show UpdateAssetModelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAssetModelResponse] -> ShowS
$cshowList :: [UpdateAssetModelResponse] -> ShowS
show :: UpdateAssetModelResponse -> String
$cshow :: UpdateAssetModelResponse -> String
showsPrec :: Int -> UpdateAssetModelResponse -> ShowS
$cshowsPrec :: Int -> UpdateAssetModelResponse -> ShowS
Prelude.Show, (forall x.
 UpdateAssetModelResponse -> Rep UpdateAssetModelResponse x)
-> (forall x.
    Rep UpdateAssetModelResponse x -> UpdateAssetModelResponse)
-> Generic UpdateAssetModelResponse
forall x.
Rep UpdateAssetModelResponse x -> UpdateAssetModelResponse
forall x.
UpdateAssetModelResponse -> Rep UpdateAssetModelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateAssetModelResponse x -> UpdateAssetModelResponse
$cfrom :: forall x.
UpdateAssetModelResponse -> Rep UpdateAssetModelResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateAssetModelResponse' 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', 'updateAssetModelResponse_httpStatus' - The response's http status code.
--
-- 'assetModelStatus', 'updateAssetModelResponse_assetModelStatus' - The status of the asset model, which contains a state (@UPDATING@ after
-- successfully calling this operation) and any error message.
newUpdateAssetModelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'assetModelStatus'
  AssetModelStatus ->
  UpdateAssetModelResponse
newUpdateAssetModelResponse :: Int -> AssetModelStatus -> UpdateAssetModelResponse
newUpdateAssetModelResponse
  Int
pHttpStatus_
  AssetModelStatus
pAssetModelStatus_ =
    UpdateAssetModelResponse' :: Int -> AssetModelStatus -> UpdateAssetModelResponse
UpdateAssetModelResponse'
      { $sel:httpStatus:UpdateAssetModelResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:assetModelStatus:UpdateAssetModelResponse' :: AssetModelStatus
assetModelStatus = AssetModelStatus
pAssetModelStatus_
      }

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

-- | The status of the asset model, which contains a state (@UPDATING@ after
-- successfully calling this operation) and any error message.
updateAssetModelResponse_assetModelStatus :: Lens.Lens' UpdateAssetModelResponse AssetModelStatus
updateAssetModelResponse_assetModelStatus :: (AssetModelStatus -> f AssetModelStatus)
-> UpdateAssetModelResponse -> f UpdateAssetModelResponse
updateAssetModelResponse_assetModelStatus = (UpdateAssetModelResponse -> AssetModelStatus)
-> (UpdateAssetModelResponse
    -> AssetModelStatus -> UpdateAssetModelResponse)
-> Lens
     UpdateAssetModelResponse
     UpdateAssetModelResponse
     AssetModelStatus
     AssetModelStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssetModelResponse' {AssetModelStatus
assetModelStatus :: AssetModelStatus
$sel:assetModelStatus:UpdateAssetModelResponse' :: UpdateAssetModelResponse -> AssetModelStatus
assetModelStatus} -> AssetModelStatus
assetModelStatus) (\s :: UpdateAssetModelResponse
s@UpdateAssetModelResponse' {} AssetModelStatus
a -> UpdateAssetModelResponse
s {$sel:assetModelStatus:UpdateAssetModelResponse' :: AssetModelStatus
assetModelStatus = AssetModelStatus
a} :: UpdateAssetModelResponse)

instance Prelude.NFData UpdateAssetModelResponse