@spinnaker/amazon 0.13.8 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/aws.validators.d.ts +1 -0
  3. package/dist/index.js +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/pipeline/stages/deleteLambda/DeleteLambdaFunctionStageForm.d.ts +3 -0
  6. package/dist/pipeline/stages/deleteLambda/LambdaDeleteStage.d.ts +8 -0
  7. package/dist/pipeline/stages/deleteLambda/constants/deleteVersion.constants.d.ts +6 -0
  8. package/dist/pipeline/stages/deleteLambda/constants/deleteVersion.picker.d.ts +16 -0
  9. package/dist/pipeline/stages/deleteLambda/constants/index.d.ts +2 -0
  10. package/dist/pipeline/stages/deleteLambda/index.d.ts +1 -0
  11. package/dist/pipeline/stages/deployLambda/components/AwsLambdaFunctionStageForm.d.ts +3 -0
  12. package/dist/pipeline/stages/deployLambda/components/BasicSettingsForm.d.ts +3 -0
  13. package/dist/pipeline/stages/deployLambda/components/EnvironmentForm.d.ts +2 -0
  14. package/dist/pipeline/stages/deployLambda/components/ExecutionRoleForm.d.ts +2 -0
  15. package/dist/pipeline/stages/deployLambda/components/LambdaAtEdgeForm.d.ts +3 -0
  16. package/dist/pipeline/stages/deployLambda/components/NetworkForm.d.ts +3 -0
  17. package/dist/pipeline/stages/deployLambda/components/TriggerEventsForm.d.ts +3 -0
  18. package/dist/pipeline/stages/deployLambda/components/function.constants.d.ts +5 -0
  19. package/dist/pipeline/stages/deployLambda/components/index.d.ts +5 -0
  20. package/dist/pipeline/stages/deployLambda/config/LambdaDeploymentStage.d.ts +3 -0
  21. package/dist/pipeline/stages/deployLambda/config/LambdaDeploymentStageConfig.d.ts +4 -0
  22. package/dist/pipeline/stages/deployLambda/config/LambdaDeploymentStageExecutionDetails.d.ts +6 -0
  23. package/dist/pipeline/stages/deployLambda/config/UpsertDefaults.d.ts +1 -0
  24. package/dist/pipeline/stages/deployLambda/config/function.defaults.d.ts +2 -0
  25. package/dist/pipeline/stages/deployLambda/index.d.ts +1 -0
  26. package/dist/pipeline/stages/invokeLambda/InvokeLambdaFunctionStageForm.d.ts +3 -0
  27. package/dist/pipeline/stages/invokeLambda/LambdaInvokeStage.d.ts +8 -0
  28. package/dist/pipeline/stages/invokeLambda/components/InvokeLambdaOperation.d.ts +3 -0
  29. package/dist/pipeline/stages/invokeLambda/components/index.d.ts +1 -0
  30. package/dist/pipeline/stages/invokeLambda/index.d.ts +1 -0
  31. package/dist/pipeline/stages/routeLambda/LambdaRouteStage.d.ts +8 -0
  32. package/dist/pipeline/stages/routeLambda/RouteLambdaFunctionStageForm.d.ts +3 -0
  33. package/dist/pipeline/stages/routeLambda/TriggerEventsForm.d.ts +3 -0
  34. package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/BlueGreenDeploymentForm.d.ts +3 -0
  35. package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/HealthCheckStrategy.d.ts +3 -0
  36. package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/InvocationHealthCheck.d.ts +3 -0
  37. package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/health.constants.d.ts +5 -0
  38. package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/index.d.ts +1 -0
  39. package/dist/pipeline/stages/routeLambda/components/DeploymentStrategyForm.d.ts +3 -0
  40. package/dist/pipeline/stages/routeLambda/components/RenderStrategy.d.ts +3 -0
  41. package/dist/pipeline/stages/routeLambda/components/SimpleDeploymentForm.d.ts +3 -0
  42. package/dist/pipeline/stages/routeLambda/components/VersionPicker.d.ts +14 -0
  43. package/dist/pipeline/stages/routeLambda/components/WeightedDeploymentForm.d.ts +3 -0
  44. package/dist/pipeline/stages/routeLambda/components/index.d.ts +1 -0
  45. package/dist/pipeline/stages/routeLambda/constants/index.d.ts +3 -0
  46. package/dist/pipeline/stages/routeLambda/constants/strategy.constants.d.ts +6 -0
  47. package/dist/pipeline/stages/routeLambda/constants/strategy.picker.d.ts +16 -0
  48. package/dist/pipeline/stages/routeLambda/constants/versions.constants.d.ts +6 -0
  49. package/dist/pipeline/stages/routeLambda/index.d.ts +1 -0
  50. package/dist/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStage.d.ts +3 -0
  51. package/dist/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStageConfig.d.ts +5 -0
  52. package/dist/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStageExecutionDetails.d.ts +6 -0
  53. package/dist/pipeline/stages/updateCodeLambda/components/UpdateCodeStageForm.d.ts +3 -0
  54. package/dist/pipeline/stages/updateCodeLambda/components/index.d.ts +1 -0
  55. package/dist/pipeline/stages/updateCodeLambda/index.d.ts +1 -0
  56. package/package.json +3 -3
  57. package/src/aws.module.ts +6 -6
  58. package/src/aws.validators.ts +7 -3
  59. package/src/pipeline/stages/deleteLambda/DeleteLambdaFunctionStageForm.tsx +143 -0
  60. package/src/pipeline/stages/deleteLambda/LambdaDeleteStage.tsx +86 -0
  61. package/src/pipeline/stages/deleteLambda/constants/deleteVersion.constants.ts +37 -0
  62. package/src/pipeline/stages/deleteLambda/constants/deleteVersion.picker.tsx +47 -0
  63. package/src/pipeline/stages/deleteLambda/constants/index.ts +5 -0
  64. package/src/pipeline/stages/deleteLambda/index.ts +11 -0
  65. package/src/pipeline/stages/deployLambda/components/AwsLambdaFunctionStageForm.tsx +139 -0
  66. package/src/pipeline/stages/deployLambda/components/BasicSettingsForm.tsx +176 -0
  67. package/src/pipeline/stages/deployLambda/components/EnvironmentForm.tsx +24 -0
  68. package/src/pipeline/stages/deployLambda/components/ExecutionRoleForm.tsx +15 -0
  69. package/src/pipeline/stages/deployLambda/components/LambdaAtEdgeForm.tsx +28 -0
  70. package/src/pipeline/stages/deployLambda/components/NetworkForm.tsx +123 -0
  71. package/src/pipeline/stages/deployLambda/components/TriggerEventsForm.tsx +49 -0
  72. package/src/pipeline/stages/deployLambda/components/function.constants.ts +32 -0
  73. package/src/pipeline/stages/deployLambda/components/index.ts +8 -0
  74. package/src/pipeline/stages/deployLambda/config/LambdaDeploymentStage.tsx +20 -0
  75. package/src/pipeline/stages/deployLambda/config/LambdaDeploymentStageConfig.tsx +64 -0
  76. package/src/pipeline/stages/deployLambda/config/LambdaDeploymentStageExecutionDetails.tsx +31 -0
  77. package/src/pipeline/stages/deployLambda/config/UpsertDefaults.tsx +21 -0
  78. package/src/pipeline/stages/deployLambda/config/function.defaults.ts +39 -0
  79. package/src/pipeline/stages/deployLambda/index.ts +11 -0
  80. package/src/pipeline/stages/invokeLambda/InvokeLambdaFunctionStageForm.tsx +106 -0
  81. package/src/pipeline/stages/invokeLambda/LambdaInvokeStage.tsx +125 -0
  82. package/src/pipeline/stages/invokeLambda/components/InvokeLambdaOperation.tsx +77 -0
  83. package/src/pipeline/stages/invokeLambda/components/index.ts +4 -0
  84. package/src/pipeline/stages/invokeLambda/index.ts +11 -0
  85. package/src/pipeline/stages/routeLambda/LambdaRouteStage.tsx +98 -0
  86. package/src/pipeline/stages/routeLambda/RouteLambdaFunctionStageForm.tsx +151 -0
  87. package/src/pipeline/stages/routeLambda/TriggerEventsForm.tsx +51 -0
  88. package/src/pipeline/stages/routeLambda/components/BlueGreenDeployment/BlueGreenDeploymentForm.tsx +27 -0
  89. package/src/pipeline/stages/routeLambda/components/BlueGreenDeployment/HealthCheckStrategy.tsx +21 -0
  90. package/src/pipeline/stages/routeLambda/components/BlueGreenDeployment/InvocationHealthCheck.tsx +93 -0
  91. package/src/pipeline/stages/routeLambda/components/BlueGreenDeployment/health.constants.ts +14 -0
  92. package/src/pipeline/stages/routeLambda/components/BlueGreenDeployment/index.ts +4 -0
  93. package/src/pipeline/stages/routeLambda/components/DeploymentStrategyForm.tsx +18 -0
  94. package/src/pipeline/stages/routeLambda/components/RenderStrategy.tsx +23 -0
  95. package/src/pipeline/stages/routeLambda/components/SimpleDeploymentForm.tsx +67 -0
  96. package/src/pipeline/stages/routeLambda/components/VersionPicker.tsx +43 -0
  97. package/src/pipeline/stages/routeLambda/components/WeightedDeploymentForm.tsx +107 -0
  98. package/src/pipeline/stages/routeLambda/components/index.ts +4 -0
  99. package/src/pipeline/stages/routeLambda/constants/index.ts +6 -0
  100. package/src/pipeline/stages/routeLambda/constants/strategy.constants.tsx +26 -0
  101. package/src/pipeline/stages/routeLambda/constants/strategy.picker.tsx +47 -0
  102. package/src/pipeline/stages/routeLambda/constants/versions.constants.ts +31 -0
  103. package/src/pipeline/stages/routeLambda/index.ts +11 -0
  104. package/src/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStage.tsx +20 -0
  105. package/src/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStageConfig.tsx +41 -0
  106. package/src/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStageExecutionDetails.tsx +31 -0
  107. package/src/pipeline/stages/updateCodeLambda/components/UpdateCodeStageForm.tsx +122 -0
  108. package/src/pipeline/stages/updateCodeLambda/components/index.ts +4 -0
  109. package/src/pipeline/stages/updateCodeLambda/index.ts +11 -0
