Skip to content

Commit d258e98

Browse files
committed
fix(aws): applied scaffolder 2.0 zod migration
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
1 parent bf44bcd commit d258e98

14 files changed

Lines changed: 245 additions & 385 deletions

File tree

workspaces/aws/.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
plugins:
22
- checksum: 05b51f75814596aa3e15b296af3287240351c8b7f1df1e05c2ceedf7f3820627759605825fd932f1f7c3c3287b61b16f9e8195b0927a0f80345493f81376947a
33
path: .yarn/plugins/@yarnpkg/plugin-backstage.cjs
4-
spec: "https://versions.backstage.io/v1/releases/1.49.3/yarn-plugin"
4+
spec: 'https://versions.backstage.io/v1/releases/1.49.3/yarn-plugin'

workspaces/aws/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"build:backend": "yarn workspace backend build",
1313
"build:all": "backstage-cli repo build --all",
1414
"build:api-reports": "yarn build:api-reports:only --tsc",
15-
"build:api-reports:only": "backstage-repo-tools api-reports -o ae-wrong-input-file-type,ae-undocumented --allow-warnings plugins/aws-apps --validate-release-tags",
15+
"build:api-reports:only": "backstage-repo-tools api-reports -o ae-wrong-input-file-type,ae-undocumented,ae-forgotten-export --allow-warnings plugins/aws-apps --validate-release-tags",
1616
"build-image": "yarn workspace backend build-image",
1717
"tsc": "tsc",
1818
"tsc:full": "tsc --skipLibCheck false --incremental false",

workspaces/aws/plugins/aws-apps/report.api.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,18 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
99
import { ReactNode } from 'react';
1010
import { RouteRef } from '@backstage/core-plugin-api';
1111

12-
// Warning: (ae-forgotten-export) The symbol "AppCatalogPage_2" needs to be exported by the entry point index.d.ts
13-
//
1412
// @public (undocumented)
1513
export const AppCatalogPage: AppCatalogPage_2;
1614

17-
// Warning: (ae-forgotten-export) The symbol "AwsAppPage_2" needs to be exported by the entry point index.d.ts
18-
//
1915
// @public (undocumented)
2016
export const AwsAppPage: AwsAppPage_2;
2117

22-
// Warning: (ae-forgotten-export) The symbol "AwsComponentPage_2" needs to be exported by the entry point index.d.ts
23-
//
2418
// @public (undocumented)
2519
export const AwsComponentPage: AwsComponentPage_2;
2620

27-
// Warning: (ae-forgotten-export) The symbol "AwsEnvironmentPage_2" needs to be exported by the entry point index.d.ts
28-
//
2921
// @public (undocumented)
3022
export const AwsEnvironmentPage: AwsEnvironmentPage_2;
3123

32-
// Warning: (ae-forgotten-export) The symbol "AwsEnvironmentProviderPage_2" needs to be exported by the entry point index.d.ts
33-
//
3424
// @public (undocumented)
3525
export const AwsEnvironmentProviderPage: AwsEnvironmentProviderPage_2;
3626

workspaces/aws/plugins/aws-apps/src/components/AppCatalogPage/AppCatalogPage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export interface AppCatalogPageProps extends DefaultCatalogPageProps {
3333
kind: string;
3434
}
3535

