| 396 | } |
| 397 | |
| 398 | export async function listDeployments( |
| 399 | client: AppConfigClient, |
| 400 | applicationId: string, |
| 401 | environmentId: string, |
| 402 | maxResults?: number | null, |
| 403 | nextToken?: string | null |
| 404 | ) { |
| 405 | const response = await client.send( |
| 406 | new ListDeploymentsCommand({ |
| 407 | ApplicationId: applicationId, |
| 408 | EnvironmentId: environmentId, |
| 409 | ...(maxResults ? { MaxResults: maxResults } : {}), |
| 410 | ...(nextToken ? { NextToken: nextToken } : {}), |
| 411 | }) |
| 412 | ) |
| 413 | |
| 414 | const deployments = (response.Items ?? []).map((item) => ({ |
| 415 | deploymentNumber: item.DeploymentNumber ?? null, |
| 416 | configurationName: item.ConfigurationName ?? null, |
| 417 | configurationVersion: item.ConfigurationVersion ?? null, |
| 418 | deploymentDurationInMinutes: item.DeploymentDurationInMinutes ?? null, |
| 419 | growthType: item.GrowthType ?? null, |
| 420 | growthFactor: item.GrowthFactor ?? null, |
| 421 | finalBakeTimeInMinutes: item.FinalBakeTimeInMinutes ?? null, |
| 422 | state: item.State ?? null, |
| 423 | percentageComplete: item.PercentageComplete ?? null, |
| 424 | startedAt: item.StartedAt?.toISOString() ?? null, |
| 425 | completedAt: item.CompletedAt?.toISOString() ?? null, |
| 426 | versionLabel: item.VersionLabel ?? null, |
| 427 | })) |
| 428 | |
| 429 | return { |
| 430 | deployments, |
| 431 | nextToken: response.NextToken ?? null, |
| 432 | count: deployments.length, |
| 433 | } |
| 434 | } |
| 435 | |
| 436 | export async function stopDeployment( |
| 437 | client: AppConfigClient, |