Jump to Content

New API Documentation - Developer Preview Available

We are excited to announce the developer preview of our new API documentation for AWS SDK for JavaScript v3. Please follow instructions on the landing page to leave us your feedback.

Class ListEnvironmentsCommandProtected

Lists the environments for an application.

Example

Use a bare-bones client and the command you need to make an API call.

import { AppConfigClient, ListEnvironmentsCommand } from "@aws-sdk/client-appconfig"; // ES Modules import
// const { AppConfigClient, ListEnvironmentsCommand } = require("@aws-sdk/client-appconfig"); // CommonJS import
const client = new AppConfigClient(config);
const input = { // ListEnvironmentsRequest
ApplicationId: "STRING_VALUE", // required
MaxResults: Number("int"),
NextToken: "STRING_VALUE",
};
const command = new ListEnvironmentsCommand(input);
const response = await client.send(command);
// { // Environments
// Items: [ // EnvironmentList
// { // Environment
// ApplicationId: "STRING_VALUE",
// Id: "STRING_VALUE",
// Name: "STRING_VALUE",
// Description: "STRING_VALUE",
// State: "READY_FOR_DEPLOYMENT" || "DEPLOYING" || "ROLLING_BACK" || "ROLLED_BACK",
// Monitors: [ // MonitorList
// { // Monitor
// AlarmArn: "STRING_VALUE", // required
// AlarmRoleArn: "STRING_VALUE",
// },
// ],
// },
// ],
// NextToken: "STRING_VALUE",
// };

Param

ListEnvironmentsCommandInput

Returns

ListEnvironmentsCommandOutput

See

Throws

BadRequestException (client fault)

The input fails to satisfy the constraints specified by an Amazon Web Services service.

Throws

InternalServerException (server fault)

There was an internal failure in the AppConfig service.

Throws

ResourceNotFoundException (client fault)

The requested resource could not be found.

Throws

AppConfigServiceException

Base exception class for all service exceptions from AppConfig service.

Example

To list the available environments

// The following list-environments example lists the available environments in your AWS account for the specified application.
const input = {
"ApplicationId": "339ohji"
};
const command = new ListEnvironmentsCommand(input);
const response = await client.send(command);
/* response ==
{
"Items": [
{
"ApplicationId": "339ohji",
"Id": "54j1r29",
"Name": "Example-Environment",
"State": "READY_FOR_DEPLOYMENT"
}
]
}
*/
// example id: to-list-the-available-environments-1632267474389

Hierarchy

Constructors

Properties

Methods