36+
/** @public */
3637
export function AppCatalogPage(props: AppCatalogPageProps) {
3738
const { actions, tableOptions = {}, emptyContent, kind } = props;
3839

workspaces/aws/plugins/scaffolder-backend-module-aws-apps/report.api.md

Lines changed: 79 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,56 +6,65 @@
66
import { AwsAuthResponse } from '@alithya-oss/backstage-plugin-aws-apps-backend';
77
import { BackendFeature } from '@backstage/backend-plugin-api';
88
import { CatalogApi } from '@backstage/catalog-client';
9-
import { Config } from '@backstage/config';
10-
import { JsonObject } from '@backstage/types';
119
import { LoggerService } from '@backstage/backend-plugin-api';
10+
import { RootConfigService } from '@backstage/backend-plugin-api';
1211
import { ScmIntegrationRegistry } from '@backstage/integration';
1312
import { TemplateAction } from '@backstage/plugin-scaffolder-node';
1413

1514
// @public (undocumented)
1615
export function createRepoAccessTokenAction(options: {
1716
integrations: ScmIntegrationRegistry;
18-
envConfig: Config;
17+
envConfig: RootConfigService;
1918
}): TemplateAction<
2019
{
2120
repoUrl: string;
22-
secretArn: string;
2321
projectId: number;
24-
region?: string;
22+
secretArn: string;
23+
region?: string | undefined;
24+
},
25+
{
26+
[x: string]: any;
2527
},
26-
JsonObject,
27-
'v1'
28+
'v2'
2829
>;
2930

3031
// @public (undocumented)
3132
export function createS3BucketAction(): TemplateAction<
3233
{
3334
bucketName: string;
3435
envProviders: EnvironmentProvider[];
35-
tags?: {
36-
Key: string;
37-
Value: string | number | boolean;
38-
}[];
36+
tags?:
37+
| {
38+
Value: string | number | boolean;
39+
Key: string;
40+
}[]
41+
| undefined;
42+
},
43+
{
44+
awsBucketName: string;
3945
},
40-
JsonObject,
41-
'v1'
46+
'v2'
4247
>;
4348

4449
// @public (undocumented)
4550
export function createSecretAction(options: {
46-
envConfig: Config;
51+
envConfig: RootConfigService;
4752
}): TemplateAction<
4853
{
4954
secretName: string;
50-
description?: string;
51-
region?: string;
52-
tags?: {
53-
Key: string;
54-
Value: string | number | boolean;
55-
}[];
55+
description?: string | undefined;
56+
region?: string | undefined;
57+
tags?:
58+
| {
59+
Value: string | number | boolean;
60+
Key: string;
61+
}[]
62+
| undefined;
63+
},
64+
{
65+
secretARN?: string | undefined;
5666
},
57-
JsonObject,
58-
'v1'
67+
'v2'
5968
>;
6069

6170
// @public (undocumented)
@@ -87,51 +96,85 @@ export function getComponentInfoAction(): TemplateAction<
8796
{
8897
componentName: string;
8998
},
90-
JsonObject,
91-
'v1'
99+
{
100+
kebabCaseComponentName: string;
101+
},
102+
'v2'
92103
>;
93104

94105
// @public (undocumented)
95106
export function getEnvProvidersAction(options: {
96-
config: Config;
107+
config: RootConfigService;
97108
logger: LoggerService;
98109
catalogClient: CatalogApi;
99110
}): TemplateAction<
100111
{
101112
environmentRef: string;
102113
},
103-
JsonObject,
104-
'v1'
114+
{
115+
envName: string;
116+
envShortName: string;
117+
envRef: string;
118+
envDeployManualApproval: string | boolean;
119+
envProviders: {
120+
region: string;
121+
envProviderName: string;
122+
envProviderType: string;
123+
assumedRoleArn: string;
124+
account?: string | undefined;
125+
accountId?: string | undefined;
126+
clusterArn?: string | undefined;
127+
kubectlLambdaArn?: string | undefined;
128+
envProviderPrefix?: string | undefined;
129+
vpcId?: string | undefined;
130+
publicSubnets?: string | undefined;
131+
privateSubnets?: string | undefined;
132+
kubectlLambdaRoleArn?: string | undefined;
133+
}[];
134+
},
135+
'v2'
105136
>;
106137

107138
// @public (undocumented)
108139
export function getPlatformMetadataAction(options: {
109-
envConfig: Config;
110-
}): TemplateAction<JsonObject, JsonObject, 'v1'>;
140+
envConfig: RootConfigService;
141+
}): TemplateAction<
142+
{
143+
[x: string]: any;
144+
},
145+
{
146+
platformRegion: string;
147+
},
148+
'v2'
149+
>;
111150

112151
// @public (undocumented)
113152
export function getPlatformParametersAction(options: {
114-
envConfig: Config;
153+
envConfig: RootConfigService;
115154
}): TemplateAction<
116155
{
117156
paramKeys: string[];
118-
region?: string;
157+
region?: string | undefined;
158+
},
159+
{
160+
params: Record<string, string>;
119161
},
120-
JsonObject,
121-
'v1'
162+
'v2'
122163
>;
123164

124165
// @public (undocumented)
125166
export function getSsmParametersAction(
126-
config: Config,
167+
config: RootConfigService,
127168
logger: LoggerService,
128169
): TemplateAction<
129170
{
130171
paramKeys: string[];
131172
envProviders: EnvironmentProvider[];
132173
},
133-
JsonObject,
134-
'v1'
174+
{
175+
params: Record<string, Record<string, string>>;
176+
},
177+
'v2'
135178
>;
136179

137180
// @public (undocumented)

