ComponentType
The ComponentType resource allows you to define and manage AWS IoTTwinMaker ComponentTypes, which are essential for creating digital twins of physical assets.
Minimal Example
Section titled “Minimal Example”Create a basic ComponentType with required properties and one optional property for description.
import AWS from "alchemy/aws/control";
const basicComponentType = await AWS.IoTTwinMaker.ComponentType("basicComponentType", { WorkspaceId: "workspace-123", ComponentTypeId: "basicComponent", Description: "A basic component type for demonstration purposes", IsSingleton: false});
Advanced Configuration
Section titled “Advanced Configuration”Configure a ComponentType with detailed property definitions and a composite component type.
const advancedComponentType = await AWS.IoTTwinMaker.ComponentType("advancedComponentType", { WorkspaceId: "workspace-123", ComponentTypeId: "advancedComponent", Description: "An advanced component type with specific property definitions", PropertyDefinitions: { Temperature: { Type: "Number", Unit: "Celsius", DefaultValue: 20 }, Status: { Type: "String", DefaultValue: "Operational" } }, CompositeComponentTypes: { SubComponent: { Type: "SubComponentType" } }, Tags: { Environment: "Production" }});
Singleton ComponentType
Section titled “Singleton ComponentType”Define a singleton ComponentType that ensures only one instance can exist.
const singletonComponentType = await AWS.IoTTwinMaker.ComponentType("singletonComponentType", { WorkspaceId: "workspace-123", ComponentTypeId: "singletonComponent", IsSingleton: true, Description: "A singleton component type ensuring a single instance", PropertyDefinitions: { Version: { Type: "String", DefaultValue: "1.0" } }});
ComponentType Extending Another
Section titled “ComponentType Extending Another”Create a ComponentType that extends from another existing ComponentType.
const extendedComponentType = await AWS.IoTTwinMaker.ComponentType("extendedComponentType", { WorkspaceId: "workspace-123", ComponentTypeId: "extendedComponent", ExtendsFrom: ["baseComponent"], Description: "An extended component type from baseComponent", PropertyDefinitions: { Pressure: { Type: "Number", Unit: "Pascal", DefaultValue: 101325 } }});