ListDeploymentTargetsCommand

Returns an array of target IDs that are associated a deployment.

Example Syntax

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

import { CodeDeployClient, ListDeploymentTargetsCommand } from "@aws-sdk/client-codedeploy"; // ES Modules import
// const { CodeDeployClient, ListDeploymentTargetsCommand } = require("@aws-sdk/client-codedeploy"); // CommonJS import
const client = new CodeDeployClient(config);
const input = { // ListDeploymentTargetsInput
  deploymentId: "STRING_VALUE", // required
  nextToken: "STRING_VALUE",
  targetFilters: { // TargetFilters
    "<keys>": [ // FilterValueList
      "STRING_VALUE",
    ],
  },
};
const command = new ListDeploymentTargetsCommand(input);
const response = await client.send(command);
// { // ListDeploymentTargetsOutput
//   targetIds: [ // TargetIdList
//     "STRING_VALUE",
//   ],
//   nextToken: "STRING_VALUE",
// };

ListDeploymentTargetsCommand Input

Parameter
Type
Description
deploymentId
Required
string | undefined

The unique ID of a deployment.

nextToken
string | undefined

A token identifier returned from the previous ListDeploymentTargets call. It can be used to return the next set of deployment targets in the list.

targetFilters
Partial<Record<TargetFilterName, string[]> | undefined

A key used to filter the returned targets. The two valid values are:

  • TargetStatus - A TargetStatus filter string can be Failed, InProgress, Pending, Ready, Skipped, Succeeded, or Unknown.

  • ServerInstanceLabel - A ServerInstanceLabel filter string can be Blue or Green.

ListDeploymentTargetsCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
nextToken
string | undefined

If a large amount of information is returned, a token identifier is also returned. It can be used in a subsequent ListDeploymentTargets call to return the next set of deployment targets in the list.

targetIds
string[] | undefined

The unique IDs of deployment targets.

Throws

Name
Fault
Details
DeploymentDoesNotExistException
client

The deployment with the user or Amazon Web Services account does not exist.

DeploymentIdRequiredException
client

At least one deployment ID must be specified.

DeploymentNotStartedException
client

The specified deployment has not started.

InvalidDeploymentIdException
client

At least one of the deployment IDs was specified in an invalid format.

InvalidDeploymentInstanceTypeException
client

An instance type was specified for an in-place deployment. Instance types are supported for blue/green deployments only.

InvalidInstanceStatusException
client

The specified instance status does not exist.

InvalidInstanceTypeException
client

An invalid instance type was specified for instances in a blue/green deployment. Valid values include "Blue" for an original environment and "Green" for a replacement environment.

InvalidNextTokenException
client

The next token was specified in an invalid format.

InvalidTargetFilterNameException
client

The target filter name is invalid.

CodeDeployServiceException
Base exception class for all service exceptions from CodeDeploy service.