workspaces/aws/plugins/scaffolder-backend-module-aws-apps/src/actions/create-repo-access-token/create-repoAccesstoken.ts

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,29 @@ import { parseRepoUrl } from '../../helpers/util';
77
import { InputError } from '@backstage/errors';
88
import { validate as validateArn } from '@aws-sdk/util-arn-parser';
99
import { putSecret } from '../../helpers/action-context';
10-
import { Config } from '@backstage/config';
10+
import { RootConfigService } from '@backstage/backend-plugin-api';
1111

1212
/** @public */
1313
export function createRepoAccessTokenAction(options: {
1414
integrations: ScmIntegrationRegistry;
15-
envConfig: Config;
15+
envConfig: RootConfigService;
1616
}) {
1717
const { integrations, envConfig } = options;
18-
return createTemplateAction<{
19-
repoUrl: string;
20-
secretArn: string;
21-
projectId: number;
22-
region?: string;
23-
}>({
18+
return createTemplateAction({
2419
id: 'opa:createRepoAccessToken:gitlab',
2520
description:
2621
'Initializes a git repository of the content in the workspace, and publishes it to GitLab.',
2722
schema: {
2823
input: {
29-
type: 'object',
30-
required: ['repoUrl', 'secretArn', 'projectId'],
31-
properties: {
32-
repoUrl: {
33-
title: 'Repository Location',
34-
type: 'string',
35-
},
36-
projectId: {
37-
title: 'Project Id',
38-
type: 'number',
39-
},
40-
secretArn: {
41-
title:
24+
repoUrl: z => z.string().describe('Repository Location'),
25+
projectId: z => z.number().describe('Project Id'),
26+
secretArn: z =>
27+
z
28+
.string()
29+
.describe(
4230
'Arn of the SecretsManager secret where the access token will be stored',
43-
type: 'string',
44-
},
45-
region: {
46-
title: 'AWS Region',
47-
type: 'string',
48-
},
49-
},
31+
),
32+
region: z => z.string().optional().describe('AWS Region'),
5033
},
5134
},
5235
async handler(ctx) {

workspaces/aws/plugins/scaffolder-backend-module-aws-apps/src/actions/create-s3-bucket/create-s3-bucket.ts

Lines changed: 20 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,56 +7,34 @@ import { EnvironmentProvider } from '../../types';
77

88
/** @public */
99
export function createS3BucketAction() {
10-
return createTemplateAction<{
11-
bucketName: string;
12-
envProviders: EnvironmentProvider[];
13-
tags?: { Key: string; Value: string | number | boolean }[];
14-
}>({
10+
return createTemplateAction({
1511
id: 'opa:create-s3-bucket',
1612
description: 'Creates an S3 bucket',
1713
schema: {
1814
input: {
19-
type: 'object',
20-
required: ['bucketName', 'envProviders'],
21-
properties: {
22-
bucketName: {
23-
title: 'Bucket Name',
24-
description: 'The name of the S3 bucket to create',
25-
type: 'string',
26-
},
27-
envProviders: {
28-
title: 'AWS Environment Providers',
29-
description:
15+
bucketName: z =>
16+
z.string().describe('The name of the S3 bucket to create'),
17+
envProviders: z =>
18+
z
19+
.array(z.custom<EnvironmentProvider>())
20+
.describe(
3021
'The AWS environment providers containing account and region info',
31-
type: 'array',
32-
},
33-
tags: {
34-
title: 'AWS Tags',
35-
description:
22+
),
23+
tags: z =>
24+
z
25+
.array(
26+
z.object({
27+
Key: z.string(),
28+
Value: z.union([z.string(), z.number(), z.boolean()]),
29+
}),
30+
)
31+
.optional()
32+
.describe(
3633
'key/value pairs to apply as tags to any created AWS resources',
37-
type: 'array',
38-
minProperties: 1,
39-
items: [
40-
{
41-
type: 'object',
42-
properties: {
43-
Key: { type: 'string' },
44-
Value: { type: ['string', 'number', 'boolean'] },
45-
},
46-
},
47-
],
48-
},
49-
},
34+
),
5035
},
5136
output: {
52-
type: 'object',
53-
required: ['awsBucketName'],
54-
properties: {
55-
awsBucketName: {
56-
title: 'S3 Bucket Name',
57-
type: 'string',
58-
},
59-
},
37+
awsBucketName: z => z.string().describe('S3 Bucket Name'),
6038
},
6139
},
6240
async handler() {

0 commit comments

Comments
 (0)