@spinnaker/amazon 0.13.9 → 0.14.1

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 (110) hide show
  1. package/CHANGELOG.md +22 -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
  110. package/src/serverGroup/details/scalingPolicy/upsert/step/StepPolicyAction.tsx +2 -2
@@ -0,0 +1,37 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export interface IDeleteVersionConstant {
5
+ description: string;
6
+ label: string;
7
+ value: string;
8
+ }
9
+
10
+ export const DeleteVersionList: IDeleteVersionConstant[] = [
11
+ {
12
+ label: 'Newest Function Version',
13
+ value: '$LATEST',
14
+ description: 'Delete the most recently deployed function version when this stage starts.',
15
+ },
16
+ {
17
+ label: 'Previous Function Version',
18
+ value: '$PREVIOUS',
19
+ description: 'Delete the second-most recently deployed function version when this stage starts.',
20
+ },
21
+ {
22
+ label: 'Older Than N',
23
+ value: '$MOVING',
24
+ description: 'Delete all version but the N most recent versions.',
25
+ },
26
+ {
27
+ label: 'Provide Version Number',
28
+ value: '$PROVIDED',
29
+ description: 'Provide a specific version number to delete.',
30
+ },
31
+ {
32
+ label: 'All Function Versions',
33
+ value: '$ALL',
34
+ description:
35
+ 'Delete all function versions and function infrastructure. This will completely delete the Lambda function.',
36
+ },
37
+ ];
@@ -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 { IDeleteVersionConstant } from './deleteVersion.constants';
9
+ import { DeleteVersionList } from './deleteVersion.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 DeleteVersionPicker extends React.Component<IVersionPickerProps, IVersionPickerState> {
24
+ constructor(props: IVersionPickerProps) {
25
+ super(props);
26
+
27
+ const { value } = this.props;
28
+
29
+ const versionDetails = DeleteVersionList.filter((v: IDeleteVersionConstant) => v.value === value)[0];
30
+
31
+ this.state = {
32
+ label: versionDetails.label,
33
+ value: versionDetails.value,
34
+ description: versionDetails.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,5 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export * from './deleteVersion.constants';
5
+ export * from './deleteVersion.picker';
@@ -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 { lambdaDeleteStage } from './LambdaDeleteStage';
6
+
7
+ export * from './LambdaDeleteStage';
8
+
9
+ if (SETTINGS.feature.lambdaAdditionalStages) {
10
+ Registry.pipeline.registerStage(lambdaDeleteStage);
11
+ }
@@ -0,0 +1,139 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import classNames from 'classnames';
5
+ import React from 'react';
6
+ import type { Option } from 'react-select';
7
+
8
+ import type { IFormikStageConfigInjectedProps, IFormInputProps } from '@spinnaker/core';
9
+ import {
10
+ FormikFormField,
11
+ HelpField,
12
+ MapEditorInput,
13
+ NumberInput,
14
+ ReactSelectInput,
15
+ TetheredCreatable,
16
+ TextInput,
17
+ } from '@spinnaker/core';
18
+ import { NumberConcurrencyInput } from '@spinnaker/core/dist/presentation/forms/inputs/NumberConcurrencyInput';
19
+
20
+ import { BasicSettingsForm, ExecutionRoleForm, LambdaAtEdgeForm, NetworkForm, TriggerEventsForm } from './index';
21
+
22
+ export function AwsLambdaFunctionStageForm(props: IFormikStageConfigInjectedProps) {
23
+ const { values, errors } = props.formik;
24
+
25
+ const className = classNames({
26
+ well: true,
27
+ 'alert-danger': !!errors.functionName,
28
+ 'alert-info': !errors.functionName,
29
+ });
30
+
31
+ const onLayerChange = (o: Option, field: any) => {
32
+ props.formik.setFieldValue(
33
+ field,
34
+ o.map((layer: any) => layer.value),
35
+ );
36
+ };
37
+
38
+ return (
39
+ <div className="form-horizontal">
40
+ <div className={className}>
41
+ <strong>Your function will be named: </strong>
42
+ <HelpField id="aws.function.name" />
43
+ <span>{values.functionName ? values.functionName : props.application.name}</span>
44
+ <FormikFormField name="functionName" input={() => null} />
45
+ </div>
46
+ <h4>Basic Settings</h4>
47
+ <BasicSettingsForm {...props} />
48
+ <h4> Execution Role </h4>
49
+ <ExecutionRoleForm />
50
+ <h4> Environment </h4>
51
+ {values.enableLambdaAtEdge !== true ? (
52
+ <>
53
+ <FormikFormField
54
+ name="envVariables"
55
+ label="Env Variables"
56
+ input={(props) => <MapEditorInput {...props} allowEmptyValues={true} addButtonLabel="Add" />}
57
+ />
58
+ <FormikFormField
59
+ name="encryptionKMSKeyArn"
60
+ label="Key ARN"
61
+ help={<HelpField id="aws.function.kmsKeyArn" />}
62
+ input={(props) => <TextInput {...props} />}
63
+ />
64
+ </>
65
+ ) : (
66
+ <div className="horizontal center">Environment variables not available with Lambda@Edge functions.</div>
67
+ )}
68
+ <h4> Tags </h4>
69
+ <FormikFormField
70
+ name="tags"
71
+ input={(props) => <MapEditorInput {...props} allowEmptyValues={false} addButtonLabel="Add" />}
72
+ />
73
+ <h4> Settings </h4>
74
+ <FormikFormField name="description" label="Description" input={(props) => <TextInput {...props} />} />
75
+ <FormikFormField
76
+ name="layers"
77
+ label="Layer ARNs"
78
+ help={
79
+ <HelpField content="The resource ARNs for Lambda layer. Input the entire ARN and select `Create option TRIGGER-ARN-INPUT` to add the ARN." />
80
+ }
81
+ input={(inputProps: IFormInputProps) => (
82
+ <TetheredCreatable
83
+ {...inputProps}
84
+ multi={true}
85
+ placeholder={'Layer ARN...'}
86
+ onChange={(e: Option) => {
87
+ onLayerChange(e, 'layers');
88
+ }}
89
+ value={values.layers ? values.layers.map((layer: string) => ({ value: layer, label: layer })) : []}
90
+ />
91
+ )}
92
+ />
93
+ <FormikFormField
94
+ name="reservedConcurrentExecutions"
95
+ label="Reserved Concurrency"
96
+ help={
97
+ <HelpField content="The total number of current executions of your Lambda function that can be instantiated at any time." />
98
+ }
99
+ input={(props) => <NumberConcurrencyInput {...props} min={0} max={3000} />}
100
+ />
101
+ <FormikFormField
102
+ name="memorySize"
103
+ label="Memory (MB)"
104
+ help={<HelpField id="aws.functionBasicSettings.memorySize" />}
105
+ input={(props) => <NumberInput {...props} min={128} max={values.enableLambdaAtEdge === true ? 128 : 3008} />}
106
+ />
107
+ <FormikFormField
108
+ name="timeout"
109
+ label="Timeout (seconds)"
110
+ help={<HelpField id="aws.functionBasicSettings.timeout" />}
111
+ input={(props) => <NumberInput {...props} min={1} max={values.enableLambdaAtEdge === true ? 5 : 900} />}
112
+ />
113
+ <LambdaAtEdgeForm {...props} />
114
+ <h4> Network </h4>
115
+ {values.enableLambdaAtEdge !== true ? (
116
+ <NetworkForm {...props} />
117
+ ) : (
118
+ <div className="horizontal center">VPC configuration not available with Lambda@Edge functions.</div>
119
+ )}
120
+ <h4> Event Triggers </h4>
121
+ <TriggerEventsForm {...props} />
122
+ <h4> Debugging and Error Handling </h4>
123
+ Dead Letter Config
124
+ <FormikFormField
125
+ name="deadLetterConfig.targetArn"
126
+ label="Target ARN"
127
+ help={<HelpField id="aws.function.deadletterqueue" />}
128
+ input={(props) => <TextInput {...props} />}
129
+ />
130
+ X-Ray Tracing
131
+ <FormikFormField
132
+ name="tracingConfig.mode"
133
+ label="Mode"
134
+ help={<HelpField id="aws.function.tracingConfig.mode" />}
135
+ input={(props) => <ReactSelectInput {...props} stringOptions={['Active', 'PassThrough']} clearable={true} />}
136
+ />
137
+ </div>
138
+ );
139
+ }
@@ -0,0 +1,176 @@
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 { Option } from 'react-select';
7
+
8
+ import type {
9
+ IAccount,
10
+ IAccountDetails,
11
+ IFormikStageConfigInjectedProps,
12
+ IFormInputProps,
13
+ IRegion,
14
+ } from '@spinnaker/core';
15
+ import {
16
+ AccountService,
17
+ CheckboxInput,
18
+ FormikFormField,
19
+ HelpField,
20
+ NameUtils,
21
+ ReactSelectInput,
22
+ TetheredCreatable,
23
+ TextInput,
24
+ useData,
25
+ } from '@spinnaker/core';
26
+
27
+ import { availableRuntimes, lambdaHelpFields } from './function.constants';
28
+
29
+ export function BasicSettingsForm(props: IFormikStageConfigInjectedProps) {
30
+ const { values } = props.formik;
31
+
32
+ const setFunctionName = () => {
33
+ const ns = NameUtils.getClusterName(props.application.name, values.stackName, values.detailName);
34
+ const fn = values.functionUid;
35
+
36
+ props.formik.setFieldValue('functionName', `${ns}-${fn}`);
37
+ };
38
+
39
+ const onAliasChange = (o: Option, field: any) => {
40
+ props.formik.setFieldValue(
41
+ field,
42
+ o.map((layer: any) => layer.value),
43
+ );
44
+ };
45
+
46
+ const onRegionChange = (fieldValue: string) => {
47
+ props.formik.setFieldValue('enableLambdaAtEdge', false);
48
+ props.formik.setFieldValue('region', fieldValue);
49
+ };
50
+
51
+ const onFunctionUidChange = (fieldValue: string) => {
52
+ props.formik.setFieldValue('functionUid', fieldValue);
53
+ setFunctionName();
54
+ };
55
+
56
+ const onStackNameChange = (fieldValue: string) => {
57
+ props.formik.setFieldValue('stackName', fieldValue);
58
+ setFunctionName();
59
+ };
60
+
61
+ const onDetailChange = (fieldValue: string) => {
62
+ props.formik.setFieldValue('detailName', fieldValue);
63
+ setFunctionName();
64
+ };
65
+
66
+ const { result: fetchAccountsResult, status: fetchAccountsStatus } = useData(
67
+ () => AccountService.listAccounts('aws'),
68
+ [],
69
+ [],
70
+ );
71
+
72
+ return (
73
+ <div>
74
+ <FormikFormField
75
+ label="Account"
76
+ name="account"
77
+ input={(inputProps: IFormInputProps) => (
78
+ <ReactSelectInput
79
+ {...inputProps}
80
+ clearable={false}
81
+ isLoading={fetchAccountsStatus === 'PENDING'}
82
+ stringOptions={fetchAccountsResult.map((acc: IAccount) => acc.name)}
83
+ />
84
+ )}
85
+ />
86
+ <FormikFormField
87
+ label="Region"
88
+ name="region"
89
+ onChange={onRegionChange}
90
+ input={(inputProps: IFormInputProps) => (
91
+ <ReactSelectInput
92
+ {...inputProps}
93
+ clearable={false}
94
+ isLoading={fetchAccountsStatus === 'PENDING'}
95
+ stringOptions={fetchAccountsResult
96
+ .filter((acc: IAccountDetails) => acc.name === values.account)
97
+ .flatMap((acc: IAccountDetails) => acc.regions)
98
+ .map((reg: IRegion) => reg.name)}
99
+ />
100
+ )}
101
+ />
102
+
103
+ <FormikFormField
104
+ name="functionUid"
105
+ label="Function Name"
106
+ onChange={onFunctionUidChange}
107
+ help={<HelpField id="aws.function.name" />}
108
+ input={(props) => <TextInput {...props} />}
109
+ />
110
+
111
+ <FormikFormField
112
+ name="stackName"
113
+ label="Stack"
114
+ help={<HelpField content={lambdaHelpFields.stack} />}
115
+ onChange={onStackNameChange}
116
+ input={(props) => <TextInput {...props} />}
117
+ />
118
+ <FormikFormField
119
+ name="detailName"
120
+ label="Detail"
121
+ help={<HelpField content={lambdaHelpFields.detail} />}
122
+ onChange={onDetailChange}
123
+ input={(props) => <TextInput {...props} />}
124
+ />
125
+ <FormikFormField
126
+ name="aliasNames"
127
+ label="Alias Name"
128
+ help={
129
+ <HelpField content="AWS Lambda aliases are like a pointer to a specific function version. Users can access the function version using the alias Amazon Resource Name (ARN). Input the alias name and select `Create option ALIAS-INPUT` to add the alias." />
130
+ }
131
+ input={(inputProps: IFormInputProps) => (
132
+ <TetheredCreatable
133
+ {...inputProps}
134
+ multi={true}
135
+ clearable={false}
136
+ placeholder={'Input Alias Name...'}
137
+ onChange={(e: Option) => {
138
+ onAliasChange(e, 'aliases');
139
+ }}
140
+ value={values.aliases ? values.aliases.map((alias: string) => ({ value: alias, label: alias })) : []}
141
+ />
142
+ )}
143
+ />
144
+ <FormikFormField
145
+ name="runtime"
146
+ label="Runtime"
147
+ help={<HelpField id="aws.function.runtime" />}
148
+ input={(props) => <ReactSelectInput {...props} stringOptions={availableRuntimes} clearable={true} />}
149
+ />
150
+ <FormikFormField
151
+ name="s3bucket"
152
+ label="S3 Bucket"
153
+ help={<HelpField id="aws.function.s3bucket" />}
154
+ input={(props) => <TextInput {...props} placeholder="S3 bucket name" />}
155
+ />
156
+ <FormikFormField
157
+ name="s3key"
158
+ label="S3 Key"
159
+ help={<HelpField id="aws.function.s3key" />}
160
+ input={(props) => <TextInput {...props} placeholder="object.zip" />}
161
+ />
162
+ <FormikFormField
163
+ name="handler"
164
+ label="Handler"
165
+ help={<HelpField id="aws.function.handler" />}
166
+ input={(props) => <TextInput {...props} placeholder="filename.method" />}
167
+ />
168
+ <FormikFormField
169
+ name="publish"
170
+ label="Publish"
171
+ help={<HelpField id="aws.function.publish" />}
172
+ input={(props) => <CheckboxInput {...props} />}
173
+ />
174
+ </div>
175
+ );
176
+ }
@@ -0,0 +1,24 @@
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 { FormikFormField, HelpField, MapEditorInput, TextInput } from '@spinnaker/core';
7
+
8
+ export function ExecutionRoleForm() {
9
+ return (
10
+ <div>
11
+ <FormikFormField
12
+ name="envVariables"
13
+ label="Env Variables"
14
+ input={(props) => <MapEditorInput {...props} allowEmptyValues={true} addButtonLabel="Add" />}
15
+ />
16
+ <FormikFormField
17
+ name="KMSKeyArn"
18
+ label="Key ARN"
19
+ help={<HelpField id="aws.function.kmsKeyArn" />}
20
+ input={(props) => <TextInput {...props} />}
21
+ />
22
+ </div>
23
+ );
24
+ }
@@ -0,0 +1,15 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import React from 'react';
4
+
5
+ import { FormikFormField, TextInput } from '@spinnaker/core';
6
+
7
+ export function ExecutionRoleForm() {
8
+ return (
9
+ <FormikFormField
10
+ name="role"
11
+ label="Role ARN"
12
+ input={(props) => <TextInput {...props} placeholder="Enter role ARN" name="role" />}
13
+ />
14
+ );
15
+ }
@@ -0,0 +1,28 @@
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
+ import { CheckboxInput, FormikFormField, HelpField } from '@spinnaker/core';
8
+
9
+ const helpFieldContent = {
10
+ lambdaAtEdge:
11
+ 'Validate AWS Lambda function configuration against Lambda@Edge requirements. This will not enable Lambda@Edge on this function. ',
12
+ };
13
+ export function LambdaAtEdgeForm(props: IFormikStageConfigInjectedProps) {
14
+ const { values } = props.formik;
15
+ if (values.region !== 'us-east-1') {
16
+ return <div className="horizontal center">Lambda@Edge is only available in region us-east-1.</div>;
17
+ }
18
+ return (
19
+ <div>
20
+ <FormikFormField
21
+ name="enableLambdaAtEdge"
22
+ label="Enable Lambda@Edge Validation"
23
+ help={<HelpField content={helpFieldContent.lambdaAtEdge} />}
24
+ input={(props) => <CheckboxInput {...props} />}
25
+ />
26
+ </div>
27
+ );
28
+ }
@@ -0,0 +1,123 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { uniqBy } from 'lodash';
5
+ import React from 'react';
6
+ import type { Option } from 'react-select';
7
+
8
+ import type { IFormikStageConfigInjectedProps, IFormInputProps, ISecurityGroup, ISubnet, IVpc } from '@spinnaker/core';
9
+ import {
10
+ FormikFormField,
11
+ NetworkReader,
12
+ ReactInjector,
13
+ ReactSelectInput,
14
+ SubnetReader,
15
+ TetheredSelect,
16
+ useData,
17
+ } from '@spinnaker/core';
18
+
19
+ const toSubnetOption = (value: ISubnet): Option<string> => {
20
+ return { value: value.id, label: value.id };
21
+ };
22
+
23
+ export function NetworkForm(props: IFormikStageConfigInjectedProps) {
24
+ const { values } = props.formik;
25
+
26
+ const onChangeVpc = (vpcs: any) => {
27
+ props.formik.setFieldValue('securityGroupIds', null);
28
+ props.formik.setFieldValue('subnetIds', null);
29
+ props.formik.setFieldValue('vpcId', vpcs.target.value);
30
+ };
31
+
32
+ const onChangeSubnet = (subnets: any) => {
33
+ const subnetsSelected = subnets.map((o: any) => o.value);
34
+ props.formik.setFieldValue('subnetIds', subnetsSelected);
35
+ };
36
+
37
+ const onChangeSG = (sgs: any) => {
38
+ const sgsSelected = sgs.map((o: any) => o.value);
39
+ props.formik.setFieldValue('securityGroupIds', sgsSelected);
40
+ };
41
+
42
+ const { result: fetchVpcsResult, status: fetchVpcsStatus } = useData(
43
+ () => NetworkReader.listNetworksByProvider('aws'),
44
+ [],
45
+ [],
46
+ );
47
+
48
+ const { result: fetchSubnetsResult } = useData(() => SubnetReader.listSubnetsByProvider('aws'), [], []);
49
+
50
+ const { result: fetchSGsResult } = useData(
51
+ () => ReactInjector.securityGroupReader.getAllSecurityGroups(),
52
+ undefined,
53
+ [],
54
+ );
55
+
56
+ const availableVpcs =
57
+ values.account && values.region && fetchVpcsStatus !== 'PENDING'
58
+ ? fetchVpcsResult
59
+ .filter((v: IVpc) => v.deprecated === false)
60
+ .filter((v: IVpc) => v.account === values.account)
61
+ .filter((v: IVpc) => v.region === values.region)
62
+ .map((v: IVpc) => v.id)
63
+ : [];
64
+
65
+ const dedupedSubnets = uniqBy(
66
+ fetchSubnetsResult.filter((s: ISubnet) => s.vpcId === values.vpcId),
67
+ 'id',
68
+ );
69
+
70
+ const availableSGs =
71
+ values.account && values.region && values.vpcId
72
+ ? fetchSGsResult[values.account]['aws'][values.region]
73
+ .filter((sg: ISecurityGroup) => sg.vpcId === values.vpcId)
74
+ .map((sg: ISecurityGroup) => ({ value: sg.id, label: sg.name }))
75
+ : [];
76
+
77
+ return (
78
+ <div>
79
+ <FormikFormField
80
+ name="vpcId"
81
+ label="VPC Id"
82
+ input={(inputProps: IFormInputProps) => (
83
+ <ReactSelectInput
84
+ {...inputProps}
85
+ onChange={onChangeVpc}
86
+ isLoading={fetchVpcsStatus === 'PENDING'}
87
+ stringOptions={availableVpcs}
88
+ clearable={true}
89
+ />
90
+ )}
91
+ />
92
+ <div className="form-group">
93
+ <div className="col-md-4 sm-label-right">
94
+ <b>Subnets </b>
95
+ </div>
96
+ {dedupedSubnets.length === 0 ? (
97
+ <div className="form-control-static">No subnets found in the selected account/region/VPC </div>
98
+ ) : (
99
+ <div className="col-md-6">
100
+ <TetheredSelect
101
+ multi={true}
102
+ options={dedupedSubnets.map((s: ISubnet) => toSubnetOption(s))}
103
+ value={values.subnetIds}
104
+ onChange={onChangeSubnet}
105
+ />
106
+ </div>
107
+ )}
108
+ </div>
109
+ <div className="form-group">
110
+ <div className="col-md-4 sm-label-right">
111
+ <b>Security Groups </b>
112
+ </div>
113
+ {availableSGs.length === 0 ? (
114
+ <div className="form-control-static">No security groups found in the selected account/region/VPC </div>
115
+ ) : (
116
+ <div className="col-md-6">
117
+ <TetheredSelect multi={true} options={availableSGs} value={values.securityGroupIds} onChange={onChangeSG} />
118
+ </div>
119
+ )}
120
+ </div>
121
+ </div>
122
+ );
123
+ }
@@ -0,0 +1,49 @@
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 { Option } from 'react-select';
7
+
8
+ import type { IFormikStageConfigInjectedProps, IFormInputProps } from '@spinnaker/core';
9
+ import { FormikFormField, HelpField, NumberInput, TetheredCreatable } from '@spinnaker/core';
10
+
11
+ export function TriggerEventsForm(props: IFormikStageConfigInjectedProps) {
12
+ const { values } = props.formik;
13
+
14
+ const onChange = (o: Option, field: any) => {
15
+ props.formik.setFieldValue(
16
+ field,
17
+ o.map((arn: any) => arn.value),
18
+ );
19
+ };
20
+
21
+ return (
22
+ <div>
23
+ <FormikFormField
24
+ name="triggerArns"
25
+ label="Event ARNs"
26
+ help={
27
+ <HelpField content="The resource ARNs for Lambda event trigger sources. Triggers created here will only be applied to the higher level function, and will NOT be applied to function aliases. Input the entire ARN and select `Create option TRIGGER-ARN-INPUT` to add the ARN." />
28
+ }
29
+ input={(inputProps: IFormInputProps) => (
30
+ <TetheredCreatable
31
+ {...inputProps}
32
+ multi={true}
33
+ placeholder={'Input ARN...'}
34
+ onChange={(e: Option) => {
35
+ onChange(e, 'triggerArns');
36
+ }}
37
+ value={values.triggerArns ? values.triggerArns.map((arn: string) => ({ value: arn, label: arn })) : []}
38
+ />
39
+ )}
40
+ />
41
+
42
+ <FormikFormField
43
+ name="batchsize"
44
+ label="Event Batch Size"
45
+ input={(inputProps: IFormInputProps) => <NumberInput {...inputProps} min={1} max={1000} />}
46
+ />
47
+ </div>
48
+ );
49
+ }