Skip to content

Commit 38ee12f

Browse files
committed
JavaScript: IoTSiteWise Basics follow
1 parent 7fc628c commit 38ee12f

35 files changed

+2772
-0
lines changed

.doc_gen/metadata/iot_sitewise_metadata.yaml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ iotsitewise_Hello:
2222
- description:
2323
snippet_tags:
2424
- python.example_code.iotsitewise.Hello
25+
JavaScript:
26+
versions:
27+
- sdk_version: 3
28+
github: javascriptv3/example_code/iotsitewise
29+
excerpts:
30+
- description:
31+
snippet_tags:
32+
- iotsitewise.JavaScript.Basics.hello
2533
services:
2634
iotsitewise: {ListAssetModels}
2735
iotsitewise_DescribeGateway:
@@ -43,6 +51,14 @@ iotsitewise_DescribeGateway:
4351
snippet_tags:
4452
- python.example_code.iotsitewise.IoTSitewiseWrapper.decl
4553
- python.example_code.iotsitewise.DescribeGateway
54+
JavaScript:
55+
versions:
56+
- sdk_version: 3
57+
github: javascriptv3/example_code/iotsitewise
58+
excerpts:
59+
- description:
60+
snippet_tags:
61+
- iotsitewise.JavaScript.Basics.describeGateway
4662
services:
4763
iotsitewise: {DescribeGateway}
4864
iotsitewise_DeleteGateway:
@@ -64,6 +80,14 @@ iotsitewise_DeleteGateway:
6480
snippet_tags:
6581
- python.example_code.iotsitewise.IoTSitewiseWrapper.decl
6682
- python.example_code.iotsitewise.DeleteGateway
83+
JavaScript:
84+
versions:
85+
- sdk_version: 3
86+
github: javascriptv3/example_code/iotsitewise
87+
excerpts:
88+
- description:
89+
snippet_tags:
90+
- iotsitewise.JavaScript.Basics.deleteGateway
6791
services:
6892
iotsitewise: {DeleteGateway}
6993
iotsitewise_CreateGateway:
@@ -85,6 +109,14 @@ iotsitewise_CreateGateway:
85109
snippet_tags:
86110
- python.example_code.iotsitewise.IoTSitewiseWrapper.decl
87111
- python.example_code.iotsitewise.CreateGateway
112+
JavaScript:
113+
versions:
114+
- sdk_version: 3
115+
github: javascriptv3/example_code/iotsitewise
116+
excerpts:
117+
- description:
118+
snippet_tags:
119+
- iotsitewise.JavaScript.Basics.createGateway
88120
services:
89121
iotsitewise: {CreateGateway}
90122
iotsitewise_DescribePortal:
@@ -106,6 +138,14 @@ iotsitewise_DescribePortal:
106138
snippet_tags:
107139
- python.example_code.iotsitewise.IoTSitewiseWrapper.decl
108140
- python.example_code.iotsitewise.CreateGateway
141+
JavaScript:
142+
versions:
143+
- sdk_version: 3
144+
github: javascriptv3/example_code/iotsitewise
145+
excerpts:
146+
- description:
147+
snippet_tags:
148+
- iotsitewise.JavaScript.Basics.describePortal
109149
services:
110150
iotsitewise: {DescribePortal}
111151
iotsitewise_ListAssetModels:
@@ -127,6 +167,14 @@ iotsitewise_ListAssetModels:
127167
snippet_tags:
128168
- python.example_code.iotsitewise.IoTSitewiseWrapper.decl
129169
- python.example_code.iotsitewise.ListAssetModels
170+
JavaScript:
171+
versions:
172+
- sdk_version: 3
173+
github: javascriptv3/example_code/iotsitewise
174+
excerpts:
175+
- description:
176+
snippet_tags:
177+
- iotsitewise.JavaScript.Basics.listAssetModels
130178
services:
131179
iotsitewise: {ListAssetModels}
132180
iotsitewise_DeletePortal:
@@ -148,6 +196,14 @@ iotsitewise_DeletePortal:
148196
snippet_tags:
149197
- python.example_code.iotsitewise.IoTSitewiseWrapper.decl
150198
- python.example_code.iotsitewise.DeletePortal
199+
JavaScript:
200+
versions:
201+
- sdk_version: 3
202+
github: javascriptv3/example_code/iotsitewise
203+
excerpts:
204+
- description:
205+
snippet_tags:
206+
- iotsitewise.JavaScript.Basics.deletePortal
151207
services:
152208
iotsitewise: {DeletePortal}
153209
iotsitewise_CreatePortal:
@@ -169,6 +225,14 @@ iotsitewise_CreatePortal:
169225
snippet_tags:
170226
- python.example_code.iotsitewise.IoTSitewiseWrapper.decl
171227
- python.example_code.iotsitewise.CreatePortal
228+
JavaScript:
229+
versions:
230+
- sdk_version: 3
231+
github: javascriptv3/example_code/iotsitewise
232+
excerpts:
233+
- description:
234+
snippet_tags:
235+
- iotsitewise.JavaScript.Basics.createPortal
172236
services:
173237
iotsitewise: {CreatePortal}
174238
iotsitewise_DeleteAssetModel:
@@ -190,6 +254,14 @@ iotsitewise_DeleteAssetModel:
190254
snippet_tags:
191255
- python.example_code.iotsitewise.IoTSitewiseWrapper.decl
192256
- python.example_code.iotsitewise.DeleteAssetModel
257+
JavaScript:
258+
versions:
259+
- sdk_version: 3
260+
github: javascriptv3/example_code/iotsitewise
261+
excerpts:
262+
- description:
263+
snippet_tags:
264+
- iotsitewise.JavaScript.Basics.deleteAssetModel
193265
services:
194266
iotsitewise: {DeleteAssetModel}
195267
iotsitewise_DeleteAsset:
@@ -211,6 +283,14 @@ iotsitewise_DeleteAsset:
211283
snippet_tags:
212284
- python.example_code.iotsitewise.IoTSitewiseWrapper.decl
213285
- python.example_code.iotsitewise.DeleteAsset
286+
JavaScript:
287+
versions:
288+
- sdk_version: 3
289+
github: javascriptv3/example_code/iotsitewise
290+
excerpts:
291+
- description:
292+
snippet_tags:
293+
- iotsitewise.JavaScript.Basics.deleteAsset
214294
services:
215295
iotsitewise: {DeleteAsset}
216296
iotsitewise_DescribeAssetModel:
@@ -223,6 +303,14 @@ iotsitewise_DescribeAssetModel:
223303
- description:
224304
snippet_tags:
225305
- sitewise.java2.describe.asset.model.main
306+
JavaScript:
307+
versions:
308+
- sdk_version: 3
309+
github: javascriptv3/example_code/iotsitewise
310+
excerpts:
311+
- description:
312+
snippet_tags:
313+
- iotsitewise.JavaScript.Basics.describeAssetModel
226314
services:
227315
iotsitewise: {DescribeAssetModel}
228316
iotsitewise_GetAssetPropertyValue:
@@ -244,6 +332,14 @@ iotsitewise_GetAssetPropertyValue:
244332
snippet_tags:
245333
- python.example_code.iotsitewise.IoTSitewiseWrapper.decl
246334
- python.example_code.iotsitewise.GetAssetPropertyValue
335+
JavaScript:
336+
versions:
337+
- sdk_version: 3
338+
github: javascriptv3/example_code/iotsitewise
339+
excerpts:
340+
- description:
341+
snippet_tags:
342+
- iotsitewise.JavaScript.Basics.getAssetPropertyValue
247343
services:
248344
iotsitewise: {GetAssetPropertyValue}
249345
iotsitewise_BatchPutAssetPropertyValue:
@@ -275,6 +371,14 @@ iotsitewise_BatchPutAssetPropertyValue:
275371
function.
276372
snippet_tags:
277373
- python.example_code.iotsitewise.BatchPutAssetPropertyValue.values
374+
JavaScript:
375+
versions:
376+
- sdk_version: 3
377+
github: javascriptv3/example_code/iotsitewise
378+
excerpts:
379+
- description:
380+
snippet_tags:
381+
- iotsitewise.JavaScript.Basics.batchPutAssetPropertyValue
278382
services:
279383
iotsitewise: {BatchPutAssetPropertyValue}
280384
iotsitewise_CreateAsset:
@@ -296,6 +400,14 @@ iotsitewise_CreateAsset:
296400
snippet_tags:
297401
- python.example_code.iotsitewise.IoTSitewiseWrapper.decl
298402
- python.example_code.iotsitewise.CreateAsset
403+
JavaScript:
404+
versions:
405+
- sdk_version: 3
406+
github: javascriptv3/example_code/iotsitewise
407+
excerpts:
408+
- description:
409+
snippet_tags:
410+
- iotsitewise.JavaScript.Basics.createAsset
299411
services:
300412
iotsitewise: {CreateAsset}
301413
iotsitewise_CreateAssetModel:
@@ -321,6 +433,14 @@ iotsitewise_CreateAssetModel:
321433
Here is an example of a properties list to pass to the function.
322434
snippet_tags:
323435
- python.example_code.iotsitewise.CreateAssetModel.properties
436+
JavaScript:
437+
versions:
438+
- sdk_version: 3
439+
github: javascriptv3/example_code/iotsitewise
440+
excerpts:
441+
- description:
442+
snippet_tags:
443+
- iotsitewise.JavaScript.Basics.createAssetModel
324444
services:
325445
iotsitewise: {CreateAssetModel}
326446
iotsitewise_Scenario:
@@ -353,5 +473,13 @@ iotsitewise_Scenario:
353473
genai: some
354474
snippet_tags:
355475
- python.example_code.iotsitewise.IoTSitewiseWrapper.class
476+
JavaScript:
477+
versions:
478+
- sdk_version: 3
479+
github: javascriptv3/example_code/iotsitewise
480+
excerpts:
481+
- description:
482+
snippet_tags:
483+
- iotsitewise.JavaScript.Basics.scenario
356484
services:
357485
iotsitewise: {}
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# AWS IoT SiteWise code examples for the SDK for JavaScript (v3)
2+
3+
## Overview
4+
5+
Shows how to use the AWS SDK for JavaScript (v3) to work with AWS IoT SiteWise.
6+
7+
<!--custom.overview.start-->
8+
<!--custom.overview.end-->
9+
10+
_AWS IoT SiteWise _
11+
12+
## ⚠ Important
13+
14+
* Running this code might result in charges to your AWS account. For more details, see [AWS Pricing](https://aws.amazon.com/pricing/) and [Free Tier](https://aws.amazon.com/free/).
15+
* Running the tests might result in charges to your AWS account.
16+
* We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege).
17+
* This code is not tested in every AWS Region. For more information, see [AWS Regional Services](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services).
18+
19+
<!--custom.important.start-->
20+
<!--custom.important.end-->
21+
22+
## Code examples
23+
24+
### Prerequisites
25+
26+
For prerequisites, see the [README](../../README.md#Prerequisites) in the `javascriptv3` folder.
27+
28+
29+
<!--custom.prerequisites.start-->
30+
<!--custom.prerequisites.end-->
31+
32+
### Get started
33+
34+
- [Hello AWS IoT SiteWise](hello.js#L4) (`ListAssetModels`)
35+
36+
37+
### Basics
38+
39+
Code examples that show you how to perform the essential operations within a service.
40+
41+
- [Learn the basics](scenarios/iotsitewise-basics.js)
42+
43+
44+
### Single actions
45+
46+
Code excerpts that show you how to call individual service functions.
47+
48+
- [BatchPutAssetPropertyValue](actions/batch-put-asset-property-value.js#L4)
49+
- [CreateAsset](actions/create-asset.js#L4)
50+
- [CreateAssetModel](actions/create-asset-model.js#L4)
51+
- [CreateGateway](actions/create-gateway.js#L4)
52+
- [CreatePortal](actions/create-portal.js#L4)
53+
- [DeleteAsset](actions/delete-asset.js#L4)
54+
- [DeleteAssetModel](actions/delete-asset-model.js#L4)
55+
- [DeleteGateway](actions/delete-gateway.js#L4)
56+
- [DeletePortal](actions/delete-portal.js#L4)
57+
- [DescribeAssetModel](actions/describe-asset-model.js#L4)
58+
- [DescribeGateway](actions/describe-gateway.js#L4)
59+
- [DescribePortal](actions/describe-portal.js#L4)
60+
- [GetAssetPropertyValue](actions/get-asset-property-value.js#L4)
61+
- [ListAssetModels](actions/list-asset-models.js#L4)
62+
63+
64+
<!--custom.examples.start-->
65+
<!--custom.examples.end-->
66+
67+
## Run the examples
68+
69+
### Instructions
70+
71+
**Note**: All code examples are written in ECMAscript 6 (ES6). For guidelines on converting to CommonJS, see
72+
[JavaScript ES6/CommonJS syntax](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/sdk-examples-javascript-syntax.html).
73+
74+
**Run a single action**
75+
76+
```bash
77+
node ./actions/<fileName>
78+
```
79+
80+
**Run a scenario**
81+
82+
Most scenarios can be run with the following command:
83+
```bash
84+
node ./scenarios/<fileName>
85+
```
86+
87+
**Run with options**
88+
89+
Some actions and scenarios can be run with options from the command line:
90+
```bash
91+
node ./scenarios/<fileName> --option1 --option2
92+
```
93+
[util.parseArgs](https://nodejs.org/api/util.html#utilparseargsconfig) is used to configure
94+
these options. For the specific options available to each script, see the `parseArgs` usage
95+
for that file.
96+
97+
<!--custom.instructions.start-->
98+
<!--custom.instructions.end-->
99+
100+
#### Hello AWS IoT SiteWise
101+
102+
This example shows you how to get started using AWS IoT SiteWise.
103+
104+
```bash
105+
node ./hello.js
106+
```
107+
108+
#### Learn the basics
109+
110+
This example shows you how to learn core operations for AWS IoT SiteWise using an AWS SDK.
111+
112+
113+
<!--custom.basic_prereqs.iotsitewise_Scenario.start-->
114+
<!--custom.basic_prereqs.iotsitewise_Scenario.end-->
115+
116+
117+
<!--custom.basics.iotsitewise_Scenario.start-->
118+
<!--custom.basics.iotsitewise_Scenario.end-->
119+
120+
121+
### Tests
122+
123+
⚠ Running tests might result in charges to your AWS account.
124+
125+
126+
To find instructions for running these tests, see the [README](../../README.md#Tests)
127+
in the `javascriptv3` folder.
128+
129+
130+
131+
<!--custom.tests.start-->
132+
<!--custom.tests.end-->
133+
134+
## Additional resources
135+
136+
- [AWS IoT SiteWise Developer Guide](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/what-is-sitewise.html)
137+
- [AWS IoT SiteWise API Reference](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/Welcome.html)
138+
- [SDK for JavaScript (v3) AWS IoT SiteWise reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/iotsitewise)
139+
140+
<!--custom.resources.start-->
141+
<!--custom.resources.end-->
142+
143+
---
144+
145+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
146+
147+
SPDX-License-Identifier: Apache-2.0

0 commit comments

Comments
 (0)