33 * SPDX-License-Identifier: Apache-2.0
44 */
55
6- import * as CloudFormationV3 from '@aws-sdk/client-cloudformation'
6+ import * as CloudFormation from '@aws-sdk/client-cloudformation'
77import { AsyncCollection } from '../utilities/asyncCollection'
88import { hasProps , isNonNullable , RequiredProps } from '../utilities/tsUtils'
99import { ClientWrapper } from './clientWrapper'
1010
1111export interface StackSummary
12- extends RequiredProps < CloudFormationV3 . StackSummary , 'StackName' | 'CreationTime' | 'StackStatus' > {
13- DriftInformation : RequiredProps < CloudFormationV3 . StackDriftInformation , 'StackDriftStatus' >
12+ extends RequiredProps < CloudFormation . StackSummary , 'StackName' | 'CreationTime' | 'StackStatus' > {
13+ DriftInformation : RequiredProps < CloudFormation . StackDriftInformation , 'StackDriftStatus' >
1414}
1515
16- export type StackResource = RequiredProps < CloudFormationV3 . StackResource , 'ResourceType' >
16+ export type StackResource = RequiredProps < CloudFormation . StackResource , 'ResourceType' >
1717
18- export interface DescribeStackResourcesOutput extends CloudFormationV3 . DescribeStackResourcesOutput {
18+ export interface DescribeStackResourcesOutput extends CloudFormation . DescribeStackResourcesOutput {
1919 StackResources : StackResource [ ]
2020}
21- export class CloudFormationClient extends ClientWrapper < CloudFormationV3 . CloudFormationClient > {
21+ export class CloudFormationClient extends ClientWrapper < CloudFormation . CloudFormationClient > {
2222 public constructor ( regionCode : string ) {
23- super ( regionCode , CloudFormationV3 . CloudFormationClient )
23+ super ( regionCode , CloudFormation . CloudFormationClient )
2424 }
2525
26- public async deleteStack ( name : string ) : Promise < CloudFormationV3 . DeleteStackCommandOutput > {
27- return await this . makeRequest ( CloudFormationV3 . DeleteStackCommand , { StackName : name } )
26+ public async deleteStack ( name : string ) : Promise < CloudFormation . DeleteStackCommandOutput > {
27+ return await this . makeRequest ( CloudFormation . DeleteStackCommand , { StackName : name } )
2828 }
2929
30- public async describeType ( typeName : string ) : Promise < CloudFormationV3 . DescribeTypeOutput > {
31- return await this . makeRequest ( CloudFormationV3 . DescribeTypeCommand , { TypeName : typeName } )
30+ public async describeType ( typeName : string ) : Promise < CloudFormation . DescribeTypeOutput > {
31+ return await this . makeRequest ( CloudFormation . DescribeTypeCommand , { TypeName : typeName } )
3232 }
3333
3434 public async * listStacks (
35- statusFilter : CloudFormationV3 . StackStatus [ ] = [ 'CREATE_COMPLETE' , 'UPDATE_COMPLETE' ]
35+ statusFilter : CloudFormation . StackStatus [ ] = [ 'CREATE_COMPLETE' , 'UPDATE_COMPLETE' ]
3636 ) : AsyncIterableIterator < StackSummary > {
37- const request : CloudFormationV3 . ListStacksInput = {
37+ const request : CloudFormation . ListStacksInput = {
3838 StackStatusFilter : statusFilter ,
3939 }
4040
4141 do {
42- const response : CloudFormationV3 . ListStacksOutput = await this . makeRequest (
43- CloudFormationV3 . ListStacksCommand ,
42+ const response : CloudFormation . ListStacksOutput = await this . makeRequest (
43+ CloudFormation . ListStacksCommand ,
4444 request
4545 )
4646
@@ -53,24 +53,22 @@ export class CloudFormationClient extends ClientWrapper<CloudFormationV3.CloudFo
5353 } while ( request . NextToken )
5454 }
5555
56- public listAllStacks ( request : CloudFormationV3 . ListStacksInput = { } ) : AsyncCollection < StackSummary [ ] > {
57- return this . makePaginatedRequest (
58- CloudFormationV3 . paginateListStacks ,
59- request ,
60- ( page ) => page . StackSummaries
61- ) . map ( ( s ) => s . filter ( isStackSummary ) )
56+ public listAllStacks ( request : CloudFormation . ListStacksInput = { } ) : AsyncCollection < StackSummary [ ] > {
57+ return this . makePaginatedRequest ( CloudFormation . paginateListStacks , request , ( page ) => page . StackSummaries ) . map (
58+ ( s ) => s . filter ( isStackSummary )
59+ )
6260 }
6361
64- public async * listTypes ( ) : AsyncIterableIterator < CloudFormationV3 . TypeSummary > {
65- const request : CloudFormationV3 . ListTypesInput = {
62+ public async * listTypes ( ) : AsyncIterableIterator < CloudFormation . TypeSummary > {
63+ const request : CloudFormation . ListTypesInput = {
6664 DeprecatedStatus : 'LIVE' ,
6765 Type : 'RESOURCE' ,
6866 Visibility : 'PUBLIC' ,
6967 }
7068
7169 do {
72- const response : CloudFormationV3 . ListTypesOutput = await this . makeRequest (
73- CloudFormationV3 . ListTypesCommand ,
70+ const response : CloudFormation . ListTypesOutput = await this . makeRequest (
71+ CloudFormation . ListTypesCommand ,
7472 request
7573 )
7674
@@ -83,11 +81,11 @@ export class CloudFormationClient extends ClientWrapper<CloudFormationV3.CloudFo
8381 }
8482
8583 public async describeStackResources ( name : string ) : Promise < DescribeStackResourcesOutput > {
86- return await this . makeRequest ( CloudFormationV3 . DescribeStackResourcesCommand , { StackName : name } )
84+ return await this . makeRequest ( CloudFormation . DescribeStackResourcesCommand , { StackName : name } )
8785 }
8886}
8987
90- function isStackSummary ( s : CloudFormationV3 . StackSummary | undefined ) : s is StackSummary {
88+ function isStackSummary ( s : CloudFormation . StackSummary | undefined ) : s is StackSummary {
9189 return (
9290 isNonNullable ( s ) &&
9391 hasProps ( s , 'StackName' , 'CreationTime' , 'StackStatus' , 'DriftInformation' ) &&
0 commit comments