Cookie の設定を選択する

当社は、当社のサイトおよびサービスを提供するために必要な必須 Cookie および類似のツールを使用しています。当社は、パフォーマンス Cookie を使用して匿名の統計情報を収集することで、お客様が当社のサイトをどのように利用しているかを把握し、改善に役立てています。必須 Cookie は無効化できませんが、[カスタマイズ] または [拒否] をクリックしてパフォーマンス Cookie を拒否することはできます。

お客様が同意した場合、AWS および承認された第三者は、Cookie を使用して便利なサイト機能を提供したり、お客様の選択を記憶したり、関連する広告を含む関連コンテンツを表示したりします。すべての必須ではない Cookie を受け入れるか拒否するには、[受け入れる] または [拒否] をクリックしてください。より詳細な選択を行うには、[カスタマイズ] をクリックしてください。

AWS IoT SiteWise SDK for JavaScript (v3) を使用した の例 - AWS SDK コード例

Doc AWS SDK Examples GitHub リポジトリには、他にも SDK の例があります。 AWS

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

Doc AWS SDK Examples GitHub リポジトリには、他にも SDK の例があります。 AWS

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

AWS IoT SiteWise SDK for JavaScript (v3) を使用した の例

次のコード例は、 で AWS SDK for JavaScript (v3) を使用してアクションを実行し、一般的なシナリオを実装する方法を示しています AWS IoT SiteWise。

基本は、重要なオペレーションをサービス内で実行する方法を示すコード例です。

アクションはより大きなプログラムからのコードの抜粋であり、コンテキスト内で実行する必要があります。アクションは個々のサービス機能を呼び出す方法を示していますが、コンテキスト内のアクションは、関連するシナリオで確認できます。

各例には完全なソースコードへのリンクが含まれており、コードの設定方法と実行方法に関する手順を確認できます。

開始方法

