forked from awsdocs/aws-doc-sdk-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JavaScript (v3): Formatting and linting fixes (CodeCommit, CloudWatch) (
- Loading branch information
Showing
51 changed files
with
1,628 additions
and
524 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,91 @@ | ||
# Cloudwatch examples for the AWS SDK for JavaScript (v3) | ||
<!--Generated by WRITEME on 2023-10-11 16:26:01.796348 (UTC)--> | ||
|
||
# CloudWatch code examples for the SDK for JavaScript (v3) | ||
|
||
## Overview | ||
|
||
These code examples demonstrate how to work with Amazon CloudWatch | ||
using the AWS SDK for JavaScript (v3). | ||
Shows how to use the AWS SDK for JavaScript (v3) to work with Amazon CloudWatch. | ||
|
||
<!--custom.overview.start--> | ||
<!--custom.overview.end--> | ||
|
||
Amazon CloudWatch provides a reliable, scalable, and flexible monitoring solution that you can start using within minutes. | ||
You no longer need to set up, manage, and scale your own monitoring systems and infrastructure. | ||
_CloudWatch provides a reliable, scalable, and flexible monitoring solution that you can start using within minutes._ | ||
|
||
## ⚠️ Important | ||
## ⚠ Important | ||
|
||
- Running this code might result in charges to your AWS account. | ||
- Running this code might result in charges to your AWS account. For more details, see [AWS Pricing](https://aws.amazon.com/pricing/?aws-products-pricing.sort-by=item.additionalFields.productNameLowercase&aws-products-pricing.sort-order=asc&awsf.Free%20Tier%20Type=*all&awsf.tech-category=*all) and [Free Tier](https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&all-free-tier.sort-order=asc&awsf.Free%20Tier%20Types=*all&awsf.Free%20Tier%20Categories=*all). | ||
- Running the tests might result in charges to your AWS account. | ||
- 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). | ||
- 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). | ||
|
||
<!--custom.important.start--> | ||
<!--custom.important.end--> | ||
|
||
## Code examples | ||
|
||
### Single Actions | ||
### Prerequisites | ||
|
||
- [Create an alarm that watches a metric](actions/put-metric-alarm.js) | ||
- [Delete alarms](actions/delete-alarms.js) | ||
- [Describe alarms for a metric](actions/describe-alarms.js) | ||
- [Disable alarm actions](actions/disable-alarm-actions.js) | ||
- [Enable alarm actions](actions/enable-alarm-actions.js) | ||
- [List metrics](actions/list-metrics.js) | ||
- [Put data into a metric](actions/put-metric-data.js) | ||
For prerequisites, see the [README](../../README.md#Prerequisites) in the `javascriptv3` folder. | ||
|
||
**Note**: All code examples are written in ECMAscript 6 (ES6). For guidelines on converting to CommonJS, see | ||
[JavaScript ES6/CommonJS syntax](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/sdk-examples-javascript-syntax.html). | ||
<!--custom.prerequisites.start--> | ||
<!--custom.prerequisites.end--> | ||
|
||
## Run the examples | ||
### Single actions | ||
|
||
### Prerequisites | ||
Code excerpts that show you how to call individual service functions. | ||
|
||
1. [Set up AWS SDK for JavaScript](../README.md). | ||
1. Run `npm i`. | ||
- [Create a metric alarm](actions/put-metric-alarm.js#L6) (`PutMetricAlarm`) | ||
- [Delete alarms](actions/delete-alarms.js#L6) (`DeleteAlarms`) | ||
- [Describe alarms for a metric](actions/describe-alarms.js#L6) (`DescribeAlarmsForMetric`) | ||
- [Disable alarm actions](actions/disable-alarm-actions.js#L6) (`DisableAlarmActions`) | ||
- [Enable alarm actions](actions/enable-alarm-actions.js#L6) (`EnableAlarmActions`) | ||
- [List metrics](actions/list-metrics.js#L6) (`ListMetrics`) | ||
- [Put data into a metric](actions/put-metric-data.js#L6) (`PutMetricData`) | ||
|
||
## Run the examples | ||
|
||
### Instructions | ||
|
||
**Note**: All code examples are written in ECMAscript 6 (ES6). For guidelines on converting to CommonJS, see | ||
[JavaScript ES6/CommonJS syntax](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/sdk-examples-javascript-syntax.html). | ||
|
||
**Run a single action** | ||
|
||
1. Run `node ./actions/<fileName>`. | ||
OR | ||
1. Import `./actions/fileName` into another module. | ||
```bash | ||
node ./actions/<fileName> | ||
``` | ||
|
||
**Run a scenario** | ||
Most scenarios can be run with the following command: | ||
|
||
```bash | ||
node ./scenarios/<fileName> | ||
``` | ||
|
||
## Tests | ||
<!--custom.instructions.start--> | ||
<!--custom.instructions.end--> | ||
|
||
⚠️ Running the tests might result in charges to your AWS account. | ||
### Tests | ||
|
||
1. Run `npm i`. | ||
1. Run `npm run integration-test`. | ||
⚠ Running tests might result in charges to your AWS account. | ||
|
||
To find instructions for running these tests, see the [README](../../README.md#Tests) | ||
in the `javascriptv3` folder. | ||
|
||
<!--custom.tests.start--> | ||
<!--custom.tests.end--> | ||
|
||
## Additional resources | ||
|
||
- [Amazon CloudWatch User Guide](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatch.html) | ||
- [Amazon CloudWatch API reference](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/Welcome.html) | ||
- [Amazon CloudWatch Client - AWS SDK for JavaScript (v3)](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudwatch/index.html) | ||
- [CloudWatch User Guide](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatch.html) | ||
- [CloudWatch API Reference](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/Welcome.html) | ||
- [SDK for JavaScript (v3) CloudWatch reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudwatch) | ||
|
||
<!--custom.resources.start--> | ||
<!--custom.resources.end--> | ||
|
||
--- | ||
|
||
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
|
||
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 | ||
SPDX-License-Identifier: Apache-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "example-javascriptv3-codecommit", | ||
"version": "1.0.0", | ||
"author": "Corey Pyle <[email protected]>", | ||
"license": "Apache-2.0", | ||
"type": "module", | ||
"scripts": { | ||
"test": "vitest run **/*.unit.test.js" | ||
}, | ||
"dependencies": { | ||
"@aws-sdk/client-codecommit": "^3.427.0" | ||
}, | ||
"devDependencies": { | ||
"vitest": "^0.34.6" | ||
} | ||
} |
Oops, something went wrong.