@@ -0,0 +1,47 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import React from 'react';
5
+
6
+ import type { IFormikStageConfigInjectedProps } from '@spinnaker/core';
7
+
8
+ import type { IStrategyConstant } from './strategy.constants';
9
+ import { DeploymentStrategyList } from './strategy.constants';
10
+
11
+ export interface IVersionPickerProps {
12
+ config: IFormikStageConfigInjectedProps;
13
+ value: string;
14
+ showingDetails: boolean;
15
+ }
16
+
17
+ export interface IVersionPickerState {
18
+ value: string;
19
+ label: string;
20
+ description: string;
21
+ }
22
+
23
+ export class DeploymentStrategyPicker extends React.Component<IVersionPickerProps, IVersionPickerState> {
24
+ constructor(props: IVersionPickerProps) {
25
+ super(props);
26
+
27
+ const { value } = this.props;
28
+
29
+ const strategyDetails = DeploymentStrategyList.filter((v: IStrategyConstant) => v.value === value)[0];
30
+
31
+ this.state = {
32
+ label: strategyDetails.label,
33
+ value: strategyDetails.value,
34
+ description: strategyDetails.description,
35
+ };
36
+ }
37
+
38
+ public render() {
39
+ return (
40
+ <div>
41
+ <b> {this.state.label} </b>
42
+ <br />
43
+ <small> {this.state.description} </small>
44
+ </div>
45
+ );
46
+ }
47
+ }
@@ -0,0 +1,31 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export interface IVersionConstant {
5
+ description: string;
6
+ label: string;
7
+ value: string;
8
+ }
9
+
10
+ export const VersionList: IVersionConstant[] = [
11
+ {
12
+ label: 'Newest Function Version',
13
+ value: '$LATEST',
14
+ description: 'Selects the most recently deployed function when this stage starts.',
15
+ },
16
+ {
17
+ label: 'Previous Function Version',
18
+ value: '$PREVIOUS',
19
+ description: 'Selects the second-most recently deployed function when this stage starts.',
20
+ },
21
+ {
22
+ label: 'Oldest Function Verion',
23
+ value: '$OLDEST',
24
+ description: 'Selects the least recently deployed function when this stage starts.',
25
+ },
26
+ {
27
+ label: 'Provide Version Number',
28
+ value: '$PROVIDED',
29
+ description: 'Provide a specific version number to destroy.',
30
+ },
31
+ ];
@@ -0,0 +1,11 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { Registry, SETTINGS } from '@spinnaker/core';
5
+ import { lambdaRouteStage } from './LambdaRouteStage';
6
+
7
+ export * from './LambdaRouteStage';
8
+
9
+ if (SETTINGS.feature.lambdaAdditionalStages) {
10
+ Registry.pipeline.registerStage(lambdaRouteStage);
11
+ }
@@ -0,0 +1,20 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import type { IStageTypeConfig } from '@spinnaker/core';
4
+ import { ExecutionDetailsTasks, HelpContentsRegistry } from '@spinnaker/core';
5
+
6
+ import { LambdaUpdateCodeConfig, validate } from './LambdaUpdateCodeStageConfig';
7
+ import { LambdaUpdateCodeExecutionDetails } from './LambdaUpdateCodeStageExecutionDetails';
8
+
9
+ export const initialize = () => {
10
+ HelpContentsRegistry.register('aws.lambdaDeploymentStage.lambda', 'Lambda Name');
11
+ };
12
+
13
+ export const lambdaUpdateCodeStage: IStageTypeConfig = {
14
+ key: 'Aws.LambdaUpdateCodeStage',
15
+ label: `AWS Lambda Update Code`,
16
+ description: 'Update code for a single AWS Lambda Function',
17
+ component: LambdaUpdateCodeConfig, // stage config
18
+ executionDetailsSections: [LambdaUpdateCodeExecutionDetails, ExecutionDetailsTasks],
19
+ validateFn: validate,
20
+ };
@@ -0,0 +1,41 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import React from 'react';
5
+
6
+ import type { IFormikStageConfigInjectedProps, IStage, IStageConfigProps } from '@spinnaker/core';
7
+ import { FormikStageConfig, FormValidator } from '@spinnaker/core';
8
+ import { s3BucketNameValidator } from '../../../aws.validators';
9
+
10
+ import { UpdateCodeLambdaFunctionStageForm } from './components';
11
+
12
+ import './LambdaUpdateCodeStage.less';
13
+
14
+ export function LambdaUpdateCodeConfig(props: IStageConfigProps) {
15
+ return (
16
+ <div className="LambdaUpdateCodeConfig">
17
+ <FormikStageConfig
18
+ {...props}
19
+ validate={validate}
20
+ onChange={props.updateStage}
21
+ render={(props: IFormikStageConfigInjectedProps) => <UpdateCodeLambdaFunctionStageForm {...props} />}
22
+ />
23
+ </div>
24
+ );
25
+ }
26
+
27
+ export function validate(stageConfig: IStage) {
28
+ const validator = new FormValidator(stageConfig);
29
+
30
+ validator.field('account', 'Account Name').required();
31
+
32
+ validator.field('region', 'Region').required();
33
+
34
+ validator.field('functionName', 'Lambda Function Name').required();
35
+
36
+ validator.field('s3key', 'S3 Object Key').required();
37
+
38
+ validator.field('s3bucket', 'S3 Bucket Name').required().withValidators(s3BucketNameValidator);
39
+
40
+ return validator.validateForm();
41
+ }
@@ -0,0 +1,31 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import React from 'react';
5
+
6
+ import type { IExecutionDetailsSectionProps } from '@spinnaker/core';
7
+ import { ExecutionDetailsSection, StageFailureMessage } from '@spinnaker/core';
8
+
9
+ export function LambdaUpdateCodeExecutionDetails(props: IExecutionDetailsSectionProps) {
10
+ const { stage, current, name } = props;
11
+ return (
12
+ <ExecutionDetailsSection name={name} current={current}>
13
+ <StageFailureMessage stage={stage} message={stage.outputs.failureMessage} />
14
+ <div>
15
+ <p>
16
+ {' '}
17
+ <b> Function Name: </b> {stage.outputs.functionName ? stage.outputs.functionName : 'N/A'}{' '}
18
+ </p>
19
+ <p>
20
+ {' '}
21
+ <b> Function ARN: </b> {stage.outputs.functionARN ? stage.outputs.functionARN : 'N/A'}{' '}
22
+ </p>
23
+ </div>
24
+ </ExecutionDetailsSection>
25
+ );
26
+ }
27
+
28
+ // eslint-disable-next-line
29
+ export namespace LambdaUpdateCodeExecutionDetails {
30
+ export const title = 'Lambda Update Code Stage';
31
+ }
@@ -0,0 +1,122 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import React from 'react';
5
+
6
+ import type {
7
+ IAccount,
8
+ IAccountDetails,
9
+ IFormikStageConfigInjectedProps,
10
+ IFormInputProps,
11
+ IFunction,
12
+ IRegion,
13
+ } from '@spinnaker/core';
14
+ import {
15
+ AccountService,
16
+ CheckboxInput,
17
+ FormikFormField,
18
+ HelpField,
19
+ ReactSelectInput,
20
+ TextInput,
21
+ useData,
22
+ } from '@spinnaker/core';
23
+
24
+ export function UpdateCodeLambdaFunctionStageForm(props: IFormikStageConfigInjectedProps) {
25
+ const { values } = props.formik;
26
+ const { functions } = props.application;
27
+
28
+ const { result: fetchAccountsResult, status: fetchAccountsStatus } = useData(
29
+ () => AccountService.listAccounts('aws'),
30
+ [],
31
+ [],
32
+ );
33
+
34
+ const onAccountChange = (fieldValue: any): void => {
35
+ props.formik.setFieldValue('region', null);
36
+ props.formik.setFieldValue('functionName', null);
37
+
38
+ props.formik.setFieldValue('account', fieldValue);
39
+ };
40
+
41
+ const onRegionChange = (fieldValue: any): void => {
42
+ props.formik.setFieldValue('functionName', null);
43
+ props.formik.setFieldValue('region', fieldValue);
44
+ };
45
+
46
+ const availableFunctions =
47
+ values.account && values.region
48
+ ? functions.data
49
+ .filter((f: IFunction) => f.account === values.account)
50
+ .filter((f: IFunction) => f.region === values.region)
51
+ .map((f: IFunction) => f.functionName)
52
+ : [];
53
+
54
+ return (
55
+ <div className="form-horizontal">
56
+ <h4> Basic Settings </h4>
57
+ <FormikFormField
58
+ label="Account"
59
+ name="account"
60
+ onChange={onAccountChange}
61
+ required={true}
62
+ input={(inputProps: IFormInputProps) => (
63
+ <ReactSelectInput
64
+ {...inputProps}
65
+ clearable={false}
66
+ isLoading={fetchAccountsStatus === 'PENDING'}
67
+ stringOptions={fetchAccountsResult.map((acc: IAccount) => acc.name)}
68
+ />
69
+ )}
70
+ />
71
+ <FormikFormField
72
+ label="Region"
73
+ name="region"
74
+ onChange={onRegionChange}
75
+ input={(inputProps: IFormInputProps) => (
76
+ <ReactSelectInput
77
+ clearable={false}
78
+ disabled={!values.account}
79
+ placeholder={values.account ? 'Select...' : 'Select an Account...'}
80
+ {...inputProps}
81
+ isLoading={fetchAccountsStatus === 'PENDING'}
82
+ stringOptions={fetchAccountsResult
83
+ .filter((acc: IAccountDetails) => acc.name === values.account)
84
+ .flatMap((acc: IAccountDetails) => acc.regions)
85
+ .map((reg: IRegion) => reg.name)}
86
+ />
87
+ )}
88
+ />
89
+ <FormikFormField
90
+ label="Function Name"
91
+ name="functionName"
92
+ input={(inputProps: IFormInputProps) => (
93
+ <ReactSelectInput
94
+ clearable={false}
95
+ disabled={!(values.account && values.region)}
96
+ placeholder={values.account && values.region ? 'Select...' : 'Select an Account and Region...'}
97
+ {...inputProps}
98
+ stringOptions={availableFunctions}
99
+ />
100
+ )}
101
+ />
102
+ <FormikFormField
103
+ name="s3bucket"
104
+ label="S3 Bucket"
105
+ help={<HelpField id="aws.function.s3bucket" />}
106
+ input={(props) => <TextInput {...props} placeholder="S3 bucket name" />}
107
+ />
108
+ <FormikFormField
109
+ name="s3key"
110
+ label="S3 Key"
111
+ help={<HelpField id="aws.function.s3key" />}
112
+ input={(props) => <TextInput {...props} placeholder="object.zip" />}
113
+ />
114
+ <FormikFormField
115
+ name="publish"
116
+ label="Publish"
117
+ help={<HelpField id="aws.function.publish" />}
118
+ input={(props) => <CheckboxInput {...props} />}
119
+ />
120
+ </div>
121
+ );
122
+ }
@@ -0,0 +1,4 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export * from './UpdateCodeStageForm';
@@ -0,0 +1,11 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { Registry, SETTINGS } from '@spinnaker/core';
5
+ import { lambdaUpdateCodeStage } from './LambdaUpdateCodeStage';
6
+
7
+ export * from './LambdaUpdateCodeStage';
8
+
9
+ if (SETTINGS.feature.lambdaAdditionalStages) {
10
+ Registry.pipeline.registerStage(lambdaUpdateCodeStage);
11
+ }