Skip to content

Commit 377fa13

Browse files
committed
fix: prettier
1 parent d31abc1 commit 377fa13

File tree

21 files changed

+426
-374
lines changed

21 files changed

+426
-374
lines changed

reference-artifacts/Custom-Scripts/lza-upgrade/src/asea-config/index.ts

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,6 @@ export interface ResolvedConfigBase {
11721172
* Prevents duplicate vpc names in LZA configuration
11731173
*/
11741174
lzaVpcName?: string;
1175-
11761175
}
11771176

11781177
export interface ResolvedVpcConfig extends ResolvedConfigBase {
@@ -1183,15 +1182,15 @@ export interface ResolvedVpcConfig extends ResolvedConfigBase {
11831182
}
11841183

11851184
export class AcceleratorConfig {
1186-
static fromBuffer(content: Buffer): AcceleratorConfig {
1185+
static 'fromBuffer'(content: Buffer): AcceleratorConfig {
11871186
return this.fromString(content.toString());
11881187
}
11891188

1190-
static fromString(content: string): AcceleratorConfig {
1189+
static 'fromString'(content: string): AcceleratorConfig {
11911190
return this.fromObject(JSON.parse(content));
11921191
}
11931192

1194-
static fromObject<S>(content: S): AcceleratorConfig {
1193+
static 'fromObject'<S>(content: S): AcceleratorConfig {
11951194
const values = t.parse(AcceleratorConfigType, content);
11961195
return new AcceleratorConfig(values);
11971196
}
@@ -1202,50 +1201,50 @@ export class AcceleratorConfig {
12021201
readonly 'workload-account-configs': AccountsConfig;
12031202
readonly 'organizational-units': OrganizationalUnitsConfig;
12041203

1205-
constructor(values: t.TypeOf<typeof AcceleratorConfigType>) {
1204+
'constructor'(values: t.TypeOf<typeof AcceleratorConfigType>) {
12061205
Object.assign(this, values);
12071206
}
12081207

12091208
/**
12101209
* @return AccountConfig
12111210
*/
1212-
getAccountByKey(accountKey: string): AccountConfig {
1211+
'getAccountByKey'(accountKey: string): AccountConfig {
12131212
return this['mandatory-account-configs'][accountKey] ?? this['workload-account-configs'][accountKey];
12141213
}
12151214

12161215
/**
12171216
* @return [accountKey: string, accountConfig: AccountConfig][]
12181217
*/
1219-
getMandatoryAccountConfigs(): [string, AccountConfig][] {
1218+
'getMandatoryAccountConfigs'(): [string, AccountConfig][] {
12201219
return Object.entries(this['mandatory-account-configs']);
12211220
}
12221221

12231222
/**
12241223
* @return [accountKey: string, accountConfig: AccountConfig][]
12251224
*/
1226-
getWorkloadAccountConfigs(): [string, AccountConfig][] {
1225+
'getWorkloadAccountConfigs'(): [string, AccountConfig][] {
12271226
return Object.entries(this['workload-account-configs']).filter(([_, value]) => !value.deleted);
12281227
}
12291228

12301229
/**
12311230
* @return [accountKey: string, accountConfig: AccountConfig][]
12321231
*/
1233-
getAccountConfigs(): [string, AccountConfig][] {
1232+
'getAccountConfigs'(): [string, AccountConfig][] {
12341233
return [...this.getMandatoryAccountConfigs(), ...this.getWorkloadAccountConfigs()];
12351234
}
12361235

12371236
/**
12381237
* @return [ouKey: string, ouConfig: OrganizationalUnitConfig][]
12391238
*/
1240-
getOrganizationConfigs(): [string, OrganizationalUnitConfig][] {
1239+
'getOrganizationConfigs'(): [string, OrganizationalUnitConfig][] {
12411240
return Object.entries(this['organizational-units']);
12421241
}
12431242

12441243
/**
12451244
* Helper function to return all certificates.
12461245
* This function will not return where these accounts are deployed. It only returns list of certificates in configuration.
12471246
*/
1248-
getCertificatesConfig() {
1247+
'getCertificatesConfig'() {
12491248
const certificates: CertificateConfig[] = [];
12501249
for (const [_accountKey, accountConfig] of this.getAccountConfigs()) {
12511250
certificates.push(...(accountConfig.certificates ?? []));
@@ -1257,12 +1256,12 @@ export class AcceleratorConfig {
12571256
return certificates;
12581257
}
12591258

1260-
get managementAccountConfig(): MandatoryAccountConfig {
1259+
get 'managementAccountConfig'(): MandatoryAccountConfig {
12611260
const managementAccountName = this['global-options']['aws-org-management'].account;
12621261
return this['mandatory-account-configs'][managementAccountName];
12631262
}
12641263

1265-
getCustomerManagedPoliciesByAccount(accountKey: string) {
1264+
'getCustomerManagedPoliciesByAccount'(accountKey: string) {
12661265
const policies: string[] = [];
12671266
const accountConfig = this['mandatory-account-configs'][accountKey] ?? this['workload-account-configs'][accountKey];
12681267
if (!accountConfig) return [];
@@ -1281,15 +1280,15 @@ export class AcceleratorConfig {
12811280
/**
12821281
* @return [accountKey: string, accountConfig: AccountConfig][]
12831282
*/
1284-
getAccountConfigsForOu(ou: string): [string, AccountConfig][] {
1283+
'getAccountConfigsForOu'(ou: string): [string, AccountConfig][] {
12851284
return this.getAccountConfigs().filter(([_, accountConfig]) => accountConfig.ou === ou);
12861285
}
12871286

12881287
/**
12891288
* Find all alb's
12901289
* @returns AlbConfigType
12911290
*/
1292-
getAlbConfigs(): AlbConfigType[] {
1291+
'getAlbConfigs'(): AlbConfigType[] {
12931292
const albConfigs: AlbConfigType[] = [];
12941293
for (const [_accountKey, accountConfig] of this.getAccountConfigs()) {
12951294
for (const alb of accountConfig.alb ?? []) {
@@ -1301,7 +1300,7 @@ export class AcceleratorConfig {
13011300
return albConfigs;
13021301
}
13031302

1304-
getAlbTemplateConfigs(): AlbConfigType[] {
1303+
'getAlbTemplateConfigs'(): AlbConfigType[] {
13051304
const albConfigs: AlbConfigType[] = [];
13061305
for (const [_ouKey, organizationConfig] of this.getOrganizationConfigs()) {
13071306
for (const alb of organizationConfig.alb ?? []) {
@@ -1317,7 +1316,7 @@ export class AcceleratorConfig {
13171316
* Find all VPC configurations in mandatory accounts, workload accounts and organizational units. VPC configuration in
13181317
* organizational units will have the correct `accountKey` based on the `deploy` value of the VPC configuration.
13191318
*/
1320-
getVpcConfigs(): ResolvedVpcConfig[] {
1319+
'getVpcConfigs'(): ResolvedVpcConfig[] {
13211320
const vpcConfigs: ResolvedVpcConfig[] = [];
13221321

13231322
// Add mandatory account VPC configuration first
@@ -1388,7 +1387,7 @@ export class AcceleratorConfig {
13881387
return vpcConfigs;
13891388
}
13901389

1391-
getAzSubnets(accountKey: string, vpcName: string, subnetName: string) {
1390+
'getAzSubnets'(accountKey: string, vpcName: string, subnetName: string) {
13921391
const vpcConfigs = this.getVpcConfigs();
13931392
const vpcConfig = vpcConfigs.find((v) => v.accountKey === accountKey && v.vpcConfig.name === vpcName)?.vpcConfig;
13941393
if (!vpcConfig) {

reference-artifacts/Custom-Scripts/lza-upgrade/src/common/aws/backoff.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,5 @@ export const isThrottlingError = (
7070

7171
// eslint-disable-next-line @typescript-eslint/no-explicit-any
7272
export async function delay(ms: number): Promise<any> {
73-
return new Promise(resolve => setTimeout(resolve, ms));
73+
return new Promise((resolve) => setTimeout(resolve, ms));
7474
}

reference-artifacts/Custom-Scripts/lza-upgrade/src/common/outputs/load-assigned-cidrs.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import { DynamoDB } from '../aws/dynamodb';
22

33
export interface VpcAssignedCidr {
44
'vpc-name': string;
5-
status: string;
6-
cidr: string;
7-
region: string;
5+
'status': string;
6+
'cidr': string;
7+
'region': string;
88
'account-key': string;
99
'account-ou-key': string;
10-
pool: string;
10+
'pool': string;
1111
}
1212

1313
export interface SubnetAssignedCidr {
@@ -30,7 +30,7 @@ export async function loadVpcAssignedCidrs(tableName: string, client: DynamoDB):
3030
console.warn(`Did not find assignedCidrs in DynamoDB table "${tableName}"`);
3131
return [];
3232
}
33-
return cidrsResponse as unknown as VpcAssignedCidr[];
33+
return (cidrsResponse as unknown) as VpcAssignedCidr[];
3434
}
3535

3636
export async function loadSubnetAssignedCidrs(tableName: string, client: DynamoDB): Promise<SubnetAssignedCidr[]> {
@@ -41,5 +41,5 @@ export async function loadSubnetAssignedCidrs(tableName: string, client: DynamoD
4141
console.warn(`Did not find assignedCidrs in DynamoDB table "${tableName}"`);
4242
return [];
4343
}
44-
return cidrsResponse as unknown as SubnetAssignedCidr[];
44+
return (cidrsResponse as unknown) as SubnetAssignedCidr[];
4545
}

reference-artifacts/Custom-Scripts/lza-upgrade/src/common/outputs/load-outputs.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,18 @@ export function parseValueFromOutput(output: StackOutput) {
5151
}
5252
}
5353

54-
export interface StackOutputValueFindProps{
54+
export interface StackOutputValueFindProps {
5555
outputs: StackOutput[];
5656
accountKey?: string;
5757
region?: string;
58-
predicate?: (value: {[key: string]: any}) => boolean;
58+
predicate?: (value: { [key: string]: any }) => boolean;
5959
}
6060

61-
export function findValuesFromOutputs(props: StackOutputValueFindProps): {[key: string]: any}[] {
61+
export function findValuesFromOutputs(props: StackOutputValueFindProps): { [key: string]: any }[] {
6262
const values = props.outputs
63-
.filter(output => props.accountKey === undefined || output.accountKey === props.accountKey)
64-
.filter(output => props.region === undefined || output.region === props.region)
65-
.map(output => parseValueFromOutput(output))
63+
.filter((output) => props.accountKey === undefined || output.accountKey === props.accountKey)
64+
.filter((output) => props.region === undefined || output.region === props.region)
65+
.map((output) => parseValueFromOutput(output))
6666
.filter((structured) => !!structured);
6767
if (props.predicate) {
6868
return values.filter(props.predicate);

reference-artifacts/Custom-Scripts/lza-upgrade/src/common/utils/types/convertConfigTypes.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,11 @@ export type ResolverEndpointRulesType = {
5454
};
5555

5656
export type ResolverEndpointsType =
57-
| {
58-
name: string;
59-
vpc: string;
60-
subnets: string[];
61-
type: string;
62-
rules?: ResolverEndpointRulesType[];
63-
}
64-
| undefined;
65-
66-
57+
| {
58+
name: string;
59+
vpc: string;
60+
subnets: string[];
61+
type: string;
62+
rules?: ResolverEndpointRulesType[];
63+
}
64+
| undefined;

reference-artifacts/Custom-Scripts/lza-upgrade/src/common/utils/types/resourceTypes.ts

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,70 +2,70 @@ import { CloudFormation } from 'aws-sdk';
22
import aws from '../../aws/aws-client';
33

44
export interface Environment {
5-
accountId: string;
6-
accountKey: string;
7-
region: string;
5+
accountId: string;
6+
accountKey: string;
7+
region: string;
88
}
99

1010
export interface StacksAndResourceMap {
11-
environment: Environment;
12-
stackName: string;
13-
resourceMap: LogicalAndPhysicalResourceIds[];
14-
region: string;
15-
template: string;
16-
phase: string | undefined;
17-
countVerified: boolean;
18-
numberOfResources: number;
19-
numberOfResourcesInTemplate: number;
20-
nestedStacks?: {
21-
[key: string]: NestedStack;
22-
};
23-
parentStack?: string;
11+
environment: Environment;
12+
stackName: string;
13+
resourceMap: LogicalAndPhysicalResourceIds[];
14+
region: string;
15+
template: string;
16+
phase: string | undefined;
17+
countVerified: boolean;
18+
numberOfResources: number;
19+
numberOfResourcesInTemplate: number;
20+
nestedStacks?: {
21+
[key: string]: NestedStack;
22+
};
23+
parentStack?: string;
2424
}
2525

2626
export interface CfnClients {
27-
cfn: CloudFormation;
28-
cfnNative: aws.CloudFormation;
27+
cfn: CloudFormation;
28+
cfnNative: aws.CloudFormation;
2929
}
3030

31-
export interface LogicalAndPhysicalResourceIds {
32-
logicalResourceId: string;
33-
physicalResourceId: string;
34-
resourceType: string;
35-
resourceMetadata?: string;
36-
}
31+
export interface LogicalAndPhysicalResourceIds {
32+
logicalResourceId: string;
33+
physicalResourceId: string;
34+
resourceType: string;
35+
resourceMetadata?: string;
36+
}
3737

38-
export interface ASEAResourceMapping {
39-
[key: string]: ASEAMapping;
38+
export interface ASEAResourceMapping {
39+
[key: string]: ASEAMapping;
4040
}
4141

42-
export interface NestedStack {
43-
logicalResourceId: string;
44-
stackName: string;
45-
accountId: string;
46-
accountKey: string;
47-
region: string;
48-
phase: string | undefined;
49-
countVerified: boolean;
50-
numberOfResources: number;
51-
numberOfResourcesInTemplate: number;
52-
resourceMap?: LogicalAndPhysicalResourceIds[];
53-
template?: string;
54-
templatePath: string;
55-
resourcePath: string;
42+
export interface NestedStack {
43+
logicalResourceId: string;
44+
stackName: string;
45+
accountId: string;
46+
accountKey: string;
47+
region: string;
48+
phase: string | undefined;
49+
countVerified: boolean;
50+
numberOfResources: number;
51+
numberOfResourcesInTemplate: number;
52+
resourceMap?: LogicalAndPhysicalResourceIds[];
53+
template?: string;
54+
templatePath: string;
55+
resourcePath: string;
5656
}
5757
export interface ASEAMapping {
58-
stackName: string;
59-
accountId: string;
60-
accountKey: string;
61-
region: string;
62-
phase: string | undefined;
63-
countVerified: boolean;
64-
numberOfResources: number;
65-
numberOfResourcesInTemplate: number;
66-
templatePath: string;
67-
resourcePath: string;
68-
nestedStacks?: {
69-
[key: string]: NestedStack;
70-
};
71-
}
58+
stackName: string;
59+
accountId: string;
60+
accountKey: string;
61+
region: string;
62+
phase: string | undefined;
63+
countVerified: boolean;
64+
numberOfResources: number;
65+
numberOfResourcesInTemplate: number;
66+
templatePath: string;
67+
resourcePath: string;
68+
nestedStacks?: {
69+
[key: string]: NestedStack;
70+
};
71+
}

reference-artifacts/Custom-Scripts/lza-upgrade/src/common/utils/writeToSources.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export class WriteToSources {
9696
putFiles: [
9797
{
9898
filePath,
99-
fileContent: fileContent as unknown as Uint8Array,
99+
fileContent: (fileContent as unknown) as Uint8Array,
100100
},
101101
],
102102
}),

0 commit comments

Comments
 (0)