{-# 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.CreateAssetModel
(
CreateAssetModel (..),
newCreateAssetModel,
createAssetModel_clientToken,
createAssetModel_assetModelDescription,
createAssetModel_assetModelProperties,
createAssetModel_assetModelCompositeModels,
createAssetModel_assetModelHierarchies,
createAssetModel_tags,
createAssetModel_assetModelName,
CreateAssetModelResponse (..),
newCreateAssetModelResponse,
createAssetModelResponse_httpStatus,
createAssetModelResponse_assetModelId,
createAssetModelResponse_assetModelArn,
createAssetModelResponse_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
data CreateAssetModel = CreateAssetModel'
{
CreateAssetModel -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
CreateAssetModel -> Maybe Text
assetModelDescription :: Prelude.Maybe Prelude.Text,
CreateAssetModel -> Maybe [AssetModelPropertyDefinition]
assetModelProperties :: Prelude.Maybe [AssetModelPropertyDefinition],
CreateAssetModel -> Maybe [AssetModelCompositeModelDefinition]
assetModelCompositeModels :: Prelude.Maybe [AssetModelCompositeModelDefinition],
CreateAssetModel -> Maybe [AssetModelHierarchyDefinition]
assetModelHierarchies :: Prelude.Maybe [AssetModelHierarchyDefinition],
CreateAssetModel -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
CreateAssetModel -> Text
assetModelName :: Prelude.Text
}
deriving (CreateAssetModel -> CreateAssetModel -> Bool
(CreateAssetModel -> CreateAssetModel -> Bool)
-> (CreateAssetModel -> CreateAssetModel -> Bool)
-> Eq CreateAssetModel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAssetModel -> CreateAssetModel -> Bool
$c/= :: CreateAssetModel -> CreateAssetModel -> Bool
== :: CreateAssetModel -> CreateAssetModel -> Bool
$c== :: CreateAssetModel -> CreateAssetModel -> Bool
Prelude.Eq, ReadPrec [CreateAssetModel]
ReadPrec CreateAssetModel
Int -> ReadS CreateAssetModel
ReadS [CreateAssetModel]
(Int -> ReadS CreateAssetModel)
-> ReadS [CreateAssetModel]
-> ReadPrec CreateAssetModel
-> ReadPrec [CreateAssetModel]
-> Read CreateAssetModel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAssetModel]
$creadListPrec :: ReadPrec [CreateAssetModel]
readPrec :: ReadPrec CreateAssetModel
$creadPrec :: ReadPrec CreateAssetModel
readList :: ReadS [CreateAssetModel]
$creadList :: ReadS [CreateAssetModel]
readsPrec :: Int -> ReadS CreateAssetModel
$creadsPrec :: Int -> ReadS CreateAssetModel
Prelude.Read, Int -> CreateAssetModel -> ShowS
[CreateAssetModel] -> ShowS
CreateAssetModel -> String
(Int -> CreateAssetModel -> ShowS)
-> (CreateAssetModel -> String)
-> ([CreateAssetModel] -> ShowS)
-> Show CreateAssetModel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAssetModel] -> ShowS
$cshowList :: [CreateAssetModel] -> ShowS
show :: CreateAssetModel -> String
$cshow :: CreateAssetModel -> String
showsPrec :: Int -> CreateAssetModel -> ShowS
$cshowsPrec :: Int -> CreateAssetModel -> ShowS
Prelude.Show, (forall x. CreateAssetModel -> Rep CreateAssetModel x)
-> (forall x. Rep CreateAssetModel x -> CreateAssetModel)
-> Generic CreateAssetModel
forall x. Rep CreateAssetModel x -> CreateAssetModel
forall x. CreateAssetModel -> Rep CreateAssetModel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAssetModel x -> CreateAssetModel
$cfrom :: forall x. CreateAssetModel -> Rep CreateAssetModel x
Prelude.Generic)
newCreateAssetModel ::
Prelude.Text ->
CreateAssetModel
newCreateAssetModel :: Text -> CreateAssetModel
newCreateAssetModel Text
pAssetModelName_ =
CreateAssetModel' :: Maybe Text
-> Maybe Text
-> Maybe [AssetModelPropertyDefinition]
-> Maybe [AssetModelCompositeModelDefinition]
-> Maybe [AssetModelHierarchyDefinition]
-> Maybe (HashMap Text Text)
-> Text
-> CreateAssetModel
CreateAssetModel'
{ $sel:clientToken:CreateAssetModel' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:assetModelDescription:CreateAssetModel' :: Maybe Text
assetModelDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:assetModelProperties:CreateAssetModel' :: Maybe [AssetModelPropertyDefinition]
assetModelProperties = Maybe [AssetModelPropertyDefinition]
forall a. Maybe a
Prelude.Nothing,
$sel:assetModelCompositeModels:CreateAssetModel' :: Maybe [AssetModelCompositeModelDefinition]
assetModelCompositeModels = Maybe [AssetModelCompositeModelDefinition]
forall a. Maybe a
Prelude.Nothing,
$sel:assetModelHierarchies:CreateAssetModel' :: Maybe [AssetModelHierarchyDefinition]
assetModelHierarchies = Maybe [AssetModelHierarchyDefinition]
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateAssetModel' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:assetModelName:CreateAssetModel' :: Text
assetModelName = Text
pAssetModelName_
}
createAssetModel_clientToken :: Lens.Lens' CreateAssetModel (Prelude.Maybe Prelude.Text)
createAssetModel_clientToken :: (Maybe Text -> f (Maybe Text))
-> CreateAssetModel -> f CreateAssetModel
createAssetModel_clientToken = (CreateAssetModel -> Maybe Text)
-> (CreateAssetModel -> Maybe Text -> CreateAssetModel)
-> Lens CreateAssetModel CreateAssetModel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssetModel' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateAssetModel' :: CreateAssetModel -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateAssetModel
s@CreateAssetModel' {} Maybe Text
a -> CreateAssetModel
s {$sel:clientToken:CreateAssetModel' :: Maybe Text
clientToken = Maybe Text
a} :: CreateAssetModel)
createAssetModel_assetModelDescription :: Lens.Lens' CreateAssetModel (Prelude.Maybe Prelude.Text)
createAssetModel_assetModelDescription :: (Maybe Text -> f (Maybe Text))
-> CreateAssetModel -> f CreateAssetModel
createAssetModel_assetModelDescription = (CreateAssetModel -> Maybe Text)
-> (CreateAssetModel -> Maybe Text -> CreateAssetModel)
-> Lens CreateAssetModel CreateAssetModel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssetModel' {Maybe Text
assetModelDescription :: Maybe Text
$sel:assetModelDescription:CreateAssetModel' :: CreateAssetModel -> Maybe Text
assetModelDescription} -> Maybe Text
assetModelDescription) (\s :: CreateAssetModel
s@CreateAssetModel' {} Maybe Text
a -> CreateAssetModel
s {$sel:assetModelDescription:CreateAssetModel' :: Maybe Text
assetModelDescription = Maybe Text
a} :: CreateAssetModel)
createAssetModel_assetModelProperties :: Lens.Lens' CreateAssetModel (Prelude.Maybe [AssetModelPropertyDefinition])
createAssetModel_assetModelProperties :: (Maybe [AssetModelPropertyDefinition]
-> f (Maybe [AssetModelPropertyDefinition]))
-> CreateAssetModel -> f CreateAssetModel
createAssetModel_assetModelProperties = (CreateAssetModel -> Maybe [AssetModelPropertyDefinition])
-> (CreateAssetModel
-> Maybe [AssetModelPropertyDefinition] -> CreateAssetModel)
-> Lens
CreateAssetModel
CreateAssetModel
(Maybe [AssetModelPropertyDefinition])
(Maybe [AssetModelPropertyDefinition])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssetModel' {Maybe [AssetModelPropertyDefinition]
assetModelProperties :: Maybe [AssetModelPropertyDefinition]
$sel:assetModelProperties:CreateAssetModel' :: CreateAssetModel -> Maybe [AssetModelPropertyDefinition]
assetModelProperties} -> Maybe [AssetModelPropertyDefinition]
assetModelProperties) (\s :: CreateAssetModel
s@CreateAssetModel' {} Maybe [AssetModelPropertyDefinition]
a -> CreateAssetModel
s {$sel:assetModelProperties:CreateAssetModel' :: Maybe [AssetModelPropertyDefinition]
assetModelProperties = Maybe [AssetModelPropertyDefinition]
a} :: CreateAssetModel) ((Maybe [AssetModelPropertyDefinition]
-> f (Maybe [AssetModelPropertyDefinition]))
-> CreateAssetModel -> f CreateAssetModel)
-> ((Maybe [AssetModelPropertyDefinition]
-> f (Maybe [AssetModelPropertyDefinition]))
-> Maybe [AssetModelPropertyDefinition]
-> f (Maybe [AssetModelPropertyDefinition]))
-> (Maybe [AssetModelPropertyDefinition]
-> f (Maybe [AssetModelPropertyDefinition]))
-> CreateAssetModel
-> f CreateAssetModel
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[AssetModelPropertyDefinition]
[AssetModelPropertyDefinition]
[AssetModelPropertyDefinition]
[AssetModelPropertyDefinition]
-> Iso
(Maybe [AssetModelPropertyDefinition])
(Maybe [AssetModelPropertyDefinition])
(Maybe [AssetModelPropertyDefinition])
(Maybe [AssetModelPropertyDefinition])
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
[AssetModelPropertyDefinition]
[AssetModelPropertyDefinition]
[AssetModelPropertyDefinition]
[AssetModelPropertyDefinition]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createAssetModel_assetModelCompositeModels :: Lens.Lens' CreateAssetModel (Prelude.Maybe [AssetModelCompositeModelDefinition])
createAssetModel_assetModelCompositeModels :: (Maybe [AssetModelCompositeModelDefinition]
-> f (Maybe [AssetModelCompositeModelDefinition]))
-> CreateAssetModel -> f CreateAssetModel
createAssetModel_assetModelCompositeModels = (CreateAssetModel -> Maybe [AssetModelCompositeModelDefinition])
-> (CreateAssetModel
-> Maybe [AssetModelCompositeModelDefinition] -> CreateAssetModel)
-> Lens
CreateAssetModel
CreateAssetModel
(Maybe [AssetModelCompositeModelDefinition])
(Maybe [AssetModelCompositeModelDefinition])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssetModel' {Maybe [AssetModelCompositeModelDefinition]
assetModelCompositeModels :: Maybe [AssetModelCompositeModelDefinition]
$sel:assetModelCompositeModels:CreateAssetModel' :: CreateAssetModel -> Maybe [AssetModelCompositeModelDefinition]
assetModelCompositeModels} -> Maybe [AssetModelCompositeModelDefinition]
assetModelCompositeModels) (\s :: CreateAssetModel
s@CreateAssetModel' {} Maybe [AssetModelCompositeModelDefinition]
a -> CreateAssetModel
s {$sel:assetModelCompositeModels:CreateAssetModel' :: Maybe [AssetModelCompositeModelDefinition]
assetModelCompositeModels = Maybe [AssetModelCompositeModelDefinition]
a} :: CreateAssetModel) ((Maybe [AssetModelCompositeModelDefinition]
-> f (Maybe [AssetModelCompositeModelDefinition]))
-> CreateAssetModel -> f CreateAssetModel)
-> ((Maybe [AssetModelCompositeModelDefinition]
-> f (Maybe [AssetModelCompositeModelDefinition]))
-> Maybe [AssetModelCompositeModelDefinition]
-> f (Maybe [AssetModelCompositeModelDefinition]))
-> (Maybe [AssetModelCompositeModelDefinition]
-> f (Maybe [AssetModelCompositeModelDefinition]))
-> CreateAssetModel
-> f CreateAssetModel
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[AssetModelCompositeModelDefinition]
[AssetModelCompositeModelDefinition]
[AssetModelCompositeModelDefinition]
[AssetModelCompositeModelDefinition]
-> Iso
(Maybe [AssetModelCompositeModelDefinition])
(Maybe [AssetModelCompositeModelDefinition])
(Maybe [AssetModelCompositeModelDefinition])
(Maybe [AssetModelCompositeModelDefinition])
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
[AssetModelCompositeModelDefinition]
[AssetModelCompositeModelDefinition]
[AssetModelCompositeModelDefinition]
[AssetModelCompositeModelDefinition]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createAssetModel_assetModelHierarchies :: Lens.Lens' CreateAssetModel (Prelude.Maybe [AssetModelHierarchyDefinition])
createAssetModel_assetModelHierarchies :: (Maybe [AssetModelHierarchyDefinition]
-> f (Maybe [AssetModelHierarchyDefinition]))
-> CreateAssetModel -> f CreateAssetModel
createAssetModel_assetModelHierarchies = (CreateAssetModel -> Maybe [AssetModelHierarchyDefinition])
-> (CreateAssetModel
-> Maybe [AssetModelHierarchyDefinition] -> CreateAssetModel)
-> Lens
CreateAssetModel
CreateAssetModel
(Maybe [AssetModelHierarchyDefinition])
(Maybe [AssetModelHierarchyDefinition])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssetModel' {Maybe [AssetModelHierarchyDefinition]
assetModelHierarchies :: Maybe [AssetModelHierarchyDefinition]
$sel:assetModelHierarchies:CreateAssetModel' :: CreateAssetModel -> Maybe [AssetModelHierarchyDefinition]
assetModelHierarchies} -> Maybe [AssetModelHierarchyDefinition]
assetModelHierarchies) (\s :: CreateAssetModel
s@CreateAssetModel' {} Maybe [AssetModelHierarchyDefinition]
a -> CreateAssetModel
s {$sel:assetModelHierarchies:CreateAssetModel' :: Maybe [AssetModelHierarchyDefinition]
assetModelHierarchies = Maybe [AssetModelHierarchyDefinition]
a} :: CreateAssetModel) ((Maybe [AssetModelHierarchyDefinition]
-> f (Maybe [AssetModelHierarchyDefinition]))
-> CreateAssetModel -> f CreateAssetModel)
-> ((Maybe [AssetModelHierarchyDefinition]
-> f (Maybe [AssetModelHierarchyDefinition]))
-> Maybe [AssetModelHierarchyDefinition]
-> f (Maybe [AssetModelHierarchyDefinition]))
-> (Maybe [AssetModelHierarchyDefinition]
-> f (Maybe [AssetModelHierarchyDefinition]))
-> CreateAssetModel
-> f CreateAssetModel
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[AssetModelHierarchyDefinition]
[AssetModelHierarchyDefinition]
[AssetModelHierarchyDefinition]
[AssetModelHierarchyDefinition]
-> Iso
(Maybe [AssetModelHierarchyDefinition])
(Maybe [AssetModelHierarchyDefinition])
(Maybe [AssetModelHierarchyDefinition])
(Maybe [AssetModelHierarchyDefinition])
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
[AssetModelHierarchyDefinition]
[AssetModelHierarchyDefinition]
[AssetModelHierarchyDefinition]
[AssetModelHierarchyDefinition]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createAssetModel_tags :: Lens.Lens' CreateAssetModel (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createAssetModel_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateAssetModel -> f CreateAssetModel
createAssetModel_tags = (CreateAssetModel -> Maybe (HashMap Text Text))
-> (CreateAssetModel
-> Maybe (HashMap Text Text) -> CreateAssetModel)
-> Lens
CreateAssetModel
CreateAssetModel
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssetModel' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateAssetModel' :: CreateAssetModel -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateAssetModel
s@CreateAssetModel' {} Maybe (HashMap Text Text)
a -> CreateAssetModel
s {$sel:tags:CreateAssetModel' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateAssetModel) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateAssetModel -> f CreateAssetModel)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateAssetModel
-> f CreateAssetModel
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
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
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createAssetModel_assetModelName :: Lens.Lens' CreateAssetModel Prelude.Text
createAssetModel_assetModelName :: (Text -> f Text) -> CreateAssetModel -> f CreateAssetModel
createAssetModel_assetModelName = (CreateAssetModel -> Text)
-> (CreateAssetModel -> Text -> CreateAssetModel)
-> Lens CreateAssetModel CreateAssetModel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssetModel' {Text
assetModelName :: Text
$sel:assetModelName:CreateAssetModel' :: CreateAssetModel -> Text
assetModelName} -> Text
assetModelName) (\s :: CreateAssetModel
s@CreateAssetModel' {} Text
a -> CreateAssetModel
s {$sel:assetModelName:CreateAssetModel' :: Text
assetModelName = Text
a} :: CreateAssetModel)
instance Core.AWSRequest CreateAssetModel where
type
AWSResponse CreateAssetModel =
CreateAssetModelResponse
request :: CreateAssetModel -> Request CreateAssetModel
request = Service -> CreateAssetModel -> Request CreateAssetModel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateAssetModel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateAssetModel)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateAssetModel))
-> Logger
-> Service
-> Proxy CreateAssetModel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateAssetModel)))
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 -> Text -> Text -> AssetModelStatus -> CreateAssetModelResponse
CreateAssetModelResponse'
(Int
-> Text -> Text -> AssetModelStatus -> CreateAssetModelResponse)
-> Either String Int
-> Either
String
(Text -> Text -> AssetModelStatus -> CreateAssetModelResponse)
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
(Text -> Text -> AssetModelStatus -> CreateAssetModelResponse)
-> Either String Text
-> Either
String (Text -> AssetModelStatus -> CreateAssetModelResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"assetModelId")
Either
String (Text -> AssetModelStatus -> CreateAssetModelResponse)
-> Either String Text
-> Either String (AssetModelStatus -> CreateAssetModelResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"assetModelArn")
Either String (AssetModelStatus -> CreateAssetModelResponse)
-> Either String AssetModelStatus
-> Either String CreateAssetModelResponse
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 CreateAssetModel
instance Prelude.NFData CreateAssetModel
instance Core.ToHeaders CreateAssetModel where
toHeaders :: CreateAssetModel -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateAssetModel -> 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 CreateAssetModel where
toJSON :: CreateAssetModel -> Value
toJSON CreateAssetModel' {Maybe [AssetModelHierarchyDefinition]
Maybe [AssetModelPropertyDefinition]
Maybe [AssetModelCompositeModelDefinition]
Maybe Text
Maybe (HashMap Text Text)
Text
assetModelName :: Text
tags :: Maybe (HashMap Text Text)
assetModelHierarchies :: Maybe [AssetModelHierarchyDefinition]
assetModelCompositeModels :: Maybe [AssetModelCompositeModelDefinition]
assetModelProperties :: Maybe [AssetModelPropertyDefinition]
assetModelDescription :: Maybe Text
clientToken :: Maybe Text
$sel:assetModelName:CreateAssetModel' :: CreateAssetModel -> Text
$sel:tags:CreateAssetModel' :: CreateAssetModel -> Maybe (HashMap Text Text)
$sel:assetModelHierarchies:CreateAssetModel' :: CreateAssetModel -> Maybe [AssetModelHierarchyDefinition]
$sel:assetModelCompositeModels:CreateAssetModel' :: CreateAssetModel -> Maybe [AssetModelCompositeModelDefinition]
$sel:assetModelProperties:CreateAssetModel' :: CreateAssetModel -> Maybe [AssetModelPropertyDefinition]
$sel:assetModelDescription:CreateAssetModel' :: CreateAssetModel -> Maybe Text
$sel:clientToken:CreateAssetModel' :: CreateAssetModel -> 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 -> [AssetModelPropertyDefinition] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([AssetModelPropertyDefinition] -> Pair)
-> Maybe [AssetModelPropertyDefinition] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AssetModelPropertyDefinition]
assetModelProperties,
(Text
"assetModelCompositeModels" Text -> [AssetModelCompositeModelDefinition] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([AssetModelCompositeModelDefinition] -> Pair)
-> Maybe [AssetModelCompositeModelDefinition] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AssetModelCompositeModelDefinition]
assetModelCompositeModels,
(Text
"assetModelHierarchies" Text -> [AssetModelHierarchyDefinition] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([AssetModelHierarchyDefinition] -> Pair)
-> Maybe [AssetModelHierarchyDefinition] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AssetModelHierarchyDefinition]
assetModelHierarchies,
(Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
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 CreateAssetModel where
toPath :: CreateAssetModel -> ByteString
toPath = ByteString -> CreateAssetModel -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/asset-models"
instance Core.ToQuery CreateAssetModel where
toQuery :: CreateAssetModel -> QueryString
toQuery = QueryString -> CreateAssetModel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateAssetModelResponse = CreateAssetModelResponse'
{
CreateAssetModelResponse -> Int
httpStatus :: Prelude.Int,
CreateAssetModelResponse -> Text
assetModelId :: Prelude.Text,
CreateAssetModelResponse -> Text
assetModelArn :: Prelude.Text,
CreateAssetModelResponse -> AssetModelStatus
assetModelStatus :: AssetModelStatus
}
deriving (CreateAssetModelResponse -> CreateAssetModelResponse -> Bool
(CreateAssetModelResponse -> CreateAssetModelResponse -> Bool)
-> (CreateAssetModelResponse -> CreateAssetModelResponse -> Bool)
-> Eq CreateAssetModelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAssetModelResponse -> CreateAssetModelResponse -> Bool
$c/= :: CreateAssetModelResponse -> CreateAssetModelResponse -> Bool
== :: CreateAssetModelResponse -> CreateAssetModelResponse -> Bool
$c== :: CreateAssetModelResponse -> CreateAssetModelResponse -> Bool
Prelude.Eq, ReadPrec [CreateAssetModelResponse]
ReadPrec CreateAssetModelResponse
Int -> ReadS CreateAssetModelResponse
ReadS [CreateAssetModelResponse]
(Int -> ReadS CreateAssetModelResponse)
-> ReadS [CreateAssetModelResponse]
-> ReadPrec CreateAssetModelResponse
-> ReadPrec [CreateAssetModelResponse]
-> Read CreateAssetModelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAssetModelResponse]
$creadListPrec :: ReadPrec [CreateAssetModelResponse]
readPrec :: ReadPrec CreateAssetModelResponse
$creadPrec :: ReadPrec CreateAssetModelResponse
readList :: ReadS [CreateAssetModelResponse]
$creadList :: ReadS [CreateAssetModelResponse]
readsPrec :: Int -> ReadS CreateAssetModelResponse
$creadsPrec :: Int -> ReadS CreateAssetModelResponse
Prelude.Read, Int -> CreateAssetModelResponse -> ShowS
[CreateAssetModelResponse] -> ShowS
CreateAssetModelResponse -> String
(Int -> CreateAssetModelResponse -> ShowS)
-> (CreateAssetModelResponse -> String)
-> ([CreateAssetModelResponse] -> ShowS)
-> Show CreateAssetModelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAssetModelResponse] -> ShowS
$cshowList :: [CreateAssetModelResponse] -> ShowS
show :: CreateAssetModelResponse -> String
$cshow :: CreateAssetModelResponse -> String
showsPrec :: Int -> CreateAssetModelResponse -> ShowS
$cshowsPrec :: Int -> CreateAssetModelResponse -> ShowS
Prelude.Show, (forall x.
CreateAssetModelResponse -> Rep CreateAssetModelResponse x)
-> (forall x.
Rep CreateAssetModelResponse x -> CreateAssetModelResponse)
-> Generic CreateAssetModelResponse
forall x.
Rep CreateAssetModelResponse x -> CreateAssetModelResponse
forall x.
CreateAssetModelResponse -> Rep CreateAssetModelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateAssetModelResponse x -> CreateAssetModelResponse
$cfrom :: forall x.
CreateAssetModelResponse -> Rep CreateAssetModelResponse x
Prelude.Generic)
newCreateAssetModelResponse ::
Prelude.Int ->
Prelude.Text ->
Prelude.Text ->
AssetModelStatus ->
CreateAssetModelResponse
newCreateAssetModelResponse :: Int -> Text -> Text -> AssetModelStatus -> CreateAssetModelResponse
newCreateAssetModelResponse
Int
pHttpStatus_
Text
pAssetModelId_
Text
pAssetModelArn_
AssetModelStatus
pAssetModelStatus_ =
CreateAssetModelResponse' :: Int -> Text -> Text -> AssetModelStatus -> CreateAssetModelResponse
CreateAssetModelResponse'
{ $sel:httpStatus:CreateAssetModelResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:assetModelId:CreateAssetModelResponse' :: Text
assetModelId = Text
pAssetModelId_,
$sel:assetModelArn:CreateAssetModelResponse' :: Text
assetModelArn = Text
pAssetModelArn_,
$sel:assetModelStatus:CreateAssetModelResponse' :: AssetModelStatus
assetModelStatus = AssetModelStatus
pAssetModelStatus_
}
createAssetModelResponse_httpStatus :: Lens.Lens' CreateAssetModelResponse Prelude.Int
createAssetModelResponse_httpStatus :: (Int -> f Int)
-> CreateAssetModelResponse -> f CreateAssetModelResponse
createAssetModelResponse_httpStatus = (CreateAssetModelResponse -> Int)
-> (CreateAssetModelResponse -> Int -> CreateAssetModelResponse)
-> Lens CreateAssetModelResponse CreateAssetModelResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssetModelResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateAssetModelResponse' :: CreateAssetModelResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateAssetModelResponse
s@CreateAssetModelResponse' {} Int
a -> CreateAssetModelResponse
s {$sel:httpStatus:CreateAssetModelResponse' :: Int
httpStatus = Int
a} :: CreateAssetModelResponse)
createAssetModelResponse_assetModelId :: Lens.Lens' CreateAssetModelResponse Prelude.Text
createAssetModelResponse_assetModelId :: (Text -> f Text)
-> CreateAssetModelResponse -> f CreateAssetModelResponse
createAssetModelResponse_assetModelId = (CreateAssetModelResponse -> Text)
-> (CreateAssetModelResponse -> Text -> CreateAssetModelResponse)
-> Lens CreateAssetModelResponse CreateAssetModelResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssetModelResponse' {Text
assetModelId :: Text
$sel:assetModelId:CreateAssetModelResponse' :: CreateAssetModelResponse -> Text
assetModelId} -> Text
assetModelId) (\s :: CreateAssetModelResponse
s@CreateAssetModelResponse' {} Text
a -> CreateAssetModelResponse
s {$sel:assetModelId:CreateAssetModelResponse' :: Text
assetModelId = Text
a} :: CreateAssetModelResponse)
createAssetModelResponse_assetModelArn :: Lens.Lens' CreateAssetModelResponse Prelude.Text
createAssetModelResponse_assetModelArn :: (Text -> f Text)
-> CreateAssetModelResponse -> f CreateAssetModelResponse
createAssetModelResponse_assetModelArn = (CreateAssetModelResponse -> Text)
-> (CreateAssetModelResponse -> Text -> CreateAssetModelResponse)
-> Lens CreateAssetModelResponse CreateAssetModelResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssetModelResponse' {Text
assetModelArn :: Text
$sel:assetModelArn:CreateAssetModelResponse' :: CreateAssetModelResponse -> Text
assetModelArn} -> Text
assetModelArn) (\s :: CreateAssetModelResponse
s@CreateAssetModelResponse' {} Text
a -> CreateAssetModelResponse
s {$sel:assetModelArn:CreateAssetModelResponse' :: Text
assetModelArn = Text
a} :: CreateAssetModelResponse)
createAssetModelResponse_assetModelStatus :: Lens.Lens' CreateAssetModelResponse AssetModelStatus
createAssetModelResponse_assetModelStatus :: (AssetModelStatus -> f AssetModelStatus)
-> CreateAssetModelResponse -> f CreateAssetModelResponse
createAssetModelResponse_assetModelStatus = (CreateAssetModelResponse -> AssetModelStatus)
-> (CreateAssetModelResponse
-> AssetModelStatus -> CreateAssetModelResponse)
-> Lens
CreateAssetModelResponse
CreateAssetModelResponse
AssetModelStatus
AssetModelStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssetModelResponse' {AssetModelStatus
assetModelStatus :: AssetModelStatus
$sel:assetModelStatus:CreateAssetModelResponse' :: CreateAssetModelResponse -> AssetModelStatus
assetModelStatus} -> AssetModelStatus
assetModelStatus) (\s :: CreateAssetModelResponse
s@CreateAssetModelResponse' {} AssetModelStatus
a -> CreateAssetModelResponse
s {$sel:assetModelStatus:CreateAssetModelResponse' :: AssetModelStatus
assetModelStatus = AssetModelStatus
a} :: CreateAssetModelResponse)
instance Prelude.NFData CreateAssetModelResponse