次のコード例は、 AWS IoT SiteWiseの使用を開始する方法を示しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { paginateListAssetModels, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; // Call ListDocuments and display the result. export const main = async () => { const client = new IoTSiteWiseClient(); const listAssetModelsPaginated = []; console.log( "Hello, AWS Systems Manager! Let's list some of your documents:\n", ); try { // The paginate function is a wrapper around the base command. const paginator = paginateListAssetModels({ client }, { maxResults: 5 }); for await (const page of paginator) { listAssetModelsPaginated.push(...page.assetModelSummaries); } } catch (caught) { console.error(`There was a problem saying hello: ${caught.message}`); throw caught; } for (const { name, creationDate } of listAssetModelsPaginated) { console.log(`${name} - ${creationDate}`); } }; // Call function if run directly. import { fileURLToPath } from "node:url"; if (process.argv[1] === fileURLToPath(import.meta.url)) { main(); }
  • API の詳細については、AWS SDK for JavaScript 「 API リファレンス」のListAssetModels」を参照してください。

次のコード例は、 AWS IoT SiteWiseの使用を開始する方法を示しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { paginateListAssetModels, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; // Call ListDocuments and display the result. export const main = async () => { const client = new IoTSiteWiseClient(); const listAssetModelsPaginated = []; console.log( "Hello, AWS Systems Manager! Let's list some of your documents:\n", ); try { // The paginate function is a wrapper around the base command. const paginator = paginateListAssetModels({ client }, { maxResults: 5 }); for await (const page of paginator) { listAssetModelsPaginated.push(...page.assetModelSummaries); } } catch (caught) { console.error(`There was a problem saying hello: ${caught.message}`); throw caught; } for (const { name, creationDate } of listAssetModelsPaginated) { console.log(`${name} - ${creationDate}`); } }; // Call function if run directly. import { fileURLToPath } from "node:url"; if (process.argv[1] === fileURLToPath(import.meta.url)) { main(); }
  • API の詳細については、AWS SDK for JavaScript 「 API リファレンス」のListAssetModels」を参照してください。

基本

次のコード例は、 AWS SDK AWS IoT SiteWise を使用するためのコアオペレーションを学習する方法を示しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { Scenario, ScenarioAction, ScenarioInput, ScenarioOutput, //} from "@aws-doc-sdk-examples/lib/scenario/index.js"; } from "../../libs/scenario/index.js"; import { IoTSiteWiseClient, CreateAssetModelCommand, CreateAssetCommand, ListAssetModelPropertiesCommand, BatchPutAssetPropertyValueCommand, GetAssetPropertyValueCommand, CreatePortalCommand, DescribePortalCommand, CreateGatewayCommand, DescribeGatewayCommand, DeletePortalCommand, DeleteGatewayCommand, DeleteAssetCommand, DeleteAssetModelCommand, DescribeAssetModelCommand, } from "@aws-sdk/client-iotsitewise"; import { CloudFormationClient, CreateStackCommand, DeleteStackCommand, DescribeStacksCommand, waitUntilStackExists, waitUntilStackCreateComplete, waitUntilStackDeleteComplete, } from "@aws-sdk/client-cloudformation"; import { wait } from "@aws-doc-sdk-examples/lib/utils/util-timers.js"; import { parseArgs } from "node:util"; import { readFileSync } from "node:fs"; import { fileURLToPath } from "node:url"; import { dirname } from "node:path"; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); const stackName = "SiteWiseBasicsStack"; /** * @typedef {{ * iotSiteWiseClient: import('@aws-sdk/client-iotsitewise').IotSiteWiseClient, * cloudFormationClient: import('@aws-sdk/client-cloudformation').CloudFormationClient, * stackName, * stack, * askToDeleteResources: true, * asset: {assetName: "MyAsset1"}, * assetModel: {assetModelName: "MyAssetModel1"}, * portal: {portalName: "MyPortal1"}, * gateway: {gatewayName: "MyGateway1"}, * propertyIds: [], * contactEmail: "user@mydomain.com", * thing: "MyThing1", * sampleData: { temperature: 23.5, humidity: 65.0} * }} State */ /** * Used repeatedly to have the user press enter. * @type {ScenarioInput} */ const pressEnter = new ScenarioInput("continue", "Press Enter to continue", { type: "confirm", }); const greet = new ScenarioOutput( "greet", `AWS IoT SiteWise is a fully managed industrial software-as-a-service (SaaS) that makes it easy to collect, store, organize, and monitor data from industrial equipment and processes. It is designed to help industrial and manufacturing organizations collect data from their equipment and processes, and use that data to make informed decisions about their operations. One of the key features of AWS IoT SiteWise is its ability to connect to a wide range of industrial equipment and systems, including programmable logic controllers (PLCs), sensors, and other industrial devices. It can collect data from these devices and organize it into a unified data model, making it easier to analyze and gain insights from the data. AWS IoT SiteWise also provides tools for visualizing the data, setting up alarms and alerts, and generating reports. Another key feature of AWS IoT SiteWise is its ability to scale to handle large volumes of data. It can collect and store data from thousands of devices and process millions of data points per second, making it suitable for large-scale industrial operations. Additionally, AWS IoT SiteWise is designed to be secure and compliant, with features like role-based access controls, data encryption, and integration with other AWS services for additional security and compliance features. Let's get started...`, { header: true }, ); const displayBuildCloudFormationStack = new ScenarioOutput( "displayBuildCloudFormationStack", "This scenario uses AWS CloudFormation to create an IAM role that is required for this scenario. The stack will now be deployed.", ); const sdkBuildCloudFormationStack = new ScenarioAction( "sdkBuildCloudFormationStack", async (/** @type {State} */ state) => { try { const data = readFileSync( `${__dirname}/../../../../resources/cfn/iotsitewise_basics/SitewiseRoles-template.yml`, "utf8", ); await state.cloudFormationClient.send( new CreateStackCommand({ StackName: stackName, TemplateBody: data, Capabilities: ["CAPABILITY_IAM"], }), ); await waitUntilStackExists( { client: state.cloudFormationClient }, { StackName: stackName }, ); await waitUntilStackCreateComplete( { client: state.cloudFormationClient }, { StackName: stackName }, ); const stack = await state.cloudFormationClient.send( new DescribeStacksCommand({ StackName: stackName, }), ); state.stack = stack.Stacks[0].Outputs[0]; console.log(`The ARN of the IAM role is ${state.stack.OutputValue}`); } catch (caught) { console.error(caught.message); throw caught; } }, ); const displayCreateAWSSiteWiseAssetModel = new ScenarioOutput( "displayCreateAWSSiteWiseAssetModel", `1. Create an AWS SiteWise Asset Model An AWS IoT SiteWise Asset Model is a way to represent the physical assets, such as equipment, processes, and systems, that exist in an industrial environment. This model provides a structured and hierarchical representation of these assets, allowing users to define the relationships and properties of each asset. This scenario creates two asset model properties: temperature and humidity.`, ); const sdkCreateAWSSiteWiseAssetModel = new ScenarioAction( "sdkCreateAWSSiteWiseAssetModel", async (/** @type {State} */ state) => { let assetModelResponse; try { assetModelResponse = await state.iotSiteWiseClient.send( new CreateAssetModelCommand({ assetModelName: state.assetModel.assetModelName, assetModelProperties: [ { name: "Temperature", dataType: "DOUBLE", type: { measurement: {}, }, }, { name: "Humidity", dataType: "DOUBLE", type: { measurement: {}, }, }, ], }), ); state.assetModel.assetModelId = assetModelResponse.assetModelId; console.log( `Asset Model successfully created. Asset Model ID: ${state.assetModel.assetModelId}`, ); } catch (caught) { if (caught.name === "ResourceAlreadyExistsException") { console.log( `The Asset Model ${state.assetModel.assetModelName} already exists.`, ); throw caught; } console.error(`${caught.message}`); throw caught; } }, ); const displayCreateAWSIoTSiteWiseAssetModel = new ScenarioOutput( "displayCreateAWSIoTSiteWiseAssetModel", `2. Create an AWS IoT SiteWise Asset The IoT SiteWise model that we just created defines the structure and metadata for your physical assets. Now we create an asset from the asset model. Let's wait 30 seconds for the asset to be ready.`, ); const waitThirtySeconds = new ScenarioAction("waitThirtySeconds", async () => { await wait(30); // wait 30 seconds console.log("Time's up! Let's check the asset's status."); }); const sdkCreateAWSIoTSiteWiseAssetModel = new ScenarioAction( "sdkCreateAWSIoTSiteWiseAssetModel", async (/** @type {State} */ state) => { try { const assetResponse = await state.iotSiteWiseClient.send( new CreateAssetCommand({ assetModelId: state.assetModel.assetModelId, assetName: state.asset.assetName, }), ); state.asset.assetId = assetResponse.assetId; console.log(`Asset created with ID: ${state.asset.assetId}`); } catch (caught) { if (caught.name === "ResourceNotFoundException") { console.log( `The Asset ${state.assetModel.assetModelName} was not found.`, ); throw caught; } console.error(`${caught.message}`); throw caught; } }, ); const displayRetrievePropertyId = new ScenarioOutput( "displayRetrievePropertyId", `3. Retrieve the property ID values To send data to an asset, we need to get the property ID values. In this scenario, we access the temperature and humidity property ID values.`, ); const sdkRetrievePropertyId = new ScenarioAction( "sdkRetrievePropertyId", async (state) => { try { const retrieveResponse = await state.iotSiteWiseClient.send( new ListAssetModelPropertiesCommand({ assetModelId: state.assetModel.assetModelId, }), ); for (const retrieveResponseKey in retrieveResponse.assetModelPropertySummaries) { if ( retrieveResponse.assetModelPropertySummaries[retrieveResponseKey] .name === "Humidity" ) { state.propertyIds.Humidity = retrieveResponse.assetModelPropertySummaries[ retrieveResponseKey ].id; } if ( retrieveResponse.assetModelPropertySummaries[retrieveResponseKey] .name === "Temperature" ) { state.propertyIds.Temperature = retrieveResponse.assetModelPropertySummaries[ retrieveResponseKey ].id; } } console.log(`The Humidity propertyId is ${state.propertyIds.Humidity}`); console.log( `The Temperature propertyId is ${state.propertyIds.Temperature}`, ); } catch (caught) { if (caught.name === "IoTSiteWiseException") { console.log( `There was a problem retrieving the properties: ${caught.message}`, ); throw caught; } console.error(`${caught.message}`); throw caught; } }, ); const displaySendDataToIoTSiteWiseAsset = new ScenarioOutput( "displaySendDataToIoTSiteWiseAsset", `4. Send data to an AWS IoT SiteWise Asset By sending data to an IoT SiteWise Asset, you can aggregate data from multiple sources, normalize the data into a standard format, and store it in a centralized location. This makes it easier to analyze and gain insights from the data. In this example, we generate sample temperature and humidity data and send it to the AWS IoT SiteWise asset.`, ); const sdkSendDataToIoTSiteWiseAsset = new ScenarioAction( "sdkSendDataToIoTSiteWiseAsset", async (state) => { try { const sendResponse = await state.iotSiteWiseClient.send( new BatchPutAssetPropertyValueCommand({ entries: [ { entryId: "entry-3", assetId: state.asset.assetId, propertyId: state.propertyIds.Humidity, propertyValues: [ { value: { doubleValue: state.sampleData.humidity, }, timestamp: { timeInSeconds: Math.floor(Date.now() / 1000), }, }, ], }, { entryId: "entry-4", assetId: state.asset.assetId, propertyId: state.propertyIds.Temperature, propertyValues: [ { value: { doubleValue: state.sampleData.temperature, }, timestamp: { timeInSeconds: Math.floor(Date.now() / 1000), }, }, ], }, ], }), ); console.log("The data was sent successfully."); } catch (caught) { if (caught.name === "ResourceNotFoundException") { console.log(`The Asset ${state.asset.assetName} was not found.`); throw caught; } console.error(`${caught.message}`); throw caught; } }, ); const displayRetrieveValueOfIoTSiteWiseAsset = new ScenarioOutput( "displayRetrieveValueOfIoTSiteWiseAsset", `5. Retrieve the value of the IoT SiteWise Asset property IoT SiteWise is an AWS service that allows you to collect, process, and analyze industrial data from connected equipment and sensors. One of the key benefits of reading an IoT SiteWise property is the ability to gain valuable insights from your industrial data.`, ); const sdkRetrieveValueOfIoTSiteWiseAsset = new ScenarioAction( "sdkRetrieveValueOfIoTSiteWiseAsset", async (/** @type {State} */ state) => { try { const temperatureResponse = await state.iotSiteWiseClient.send( new GetAssetPropertyValueCommand({ assetId: state.asset.assetId, propertyId: state.propertyIds.Temperature, }), ); const humidityResponse = await state.iotSiteWiseClient.send( new GetAssetPropertyValueCommand({ assetId: state.asset.assetId, propertyId: state.propertyIds.Humidity, }), ); console.log( `The property value for Temperature is ${temperatureResponse.propertyValue.value.doubleValue}`, ); console.log( `The property value for Humidity is ${humidityResponse.propertyValue.value.doubleValue}`, ); } catch (caught) { if (caught.name === "ResourceNotFoundException") { console.log(`The Asset ${state.asset.assetName} was not found.`); throw caught; } console.error(`${caught.message}`); throw caught; } }, ); const displayCreateIoTSiteWisePortal = new ScenarioOutput( "displayCreateIoTSiteWisePortal", `6. Create an IoT SiteWise Portal An IoT SiteWise Portal allows you to aggregate data from multiple industrial sources, such as sensors, equipment, and control systems, into a centralized platform.`, ); const sdkCreateIoTSiteWisePortal = new ScenarioAction( "sdkCreateIoTSiteWisePortal", async (/** @type {State} */ state) => { try { const createPortalResponse = await state.iotSiteWiseClient.send( new CreatePortalCommand({ portalName: state.portal.portalName, portalContactEmail: state.contactEmail, roleArn: state.stack.OutputValue, }), ); state.portal = { ...state.portal, ...createPortalResponse }; await wait(5); // Allow the portal to properly propagate. console.log( `Portal created successfully. Portal ID ${createPortalResponse.portalId}`, ); } catch (caught) { if (caught.name === "IoTSiteWiseException") { console.log( `There was a problem creating the Portal: ${caught.message}.`, ); throw caught; } console.error(`${caught.message}`); throw caught; } }, ); const displayDescribePortal = new ScenarioOutput( "displayDescribePortal", `7. Describe the Portal In this step, we get a description of the portal and display the portal URL.`, ); const sdkDescribePortal = new ScenarioAction( "sdkDescribePortal", async (/** @type {State} */ state) => { try { const describePortalResponse = await state.iotSiteWiseClient.send( new DescribePortalCommand({ portalId: state.portal.portalId, }), ); console.log(`Portal URL: ${describePortalResponse.portalStartUrl}`); } catch (caught) { if (caught.name === "ResourceNotFoundException") { console.log(`The Portal ${state.portal.portalName} was not found.`); throw caught; } console.error(`${caught.message}`); throw caught; } }, ); const displayCreateIoTSiteWiseGateway = new ScenarioOutput( "displayCreateIoTSiteWiseGateway", `8. Create an IoT SiteWise Gateway IoT SiteWise Gateway serves as the bridge between industrial equipment, sensors, and the cloud-based IoT SiteWise service. It is responsible for securely collecting, processing, and transmitting data from various industrial assets to the IoT SiteWise platform, enabling real-time monitoring, analysis, and optimization of industrial operations.`, ); const sdkCreateIoTSiteWiseGateway = new ScenarioAction( "sdkCreateIoTSiteWiseGateway", async (/** @type {State} */ state) => { try { const createGatewayResponse = await state.iotSiteWiseClient.send( new CreateGatewayCommand({ gatewayName: state.gateway.gatewayName, gatewayPlatform: { greengrassV2: { coreDeviceThingName: state.thing, }, }, }), ); console.log( `Gateway creation completed successfully. ID is ${createGatewayResponse.gatewayId}`, ); state.gateway.gatewayId = createGatewayResponse.gatewayId; } catch (caught) { if (caught.name === "IoTSiteWiseException") { console.log( `There was a problem creating the gateway: ${caught.message}.`, ); throw caught; } console.error(`${caught.message}`); throw caught; } }, ); const displayDescribeIoTSiteWiseGateway = new ScenarioOutput( "displayDescribeIoTSiteWiseGateway", "9. Describe the IoT SiteWise Gateway", ); const sdkDescribeIoTSiteWiseGateway = new ScenarioAction( "sdkDescribeIoTSiteWiseGateway", async (/** @type {State} */ state) => { try { const describeGatewayResponse = await state.iotSiteWiseClient.send( new DescribeGatewayCommand({ gatewayId: state.gateway.gatewayId, }), ); console.log("Gateway creation completed successfully."); console.log(`Gateway Name: ${describeGatewayResponse.gatewayName}`); console.log(`Gateway ARN: ${describeGatewayResponse.gatewayArn}`); console.log( `Gateway Platform: ${Object.keys(describeGatewayResponse.gatewayPlatform)}`, ); console.log( `Gateway Creation Date: ${describeGatewayResponse.creationDate}`, ); } catch (caught) { if (caught.name === "ResourceNotFoundException") { console.log(`The Gateway ${state.gateway.gatewayId} was not found.`); throw caught; } console.error(`${caught.message}`); throw caught; } }, ); const askToDeleteResources = new ScenarioInput( "askToDeleteResources", `10. Delete the AWS IoT SiteWise Assets Before you can delete the Asset Model, you must delete the assets.`, { type: "confirm" }, ); const displayConfirmDeleteResources = new ScenarioAction( "displayConfirmDeleteResources", async (/** @type {State} */ state) => { if (state.askToDeleteResources) { return "You selected to delete the SiteWise assets."; } return "The resources will not be deleted. Please delete them manually to avoid charges."; }, ); const sdkDeleteResources = new ScenarioAction( "sdkDeleteResources", async (/** @type {State} */ state) => { await wait(10); // Give the portal status time to catch up. try { await state.iotSiteWiseClient.send( new DeletePortalCommand({ portalId: state.portal.portalId, }), ); console.log( `Portal ${state.portal.portalName} was deleted successfully.`, ); } catch (caught) { if (caught.name === "ResourceNotFoundException") { console.log(`The Portal ${state.portal.portalName} was not found.`); } else { console.log(`When trying to delete the portal: ${caught.message}`); } } try { await state.iotSiteWiseClient.send( new DeleteGatewayCommand({ gatewayId: state.gateway.gatewayId, }), ); console.log( `Gateway ${state.gateway.gatewayName} was deleted successfully.`, ); } catch (caught) { if (caught.name === "ResourceNotFoundException") { console.log(`The Gateway ${state.gateway.gatewayId} was not found.`); } else { console.log(`When trying to delete the gateway: ${caught.message}`); } } try { await state.iotSiteWiseClient.send( new DeleteAssetCommand({ assetId: state.asset.assetId, }), ); await wait(5); // Allow the delete to finish. console.log(`Asset ${state.asset.assetName} was deleted successfully.`); } catch (caught) { if (caught.name === "ResourceNotFoundException") { console.log(`The Asset ${state.asset.assetName} was not found.`); } else { console.log(`When deleting the asset: ${caught.message}`); } } await wait(30); // Allow asset deletion to finish. try { await state.iotSiteWiseClient.send( new DeleteAssetModelCommand({ assetModelId: state.assetModel.assetModelId, }), ); console.log( `Asset Model ${state.assetModel.assetModelName} was deleted successfully.`, ); } catch (caught) { if (caught.name === "ResourceNotFoundException") { console.log( `The Asset Model ${state.assetModel.assetModelName} was not found.`, ); } else { console.log(`When deleting the asset model: ${caught.message}`); } } try { await state.cloudFormationClient.send( new DeleteStackCommand({ StackName: stackName, }), ); await waitUntilStackDeleteComplete( { client: state.cloudFormationClient }, { StackName: stackName }, ); console.log("The stack was deleted successfully."); } catch (caught) { console.log( `${caught.message}. The stack was NOT deleted. Please clean up the resources manually.`, ); } }, { skipWhen: (/** @type {{}} */ state) => !state.askToDeleteResources }, ); const goodbye = new ScenarioOutput( "goodbye", "This concludes the IoT Sitewise Basics scenario for the AWS Javascript SDK v3. Thank you!", ); const myScenario = new Scenario( "IoTSiteWise Basics", [ greet, pressEnter, displayBuildCloudFormationStack, sdkBuildCloudFormationStack, pressEnter, displayCreateAWSSiteWiseAssetModel, sdkCreateAWSSiteWiseAssetModel, displayCreateAWSIoTSiteWiseAssetModel, pressEnter, waitThirtySeconds, sdkCreateAWSIoTSiteWiseAssetModel, pressEnter, displayRetrievePropertyId, sdkRetrievePropertyId, pressEnter, displaySendDataToIoTSiteWiseAsset, sdkSendDataToIoTSiteWiseAsset, pressEnter, displayRetrieveValueOfIoTSiteWiseAsset, sdkRetrieveValueOfIoTSiteWiseAsset, pressEnter, displayCreateIoTSiteWisePortal, sdkCreateIoTSiteWisePortal, pressEnter, displayDescribePortal, sdkDescribePortal, pressEnter, displayCreateIoTSiteWiseGateway, sdkCreateIoTSiteWiseGateway, pressEnter, displayDescribeIoTSiteWiseGateway, sdkDescribeIoTSiteWiseGateway, pressEnter, askToDeleteResources, displayConfirmDeleteResources, sdkDeleteResources, goodbye, ], { iotSiteWiseClient: new IoTSiteWiseClient({}), cloudFormationClient: new CloudFormationClient({}), asset: { assetName: "MyAsset1" }, assetModel: { assetModelName: "MyAssetModel1" }, portal: { portalName: "MyPortal1" }, gateway: { gatewayName: "MyGateway1" }, propertyIds: [], contactEmail: "user@mydomain.com", thing: "MyThing1", sampleData: { temperature: 23.5, humidity: 65.0 }, }, ); /** @type {{ stepHandlerOptions: StepHandlerOptions }} */ export const main = async (stepHandlerOptions) => { await myScenario.run(stepHandlerOptions); }; // Invoke main function if this file was run directly. if (process.argv[1] === fileURLToPath(import.meta.url)) { const { values } = parseArgs({ options: { yes: { type: "boolean", short: "y", }, }, }); main({ confirmAll: values.yes }); }

次のコード例は、 AWS SDK AWS IoT SiteWise を使用するためのコアオペレーションを学習する方法を示しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { Scenario, ScenarioAction, ScenarioInput, ScenarioOutput, //} from "@aws-doc-sdk-examples/lib/scenario/index.js"; } from "../../libs/scenario/index.js"; import { IoTSiteWiseClient, CreateAssetModelCommand, CreateAssetCommand, ListAssetModelPropertiesCommand, BatchPutAssetPropertyValueCommand, GetAssetPropertyValueCommand, CreatePortalCommand, DescribePortalCommand, CreateGatewayCommand, DescribeGatewayCommand, DeletePortalCommand, DeleteGatewayCommand, DeleteAssetCommand, DeleteAssetModelCommand, DescribeAssetModelCommand, } from "@aws-sdk/client-iotsitewise"; import { CloudFormationClient, CreateStackCommand, DeleteStackCommand, DescribeStacksCommand, waitUntilStackExists, waitUntilStackCreateComplete, waitUntilStackDeleteComplete, } from "@aws-sdk/client-cloudformation"; import { wait } from "@aws-doc-sdk-examples/lib/utils/util-timers.js"; import { parseArgs } from "node:util"; import { readFileSync } from "node:fs"; import { fileURLToPath } from "node:url"; import { dirname } from "node:path"; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); const stackName = "SiteWiseBasicsStack"; /** * @typedef {{ * iotSiteWiseClient: import('@aws-sdk/client-iotsitewise').IotSiteWiseClient, * cloudFormationClient: import('@aws-sdk/client-cloudformation').CloudFormationClient, * stackName, * stack, * askToDeleteResources: true, * asset: {assetName: "MyAsset1"}, * assetModel: {assetModelName: "MyAssetModel1"}, * portal: {portalName: "MyPortal1"}, * gateway: {gatewayName: "MyGateway1"}, * propertyIds: [], * contactEmail: "user@mydomain.com", * thing: "MyThing1", * sampleData: { temperature: 23.5, humidity: 65.0} * }} State */ /** * Used repeatedly to have the user press enter. * @type {ScenarioInput} */ const pressEnter = new ScenarioInput("continue", "Press Enter to continue", { type: "confirm", }); const greet = new ScenarioOutput( "greet", `AWS IoT SiteWise is a fully managed industrial software-as-a-service (SaaS) that makes it easy to collect, store, organize, and monitor data from industrial equipment and processes. It is designed to help industrial and manufacturing organizations collect data from their equipment and processes, and use that data to make informed decisions about their operations. One of the key features of AWS IoT SiteWise is its ability to connect to a wide range of industrial equipment and systems, including programmable logic controllers (PLCs), sensors, and other industrial devices. It can collect data from these devices and organize it into a unified data model, making it easier to analyze and gain insights from the data. AWS IoT SiteWise also provides tools for visualizing the data, setting up alarms and alerts, and generating reports. Another key feature of AWS IoT SiteWise is its ability to scale to handle large volumes of data. It can collect and store data from thousands of devices and process millions of data points per second, making it suitable for large-scale industrial operations. Additionally, AWS IoT SiteWise is designed to be secure and compliant, with features like role-based access controls, data encryption, and integration with other AWS services for additional security and compliance features. Let's get started...`, { header: true }, ); const displayBuildCloudFormationStack = new ScenarioOutput( "displayBuildCloudFormationStack", "This scenario uses AWS CloudFormation to create an IAM role that is required for this scenario. The stack will now be deployed.", ); const sdkBuildCloudFormationStack = new ScenarioAction( "sdkBuildCloudFormationStack", async (/** @type {State} */ state) => { try { const data = readFileSync( `${__dirname}/../../../../resources/cfn/iotsitewise_basics/SitewiseRoles-template.yml`, "utf8", ); await state.cloudFormationClient.send( new CreateStackCommand({ StackName: stackName, TemplateBody: data, Capabilities: ["CAPABILITY_IAM"], }), ); await waitUntilStackExists( { client: state.cloudFormationClient }, { StackName: stackName }, ); await waitUntilStackCreateComplete( { client: state.cloudFormationClient }, { StackName: stackName }, ); const stack = await state.cloudFormationClient.send( new DescribeStacksCommand({ StackName: stackName, }), ); state.stack = stack.Stacks[0].Outputs[0]; console.log(`The ARN of the IAM role is ${state.stack.OutputValue}`); } catch (caught) { console.error(caught.message); throw caught; } }, ); const displayCreateAWSSiteWiseAssetModel = new ScenarioOutput( "displayCreateAWSSiteWiseAssetModel", `1. Create an AWS SiteWise Asset Model An AWS IoT SiteWise Asset Model is a way to represent the physical assets, such as equipment, processes, and systems, that exist in an industrial environment. This model provides a structured and hierarchical representation of these assets, allowing users to define the relationships and properties of each asset. This scenario creates two asset model properties: temperature and humidity.`, ); const sdkCreateAWSSiteWiseAssetModel = new ScenarioAction( "sdkCreateAWSSiteWiseAssetModel", async (/** @type {State} */ state) => { let assetModelResponse; try { assetModelResponse = await state.iotSiteWiseClient.send( new CreateAssetModelCommand({ assetModelName: state.assetModel.assetModelName, assetModelProperties: [ { name: "Temperature", dataType: "DOUBLE", type: { measurement: {}, }, }, { name: "Humidity", dataType: "DOUBLE", type: { measurement: {}, }, }, ], }), ); state.assetModel.assetModelId = assetModelResponse.assetModelId; console.log( `Asset Model successfully created. Asset Model ID: ${state.assetModel.assetModelId}`, ); } catch (caught) { if (caught.name === "ResourceAlreadyExistsException") { console.log( `The Asset Model ${state.assetModel.assetModelName} already exists.`, ); throw caught; } console.error(`${caught.message}`); throw caught; } }, ); const displayCreateAWSIoTSiteWiseAssetModel = new ScenarioOutput( "displayCreateAWSIoTSiteWiseAssetModel", `2. Create an AWS IoT SiteWise Asset The IoT SiteWise model that we just created defines the structure and metadata for your physical assets. Now we create an asset from the asset model. Let's wait 30 seconds for the asset to be ready.`, ); const waitThirtySeconds = new ScenarioAction("waitThirtySeconds", async () => { await wait(30); // wait 30 seconds console.log("Time's up! Let's check the asset's status."); }); const sdkCreateAWSIoTSiteWiseAssetModel = new ScenarioAction( "sdkCreateAWSIoTSiteWiseAssetModel", async (/** @type {State} */ state) => { try { const assetResponse = await state.iotSiteWiseClient.send( new CreateAssetCommand({ assetModelId: state.assetModel.assetModelId, assetName: state.asset.assetName, }), ); state.asset.assetId = assetResponse.assetId; console.log(`Asset created with ID: ${state.asset.assetId}`); } catch (caught) { if (caught.name === "ResourceNotFoundException") { console.log( `The Asset ${state.assetModel.assetModelName} was not found.`, ); throw caught; } console.error(`${caught.message}`); throw caught; } }, ); const displayRetrievePropertyId = new ScenarioOutput( "displayRetrievePropertyId", `3. Retrieve the property ID values To send data to an asset, we need to get the property ID values. In this scenario, we access the temperature and humidity property ID values.`, ); const sdkRetrievePropertyId = new ScenarioAction( "sdkRetrievePropertyId", async (state) => { try { const retrieveResponse = await state.iotSiteWiseClient.send( new ListAssetModelPropertiesCommand({ assetModelId: state.assetModel.assetModelId, }), ); for (const retrieveResponseKey in retrieveResponse.assetModelPropertySummaries) { if ( retrieveResponse.assetModelPropertySummaries[retrieveResponseKey] .name === "Humidity" ) { state.propertyIds.Humidity = retrieveResponse.assetModelPropertySummaries[ retrieveResponseKey ].id; } if ( retrieveResponse.assetModelPropertySummaries[retrieveResponseKey] .name === "Temperature" ) { state.propertyIds.Temperature = retrieveResponse.assetModelPropertySummaries[ retrieveResponseKey ].id; } } console.log(`The Humidity propertyId is ${state.propertyIds.Humidity}`); console.log( `The Temperature propertyId is ${state.propertyIds.Temperature}`, ); } catch (caught) { if (caught.name === "IoTSiteWiseException") { console.log( `There was a problem retrieving the properties: ${caught.message}`, ); throw caught; } console.error(`${caught.message}`); throw caught; } }, ); const displaySendDataToIoTSiteWiseAsset = new ScenarioOutput( "displaySendDataToIoTSiteWiseAsset", `4. Send data to an AWS IoT SiteWise Asset By sending data to an IoT SiteWise Asset, you can aggregate data from multiple sources, normalize the data into a standard format, and store it in a centralized location. This makes it easier to analyze and gain insights from the data. In this example, we generate sample temperature and humidity data and send it to the AWS IoT SiteWise asset.`, ); const sdkSendDataToIoTSiteWiseAsset = new ScenarioAction( "sdkSendDataToIoTSiteWiseAsset", async (state) => { try { const sendResponse = await state.iotSiteWiseClient.send( new BatchPutAssetPropertyValueCommand({ entries: [ { entryId: "entry-3", assetId: state.asset.assetId, propertyId: state.propertyIds.Humidity, propertyValues: [ { value: { doubleValue: state.sampleData.humidity, }, timestamp: { timeInSeconds: Math.floor(Date.now() / 1000), }, }, ], }, { entryId: "entry-4", assetId: state.asset.assetId, propertyId: state.propertyIds.Temperature, propertyValues: [ { value: { doubleValue: state.sampleData.temperature, }, timestamp: { timeInSeconds: Math.floor(Date.now() / 1000), }, }, ], }, ], }), ); console.log("The data was sent successfully."); } catch (caught) { if (caught.name === "ResourceNotFoundException") { console.log(`The Asset ${state.asset.assetName} was not found.`); throw caught; } console.error(`${caught.message}`); throw caught; } }, ); const displayRetrieveValueOfIoTSiteWiseAsset = new ScenarioOutput( "displayRetrieveValueOfIoTSiteWiseAsset", `5. Retrieve the value of the IoT SiteWise Asset property IoT SiteWise is an AWS service that allows you to collect, process, and analyze industrial data from connected equipment and sensors. One of the key benefits of reading an IoT SiteWise property is the ability to gain valuable insights from your industrial data.`, ); const sdkRetrieveValueOfIoTSiteWiseAsset = new ScenarioAction( "sdkRetrieveValueOfIoTSiteWiseAsset", async (/** @type {State} */ state) => { try { const temperatureResponse = await state.iotSiteWiseClient.send( new GetAssetPropertyValueCommand({ assetId: state.asset.assetId, propertyId: state.propertyIds.Temperature, }), ); const humidityResponse = await state.iotSiteWiseClient.send( new GetAssetPropertyValueCommand({ assetId: state.asset.assetId, propertyId: state.propertyIds.Humidity, }), ); console.log( `The property value for Temperature is ${temperatureResponse.propertyValue.value.doubleValue}`, ); console.log( `The property value for Humidity is ${humidityResponse.propertyValue.value.doubleValue}`, ); } catch (caught) { if (caught.name === "ResourceNotFoundException") { console.log(`The Asset ${state.asset.assetName} was not found.`); throw caught; } console.error(`${caught.message}`); throw caught; } }, ); const displayCreateIoTSiteWisePortal = new ScenarioOutput( "displayCreateIoTSiteWisePortal", `6. Create an IoT SiteWise Portal An IoT SiteWise Portal allows you to aggregate data from multiple industrial sources, such as sensors, equipment, and control systems, into a centralized platform.`, ); const sdkCreateIoTSiteWisePortal = new ScenarioAction( "sdkCreateIoTSiteWisePortal", async (/** @type {State} */ state) => { try { const createPortalResponse = await state.iotSiteWiseClient.send( new CreatePortalCommand({ portalName: state.portal.portalName, portalContactEmail: state.contactEmail, roleArn: state.stack.OutputValue, }), ); state.portal = { ...state.portal, ...createPortalResponse }; await wait(5); // Allow the portal to properly propagate. console.log( `Portal created successfully. Portal ID ${createPortalResponse.portalId}`, ); } catch (caught) { if (caught.name === "IoTSiteWiseException") { console.log( `There was a problem creating the Portal: ${caught.message}.`, ); throw caught; } console.error(`${caught.message}`); throw caught; } }, ); const displayDescribePortal = new ScenarioOutput( "displayDescribePortal", `7. Describe the Portal In this step, we get a description of the portal and display the portal URL.`, ); const sdkDescribePortal = new ScenarioAction( "sdkDescribePortal", async (/** @type {State} */ state) => { try { const describePortalResponse = await state.iotSiteWiseClient.send( new DescribePortalCommand({ portalId: state.portal.portalId, }), ); console.log(`Portal URL: ${describePortalResponse.portalStartUrl}`); } catch (caught) { if (caught.name === "ResourceNotFoundException") { console.log(`The Portal ${state.portal.portalName} was not found.`); throw caught; } console.error(`${caught.message}`); throw caught; } }, ); const displayCreateIoTSiteWiseGateway = new ScenarioOutput( "displayCreateIoTSiteWiseGateway", `8. Create an IoT SiteWise Gateway IoT SiteWise Gateway serves as the bridge between industrial equipment, sensors, and the cloud-based IoT SiteWise service. It is responsible for securely collecting, processing, and transmitting data from various industrial assets to the IoT SiteWise platform, enabling real-time monitoring, analysis, and optimization of industrial operations.`, ); const sdkCreateIoTSiteWiseGateway = new ScenarioAction( "sdkCreateIoTSiteWiseGateway", async (/** @type {State} */ state) => { try { const createGatewayResponse = await state.iotSiteWiseClient.send( new CreateGatewayCommand({ gatewayName: state.gateway.gatewayName, gatewayPlatform: { greengrassV2: { coreDeviceThingName: state.thing, }, }, }), ); console.log( `Gateway creation completed successfully. ID is ${createGatewayResponse.gatewayId}`, ); state.gateway.gatewayId = createGatewayResponse.gatewayId; } catch (caught) { if (caught.name === "IoTSiteWiseException") { console.log( `There was a problem creating the gateway: ${caught.message}.`, ); throw caught; } console.error(`${caught.message}`); throw caught; } }, ); const displayDescribeIoTSiteWiseGateway = new ScenarioOutput( "displayDescribeIoTSiteWiseGateway", "9. Describe the IoT SiteWise Gateway", ); const sdkDescribeIoTSiteWiseGateway = new ScenarioAction( "sdkDescribeIoTSiteWiseGateway", async (/** @type {State} */ state) => { try { const describeGatewayResponse = await state.iotSiteWiseClient.send( new DescribeGatewayCommand({ gatewayId: state.gateway.gatewayId, }), ); console.log("Gateway creation completed successfully."); console.log(`Gateway Name: ${describeGatewayResponse.gatewayName}`); console.log(`Gateway ARN: ${describeGatewayResponse.gatewayArn}`); console.log( `Gateway Platform: ${Object.keys(describeGatewayResponse.gatewayPlatform)}`, ); console.log( `Gateway Creation Date: ${describeGatewayResponse.creationDate}`, ); } catch (caught) { if (caught.name === "ResourceNotFoundException") { console.log(`The Gateway ${state.gateway.gatewayId} was not found.`); throw caught; } console.error(`${caught.message}`); throw caught; } }, ); const askToDeleteResources = new ScenarioInput( "askToDeleteResources", `10. Delete the AWS IoT SiteWise Assets Before you can delete the Asset Model, you must delete the assets.`, { type: "confirm" }, ); const displayConfirmDeleteResources = new ScenarioAction( "displayConfirmDeleteResources", async (/** @type {State} */ state) => { if (state.askToDeleteResources) { return "You selected to delete the SiteWise assets."; } return "The resources will not be deleted. Please delete them manually to avoid charges."; }, ); const sdkDeleteResources = new ScenarioAction( "sdkDeleteResources", async (/** @type {State} */ state) => { await wait(10); // Give the portal status time to catch up. try { await state.iotSiteWiseClient.send( new DeletePortalCommand({ portalId: state.portal.portalId, }), ); console.log( `Portal ${state.portal.portalName} was deleted successfully.`, ); } catch (caught) { if (caught.name === "ResourceNotFoundException") { console.log(`The Portal ${state.portal.portalName} was not found.`); } else { console.log(`When trying to delete the portal: ${caught.message}`); } } try { await state.iotSiteWiseClient.send( new DeleteGatewayCommand({ gatewayId: state.gateway.gatewayId, }), ); console.log( `Gateway ${state.gateway.gatewayName} was deleted successfully.`, ); } catch (caught) { if (caught.name === "ResourceNotFoundException") { console.log(`The Gateway ${state.gateway.gatewayId} was not found.`); } else { console.log(`When trying to delete the gateway: ${caught.message}`); } } try { await state.iotSiteWiseClient.send( new DeleteAssetCommand({ assetId: state.asset.assetId, }), ); await wait(5); // Allow the delete to finish. console.log(`Asset ${state.asset.assetName} was deleted successfully.`); } catch (caught) { if (caught.name === "ResourceNotFoundException") { console.log(`The Asset ${state.asset.assetName} was not found.`); } else { console.log(`When deleting the asset: ${caught.message}`); } } await wait(30); // Allow asset deletion to finish. try { await state.iotSiteWiseClient.send( new DeleteAssetModelCommand({ assetModelId: state.assetModel.assetModelId, }), ); console.log( `Asset Model ${state.assetModel.assetModelName} was deleted successfully.`, ); } catch (caught) { if (caught.name === "ResourceNotFoundException") { console.log( `The Asset Model ${state.assetModel.assetModelName} was not found.`, ); } else { console.log(`When deleting the asset model: ${caught.message}`); } } try { await state.cloudFormationClient.send( new DeleteStackCommand({ StackName: stackName, }), ); await waitUntilStackDeleteComplete( { client: state.cloudFormationClient }, { StackName: stackName }, ); console.log("The stack was deleted successfully."); } catch (caught) { console.log( `${caught.message}. The stack was NOT deleted. Please clean up the resources manually.`, ); } }, { skipWhen: (/** @type {{}} */ state) => !state.askToDeleteResources }, ); const goodbye = new ScenarioOutput( "goodbye", "This concludes the IoT Sitewise Basics scenario for the AWS Javascript SDK v3. Thank you!", ); const myScenario = new Scenario( "IoTSiteWise Basics", [ greet, pressEnter, displayBuildCloudFormationStack, sdkBuildCloudFormationStack, pressEnter, displayCreateAWSSiteWiseAssetModel, sdkCreateAWSSiteWiseAssetModel, displayCreateAWSIoTSiteWiseAssetModel, pressEnter, waitThirtySeconds, sdkCreateAWSIoTSiteWiseAssetModel, pressEnter, displayRetrievePropertyId, sdkRetrievePropertyId, pressEnter, displaySendDataToIoTSiteWiseAsset, sdkSendDataToIoTSiteWiseAsset, pressEnter, displayRetrieveValueOfIoTSiteWiseAsset, sdkRetrieveValueOfIoTSiteWiseAsset, pressEnter, displayCreateIoTSiteWisePortal, sdkCreateIoTSiteWisePortal, pressEnter, displayDescribePortal, sdkDescribePortal, pressEnter, displayCreateIoTSiteWiseGateway, sdkCreateIoTSiteWiseGateway, pressEnter, displayDescribeIoTSiteWiseGateway, sdkDescribeIoTSiteWiseGateway, pressEnter, askToDeleteResources, displayConfirmDeleteResources, sdkDeleteResources, goodbye, ], { iotSiteWiseClient: new IoTSiteWiseClient({}), cloudFormationClient: new CloudFormationClient({}), asset: { assetName: "MyAsset1" }, assetModel: { assetModelName: "MyAssetModel1" }, portal: { portalName: "MyPortal1" }, gateway: { gatewayName: "MyGateway1" }, propertyIds: [], contactEmail: "user@mydomain.com", thing: "MyThing1", sampleData: { temperature: 23.5, humidity: 65.0 }, }, ); /** @type {{ stepHandlerOptions: StepHandlerOptions }} */ export const main = async (stepHandlerOptions) => { await myScenario.run(stepHandlerOptions); }; // Invoke main function if this file was run directly. if (process.argv[1] === fileURLToPath(import.meta.url)) { const { values } = parseArgs({ options: { yes: { type: "boolean", short: "y", }, }, }); main({ confirmAll: values.yes }); }

アクション

次のコード例は、BatchPutAssetPropertyValue を使用する方法を示しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { BatchPutAssetPropertyValueCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Batch put asset property values. * @param {{ entries : array }} */ export const main = async ({ entries }) => { const client = new IoTSiteWiseClient({}); try { const result = await client.send( new BatchPutAssetPropertyValueCommand({ entries: entries, }), ); console.log("Asset properties batch put successfully."); return result; } catch (caught) { if (caught instanceof Error && caught.name === "ResourceNotFound") { console.warn(`${caught.message}. A resource could not be found.`); } else { throw caught; } } };
  • API の詳細については、AWS SDK for JavaScript 「 API リファレンス」のBatchPutAssetPropertyValue」を参照してください。

次のコード例は、BatchPutAssetPropertyValue を使用する方法を示しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { BatchPutAssetPropertyValueCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Batch put asset property values. * @param {{ entries : array }} */ export const main = async ({ entries }) => { const client = new IoTSiteWiseClient({}); try { const result = await client.send( new BatchPutAssetPropertyValueCommand({ entries: entries, }), ); console.log("Asset properties batch put successfully."); return result; } catch (caught) { if (caught instanceof Error && caught.name === "ResourceNotFound") { console.warn(`${caught.message}. A resource could not be found.`); } else { throw caught; } } };
  • API の詳細については、AWS SDK for JavaScript 「 API リファレンス」のBatchPutAssetPropertyValue」を参照してください。

次の例は、CreateAsset を使用する方法を説明しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { CreateAssetCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Create an Asset. * @param {{ assetName : string, assetModelId: string }} */ export const main = async ({ assetName, assetModelId }) => { const client = new IoTSiteWiseClient({}); try { const result = await client.send( new CreateAssetCommand({ assetName: assetName, // The name to give the Asset. assetModelId: assetModelId, // The ID of the asset model from which to create the asset. }), ); console.log("Asset created successfully."); return result; } catch (caught) { if (caught instanceof Error && caught.name === "ResourceNotFound") { console.warn( `${caught.message}. The asset model could not be found. Please check the asset model id.`, ); } else { throw caught; } } };
  • API の詳細については、「 API CreateAsset」を参照してください。 AWS SDK for JavaScript

次の例は、CreateAsset を使用する方法を説明しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { CreateAssetCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Create an Asset. * @param {{ assetName : string, assetModelId: string }} */ export const main = async ({ assetName, assetModelId }) => { const client = new IoTSiteWiseClient({}); try { const result = await client.send( new CreateAssetCommand({ assetName: assetName, // The name to give the Asset. assetModelId: assetModelId, // The ID of the asset model from which to create the asset. }), ); console.log("Asset created successfully."); return result; } catch (caught) { if (caught instanceof Error && caught.name === "ResourceNotFound") { console.warn( `${caught.message}. The asset model could not be found. Please check the asset model id.`, ); } else { throw caught; } } };
  • API の詳細については、「 API CreateAsset」を参照してください。 AWS SDK for JavaScript

次のコード例は、CreateAssetModel を使用する方法を示しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { CreateAssetModelCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Create an Asset Model. * @param {{ assetName : string, assetModelId: string }} */ export const main = async ({ assetModelName, assetModelId }) => { const client = new IoTSiteWiseClient({}); try { const result = await client.send( new CreateAssetModelCommand({ assetModelName: assetModelName, // The name to give the Asset Model. }), ); console.log("Asset model created successfully."); return result; } catch (caught) { if (caught instanceof Error && caught.name === "IoTSiteWiseError") { console.warn( `${caught.message}. There was a problem creating the asset model.`, ); } else { throw caught; } } };
  • API の詳細については、「 API CreateAssetModel」を参照してください。 AWS SDK for JavaScript

次のコード例は、CreateAssetModel を使用する方法を示しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { CreateAssetModelCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Create an Asset Model. * @param {{ assetName : string, assetModelId: string }} */ export const main = async ({ assetModelName, assetModelId }) => { const client = new IoTSiteWiseClient({}); try { const result = await client.send( new CreateAssetModelCommand({ assetModelName: assetModelName, // The name to give the Asset Model. }), ); console.log("Asset model created successfully."); return result; } catch (caught) { if (caught instanceof Error && caught.name === "IoTSiteWiseError") { console.warn( `${caught.message}. There was a problem creating the asset model.`, ); } else { throw caught; } } };
  • API の詳細については、「 API CreateAssetModel」を参照してください。 AWS SDK for JavaScript

次の例は、CreateGateway を使用する方法を説明しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { CreateGatewayCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Create a Gateway. * @param {{ }} */ export const main = async ({ gatewayName }) => { const client = new IoTSiteWiseClient({}); try { const result = await client.send( new CreateGatewayCommand({ gatewayName: gatewayName, // The name to give the created Gateway. }), ); console.log("Gateway created successfully."); return result; } catch (caught) { if (caught instanceof Error && caught.name === "IoTSiteWiseError") { console.warn( `${caught.message}. There was a problem creating the Gateway.`, ); } else { throw caught; } } };
  • API の詳細については、AWS SDK for JavaScript 「 API CreateGateway」を参照してください。

次の例は、CreateGateway を使用する方法を説明しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { CreateGatewayCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Create a Gateway. * @param {{ }} */ export const main = async ({ gatewayName }) => { const client = new IoTSiteWiseClient({}); try { const result = await client.send( new CreateGatewayCommand({ gatewayName: gatewayName, // The name to give the created Gateway. }), ); console.log("Gateway created successfully."); return result; } catch (caught) { if (caught instanceof Error && caught.name === "IoTSiteWiseError") { console.warn( `${caught.message}. There was a problem creating the Gateway.`, ); } else { throw caught; } } };
  • API の詳細については、AWS SDK for JavaScript 「 API CreateGateway」を参照してください。

次の例は、CreatePortal を使用する方法を説明しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { CreatePortalCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Create a Portal. * @param {{ portalName: string, portalContactEmail: string, roleArn: string }} */ export const main = async ({ portalName, portalContactEmail, roleArn }) => { const client = new IoTSiteWiseClient({}); try { const result = await client.send( new CreatePortalCommand({ portalName: portalName, // The name to give the created Portal. portalContactEmail: portalContactEmail, // A valid contact email. roleArn: roleArn, // The ARN of a service role that allows the portal's users to access the portal's resources. }), ); console.log("Portal created successfully."); return result; } catch (caught) { if (caught instanceof Error && caught.name === "IoTSiteWiseError") { console.warn( `${caught.message}. There was a problem creating the Portal.`, ); } else { throw caught; } } };
  • API の詳細については、AWS SDK for JavaScript 「 API CreatePortal」を参照してください。

次の例は、CreatePortal を使用する方法を説明しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { CreatePortalCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Create a Portal. * @param {{ portalName: string, portalContactEmail: string, roleArn: string }} */ export const main = async ({ portalName, portalContactEmail, roleArn }) => { const client = new IoTSiteWiseClient({}); try { const result = await client.send( new CreatePortalCommand({ portalName: portalName, // The name to give the created Portal. portalContactEmail: portalContactEmail, // A valid contact email. roleArn: roleArn, // The ARN of a service role that allows the portal's users to access the portal's resources. }), ); console.log("Portal created successfully."); return result; } catch (caught) { if (caught instanceof Error && caught.name === "IoTSiteWiseError") { console.warn( `${caught.message}. There was a problem creating the Portal.`, ); } else { throw caught; } } };
  • API の詳細については、AWS SDK for JavaScript 「 API CreatePortal」を参照してください。

次のコード例は、DeleteAsset を使用する方法を示しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { DeleteAssetCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Delete an asset. * @param {{ assetId : string }} */ export const main = async ({ assetId }) => { const client = new IoTSiteWiseClient({}); try { await client.send( new DeleteAssetCommand({ assetId: assetId, // The model id to delete. }), ); console.log("Asset deleted successfully."); return { assetDeleted: true }; } catch (caught) { if (caught instanceof Error && caught.name === "ResourceNotFound") { console.warn( `${caught.message}. There was a problem deleting the asset.`, ); } else { throw caught; } } };
  • API の詳細については、「 API AWS SDK for JavaScript リファレンス」のDeleteAsset」を参照してください。

次のコード例は、DeleteAsset を使用する方法を示しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { DeleteAssetCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Delete an asset. * @param {{ assetId : string }} */ export const main = async ({ assetId }) => { const client = new IoTSiteWiseClient({}); try { await client.send( new DeleteAssetCommand({ assetId: assetId, // The model id to delete. }), ); console.log("Asset deleted successfully."); return { assetDeleted: true }; } catch (caught) { if (caught instanceof Error && caught.name === "ResourceNotFound") { console.warn( `${caught.message}. There was a problem deleting the asset.`, ); } else { throw caught; } } };
  • API の詳細については、「 API AWS SDK for JavaScript リファレンス」のDeleteAsset」を参照してください。

次のコード例は、DeleteAssetModel を使用する方法を示しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { DeleteAssetModelCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Delete an asset model. * @param {{ assetModelId : string }} */ export const main = async ({ assetModelId }) => { const client = new IoTSiteWiseClient({}); try { await client.send( new DeleteAssetModelCommand({ assetModelId: assetModelId, // The model id to delete. }), ); console.log("Asset model deleted successfully."); return { assetModelDeleted: true }; } catch (caught) { if (caught instanceof Error && caught.name === "ResourceNotFound") { console.warn( `${caught.message}. There was a problem deleting the asset model.`, ); } else { throw caught; } } };
  • API の詳細については、「 API AWS SDK for JavaScript リファレンス」のDeleteAssetModel」を参照してください。

次のコード例は、DeleteAssetModel を使用する方法を示しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { DeleteAssetModelCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Delete an asset model. * @param {{ assetModelId : string }} */ export const main = async ({ assetModelId }) => { const client = new IoTSiteWiseClient({}); try { await client.send( new DeleteAssetModelCommand({ assetModelId: assetModelId, // The model id to delete. }), ); console.log("Asset model deleted successfully."); return { assetModelDeleted: true }; } catch (caught) { if (caught instanceof Error && caught.name === "ResourceNotFound") { console.warn( `${caught.message}. There was a problem deleting the asset model.`, ); } else { throw caught; } } };
  • API の詳細については、「 API AWS SDK for JavaScript リファレンス」のDeleteAssetModel」を参照してください。

次の例は、DeleteGateway を使用する方法を説明しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { DeleteGatewayCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Create an SSM document. * @param {{ content: string, name: string, documentType?: DocumentType }} */ export const main = async ({ gatewayId }) => { const client = new IoTSiteWiseClient({}); try { await client.send( new DeleteGatewayCommand({ gatewayId: gatewayId, // The ID of the Gateway to describe. }), ); console.log("Gateway deleted successfully."); return { gatewayDeleted: true }; } catch (caught) { if (caught instanceof Error && caught.name === "ResourceNotFound") { console.warn( `${caught.message}. The Gateway could not be found. Please check the Gateway Id.`, ); } else { throw caught; } } };
  • API の詳細については、AWS SDK for JavaScript 「 API リファレンス」のDeleteGateway」を参照してください。

次の例は、DeleteGateway を使用する方法を説明しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { DeleteGatewayCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Create an SSM document. * @param {{ content: string, name: string, documentType?: DocumentType }} */ export const main = async ({ gatewayId }) => { const client = new IoTSiteWiseClient({}); try { await client.send( new DeleteGatewayCommand({ gatewayId: gatewayId, // The ID of the Gateway to describe. }), ); console.log("Gateway deleted successfully."); return { gatewayDeleted: true }; } catch (caught) { if (caught instanceof Error && caught.name === "ResourceNotFound") { console.warn( `${caught.message}. The Gateway could not be found. Please check the Gateway Id.`, ); } else { throw caught; } } };
  • API の詳細については、AWS SDK for JavaScript 「 API リファレンス」のDeleteGateway」を参照してください。

次の例は、DeletePortal を使用する方法を説明しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { DeletePortalCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * List asset models. * @param {{ portalId : string }} */ export const main = async ({ portalId }) => { const client = new IoTSiteWiseClient({}); try { await client.send( new DeletePortalCommand({ portalId: portalId, // The id of the portal. }), ); console.log("Portal deleted successfully."); return { portalDeleted: true }; } catch (caught) { if (caught instanceof Error && caught.name === "ResourceNotFound") { console.warn( `${caught.message}. There was a problem deleting the portal. Please check the portal id.`, ); } else { throw caught; } } };
  • API の詳細については、AWS SDK for JavaScript 「 API リファレンス」のDeletePortal」を参照してください。

次の例は、DeletePortal を使用する方法を説明しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { DeletePortalCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * List asset models. * @param {{ portalId : string }} */ export const main = async ({ portalId }) => { const client = new IoTSiteWiseClient({}); try { await client.send( new DeletePortalCommand({ portalId: portalId, // The id of the portal. }), ); console.log("Portal deleted successfully."); return { portalDeleted: true }; } catch (caught) { if (caught instanceof Error && caught.name === "ResourceNotFound") { console.warn( `${caught.message}. There was a problem deleting the portal. Please check the portal id.`, ); } else { throw caught; } } };
  • API の詳細については、AWS SDK for JavaScript 「 API リファレンス」のDeletePortal」を参照してください。

次のコード例は、DescribeAssetModel を使用する方法を示しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { DescribeAssetModelCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Describe an asset model. * @param {{ assetModelId : string }} */ export const main = async ({ assetModelId }) => { const client = new IoTSiteWiseClient({}); try { const { assetModelDescription } = await client.send( new DescribeAssetModelCommand({ assetModelId: assetModelId, // The ID of the Gateway to describe. }), ); console.log("Asset model information retrieved successfully."); return { assetModelDescription: assetModelDescription }; } catch (caught) { if (caught instanceof Error && caught.name === "ResourceNotFound") { console.warn( `${caught.message}. The asset model could not be found. Please check the asset model id.`, ); } else { throw caught; } } };
  • API の詳細については、AWS SDK for JavaScript 「 API リファレンス」の「DescribeAssetModel」を参照してください。

次のコード例は、DescribeAssetModel を使用する方法を示しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { DescribeAssetModelCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Describe an asset model. * @param {{ assetModelId : string }} */ export const main = async ({ assetModelId }) => { const client = new IoTSiteWiseClient({}); try { const { assetModelDescription } = await client.send( new DescribeAssetModelCommand({ assetModelId: assetModelId, // The ID of the Gateway to describe. }), ); console.log("Asset model information retrieved successfully."); return { assetModelDescription: assetModelDescription }; } catch (caught) { if (caught instanceof Error && caught.name === "ResourceNotFound") { console.warn( `${caught.message}. The asset model could not be found. Please check the asset model id.`, ); } else { throw caught; } } };
  • API の詳細については、AWS SDK for JavaScript 「 API リファレンス」の「DescribeAssetModel」を参照してください。

次の例は、DescribeGateway を使用する方法を説明しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { DescribeGatewayCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Create an SSM document. * @param {{ content: string, name: string, documentType?: DocumentType }} */ export const main = async ({ gatewayId }) => { const client = new IoTSiteWiseClient({}); try { const { gatewayDescription } = await client.send( new DescribeGatewayCommand({ gatewayId: gatewayId, // The ID of the Gateway to describe. }), ); console.log("Gateway information retrieved successfully."); return { gatewayDescription: gatewayDescription }; } catch (caught) { if (caught instanceof Error && caught.name === "ResourceNotFound") { console.warn( `${caught.message}. The Gateway could not be found. Please check the Gateway Id.`, ); } else { throw caught; } } };
  • API の詳細については、AWS SDK for JavaScript 「 API DescribeGateway」を参照してください。

次の例は、DescribeGateway を使用する方法を説明しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { DescribeGatewayCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Create an SSM document. * @param {{ content: string, name: string, documentType?: DocumentType }} */ export const main = async ({ gatewayId }) => { const client = new IoTSiteWiseClient({}); try { const { gatewayDescription } = await client.send( new DescribeGatewayCommand({ gatewayId: gatewayId, // The ID of the Gateway to describe. }), ); console.log("Gateway information retrieved successfully."); return { gatewayDescription: gatewayDescription }; } catch (caught) { if (caught instanceof Error && caught.name === "ResourceNotFound") { console.warn( `${caught.message}. The Gateway could not be found. Please check the Gateway Id.`, ); } else { throw caught; } } };
  • API の詳細については、AWS SDK for JavaScript 「 API DescribeGateway」を参照してください。

次のコード例は、DescribePortal を使用する方法を示しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { DescribePortalCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Describe a portal. * @param {{ portalId: string }} */ export const main = async ({ portalId }) => { const client = new IoTSiteWiseClient({}); try { const result = await client.send( new DescribePortalCommand({ portalId: portalId, // The ID of the Gateway to describe. }), ); console.log("Portal information retrieved successfully."); return result; } catch (caught) { if (caught instanceof Error && caught.name === "ResourceNotFound") { console.warn( `${caught.message}. The Portal could not be found. Please check the Portal Id.`, ); } else { throw caught; } } };
  • API の詳細については、AWS SDK for JavaScript 「 API DescribePortal」を参照してください。

次のコード例は、DescribePortal を使用する方法を示しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { DescribePortalCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Describe a portal. * @param {{ portalId: string }} */ export const main = async ({ portalId }) => { const client = new IoTSiteWiseClient({}); try { const result = await client.send( new DescribePortalCommand({ portalId: portalId, // The ID of the Gateway to describe. }), ); console.log("Portal information retrieved successfully."); return result; } catch (caught) { if (caught instanceof Error && caught.name === "ResourceNotFound") { console.warn( `${caught.message}. The Portal could not be found. Please check the Portal Id.`, ); } else { throw caught; } } };
  • API の詳細については、AWS SDK for JavaScript 「 API DescribePortal」を参照してください。

次のコード例は、GetAssetPropertyValue を使用する方法を示しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { GetAssetPropertyValueCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Describe an asset property value. * @param {{ entryId : string }} */ export const main = async ({ entryId }) => { const client = new IoTSiteWiseClient({}); try { const result = await client.send( new GetAssetPropertyValueCommand({ entryId: entryId, // The ID of the Gateway to describe. }), ); console.log("Asset property information retrieved successfully."); return result; } catch (caught) { if (caught instanceof Error && caught.name === "ResourceNotFound") { console.warn( `${caught.message}. The asset property entry could not be found. Please check the entry id.`, ); } else { throw caught; } } };
  • API の詳細については、AWS SDK for JavaScript 「 API リファレンス」のGetAssetPropertyValue」を参照してください。

次のコード例は、GetAssetPropertyValue を使用する方法を示しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { GetAssetPropertyValueCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * Describe an asset property value. * @param {{ entryId : string }} */ export const main = async ({ entryId }) => { const client = new IoTSiteWiseClient({}); try { const result = await client.send( new GetAssetPropertyValueCommand({ entryId: entryId, // The ID of the Gateway to describe. }), ); console.log("Asset property information retrieved successfully."); return result; } catch (caught) { if (caught instanceof Error && caught.name === "ResourceNotFound") { console.warn( `${caught.message}. The asset property entry could not be found. Please check the entry id.`, ); } else { throw caught; } } };
  • API の詳細については、AWS SDK for JavaScript 「 API リファレンス」のGetAssetPropertyValue」を参照してください。

次のコード例は、ListAssetModels を使用する方法を示しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { ListAssetModelsCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * List asset models. * @param {{ assetModelTypes : array }} */ export const main = async ({ assetModelTypes = [] }) => { const client = new IoTSiteWiseClient({}); try { const result = await client.send( new ListAssetModelsCommand({ assetModelTypes: assetModelTypes, // The model types to list }), ); console.log("Asset model types retrieved successfully."); return result; } catch (caught) { if (caught instanceof Error && caught.name === "IoTSiteWiseError") { console.warn( `${caught.message}. There was a problem listing the asset model types.`, ); } else { throw caught; } } };
  • API の詳細については、AWS SDK for JavaScript 「 API リファレンス」のListAssetModels」を参照してください。

次のコード例は、ListAssetModels を使用する方法を示しています。

SDK for JavaScript (v3)
注記

GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

import { ListAssetModelsCommand, IoTSiteWiseClient, } from "@aws-sdk/client-iotsitewise"; import { parseArgs } from "node:util"; /** * List asset models. * @param {{ assetModelTypes : array }} */ export const main = async ({ assetModelTypes = [] }) => { const client = new IoTSiteWiseClient({}); try { const result = await client.send( new ListAssetModelsCommand({ assetModelTypes: assetModelTypes, // The model types to list }), ); console.log("Asset model types retrieved successfully."); return result; } catch (caught) { if (caught instanceof Error && caught.name === "IoTSiteWiseError") { console.warn( `${caught.message}. There was a problem listing the asset model types.`, ); } else { throw caught; } } };
  • API の詳細については、AWS SDK for JavaScript 「 API リファレンス」のListAssetModels」を参照してください。

プライバシーサイト規約Cookie の設定
© 2025, Amazon Web Services, Inc. or its affiliates.All rights reserved.