@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.
- package/CHANGELOG.md +22 -0
- package/dist/aws.validators.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/pipeline/stages/deleteLambda/DeleteLambdaFunctionStageForm.d.ts +3 -0
- package/dist/pipeline/stages/deleteLambda/LambdaDeleteStage.d.ts +8 -0
- package/dist/pipeline/stages/deleteLambda/constants/deleteVersion.constants.d.ts +6 -0
- package/dist/pipeline/stages/deleteLambda/constants/deleteVersion.picker.d.ts +16 -0
- package/dist/pipeline/stages/deleteLambda/constants/index.d.ts +2 -0
- package/dist/pipeline/stages/deleteLambda/index.d.ts +1 -0
- package/dist/pipeline/stages/deployLambda/components/AwsLambdaFunctionStageForm.d.ts +3 -0
- package/dist/pipeline/stages/deployLambda/components/BasicSettingsForm.d.ts +3 -0
- package/dist/pipeline/stages/deployLambda/components/EnvironmentForm.d.ts +2 -0
- package/dist/pipeline/stages/deployLambda/components/ExecutionRoleForm.d.ts +2 -0
- package/dist/pipeline/stages/deployLambda/components/LambdaAtEdgeForm.d.ts +3 -0
- package/dist/pipeline/stages/deployLambda/components/NetworkForm.d.ts +3 -0
- package/dist/pipeline/stages/deployLambda/components/TriggerEventsForm.d.ts +3 -0
- package/dist/pipeline/stages/deployLambda/components/function.constants.d.ts +5 -0
- package/dist/pipeline/stages/deployLambda/components/index.d.ts +5 -0
- package/dist/pipeline/stages/deployLambda/config/LambdaDeploymentStage.d.ts +3 -0
- package/dist/pipeline/stages/deployLambda/config/LambdaDeploymentStageConfig.d.ts +4 -0
- package/dist/pipeline/stages/deployLambda/config/LambdaDeploymentStageExecutionDetails.d.ts +6 -0
- package/dist/pipeline/stages/deployLambda/config/UpsertDefaults.d.ts +1 -0
- package/dist/pipeline/stages/deployLambda/config/function.defaults.d.ts +2 -0
- package/dist/pipeline/stages/deployLambda/index.d.ts +1 -0
- package/dist/pipeline/stages/invokeLambda/InvokeLambdaFunctionStageForm.d.ts +3 -0
- package/dist/pipeline/stages/invokeLambda/LambdaInvokeStage.d.ts +8 -0
- package/dist/pipeline/stages/invokeLambda/components/InvokeLambdaOperation.d.ts +3 -0
- package/dist/pipeline/stages/invokeLambda/components/index.d.ts +1 -0
- package/dist/pipeline/stages/invokeLambda/index.d.ts +1 -0
- package/dist/pipeline/stages/routeLambda/LambdaRouteStage.d.ts +8 -0
- package/dist/pipeline/stages/routeLambda/RouteLambdaFunctionStageForm.d.ts +3 -0
- package/dist/pipeline/stages/routeLambda/TriggerEventsForm.d.ts +3 -0
- package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/BlueGreenDeploymentForm.d.ts +3 -0
- package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/HealthCheckStrategy.d.ts +3 -0
- package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/InvocationHealthCheck.d.ts +3 -0
- package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/health.constants.d.ts +5 -0
- package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/index.d.ts +1 -0
- package/dist/pipeline/stages/routeLambda/components/DeploymentStrategyForm.d.ts +3 -0
- package/dist/pipeline/stages/routeLambda/components/RenderStrategy.d.ts +3 -0
- package/dist/pipeline/stages/routeLambda/components/SimpleDeploymentForm.d.ts +3 -0
- package/dist/pipeline/stages/routeLambda/components/VersionPicker.d.ts +14 -0
- package/dist/pipeline/stages/routeLambda/components/WeightedDeploymentForm.d.ts +3 -0
- package/dist/pipeline/stages/routeLambda/components/index.d.ts +1 -0
- package/dist/pipeline/stages/routeLambda/constants/index.d.ts +3 -0
- package/dist/pipeline/stages/routeLambda/constants/strategy.constants.d.ts +6 -0
- package/dist/pipeline/stages/routeLambda/constants/strategy.picker.d.ts +16 -0
- package/dist/pipeline/stages/routeLambda/constants/versions.constants.d.ts +6 -0
- package/dist/pipeline/stages/routeLambda/index.d.ts +1 -0
- package/dist/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStage.d.ts +3 -0
- package/dist/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStageConfig.d.ts +5 -0
- package/dist/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStageExecutionDetails.d.ts +6 -0
- package/dist/pipeline/stages/updateCodeLambda/components/UpdateCodeStageForm.d.ts +3 -0
- package/dist/pipeline/stages/updateCodeLambda/components/index.d.ts +1 -0
- package/dist/pipeline/stages/updateCodeLambda/index.d.ts +1 -0
- package/package.json +3 -3
- package/src/aws.module.ts +6 -6
- package/src/aws.validators.ts +7 -3
- package/src/pipeline/stages/deleteLambda/DeleteLambdaFunctionStageForm.tsx +143 -0
- package/src/pipeline/stages/deleteLambda/LambdaDeleteStage.tsx +86 -0
- package/src/pipeline/stages/deleteLambda/constants/deleteVersion.constants.ts +37 -0
- package/src/pipeline/stages/deleteLambda/constants/deleteVersion.picker.tsx +47 -0
- package/src/pipeline/stages/deleteLambda/constants/index.ts +5 -0
- package/src/pipeline/stages/deleteLambda/index.ts +11 -0
- package/src/pipeline/stages/deployLambda/components/AwsLambdaFunctionStageForm.tsx +139 -0
- package/src/pipeline/stages/deployLambda/components/BasicSettingsForm.tsx +176 -0
- package/src/pipeline/stages/deployLambda/components/EnvironmentForm.tsx +24 -0
- package/src/pipeline/stages/deployLambda/components/ExecutionRoleForm.tsx +15 -0
- package/src/pipeline/stages/deployLambda/components/LambdaAtEdgeForm.tsx +28 -0
- package/src/pipeline/stages/deployLambda/components/NetworkForm.tsx +123 -0
- package/src/pipeline/stages/deployLambda/components/TriggerEventsForm.tsx +49 -0
- package/src/pipeline/stages/deployLambda/components/function.constants.ts +32 -0
- package/src/pipeline/stages/deployLambda/components/index.ts +8 -0
- package/src/pipeline/stages/deployLambda/config/LambdaDeploymentStage.tsx +20 -0
- package/src/pipeline/stages/deployLambda/config/LambdaDeploymentStageConfig.tsx +64 -0
- package/src/pipeline/stages/deployLambda/config/LambdaDeploymentStageExecutionDetails.tsx +31 -0
- package/src/pipeline/stages/deployLambda/config/UpsertDefaults.tsx +21 -0
- package/src/pipeline/stages/deployLambda/config/function.defaults.ts +39 -0
- package/src/pipeline/stages/deployLambda/index.ts +11 -0
- package/src/pipeline/stages/invokeLambda/InvokeLambdaFunctionStageForm.tsx +106 -0
- package/src/pipeline/stages/invokeLambda/LambdaInvokeStage.tsx +125 -0
- package/src/pipeline/stages/invokeLambda/components/InvokeLambdaOperation.tsx +77 -0
- package/src/pipeline/stages/invokeLambda/components/index.ts +4 -0
- package/src/pipeline/stages/invokeLambda/index.ts +11 -0
- package/src/pipeline/stages/routeLambda/LambdaRouteStage.tsx +98 -0
- package/src/pipeline/stages/routeLambda/RouteLambdaFunctionStageForm.tsx +151 -0
- package/src/pipeline/stages/routeLambda/TriggerEventsForm.tsx +51 -0
- package/src/pipeline/stages/routeLambda/components/BlueGreenDeployment/BlueGreenDeploymentForm.tsx +27 -0
- package/src/pipeline/stages/routeLambda/components/BlueGreenDeployment/HealthCheckStrategy.tsx +21 -0
- package/src/pipeline/stages/routeLambda/components/BlueGreenDeployment/InvocationHealthCheck.tsx +93 -0
- package/src/pipeline/stages/routeLambda/components/BlueGreenDeployment/health.constants.ts +14 -0
- package/src/pipeline/stages/routeLambda/components/BlueGreenDeployment/index.ts +4 -0
- package/src/pipeline/stages/routeLambda/components/DeploymentStrategyForm.tsx +18 -0
- package/src/pipeline/stages/routeLambda/components/RenderStrategy.tsx +23 -0
- package/src/pipeline/stages/routeLambda/components/SimpleDeploymentForm.tsx +67 -0
- package/src/pipeline/stages/routeLambda/components/VersionPicker.tsx +43 -0
- package/src/pipeline/stages/routeLambda/components/WeightedDeploymentForm.tsx +107 -0
- package/src/pipeline/stages/routeLambda/components/index.ts +4 -0
- package/src/pipeline/stages/routeLambda/constants/index.ts +6 -0
- package/src/pipeline/stages/routeLambda/constants/strategy.constants.tsx +26 -0
- package/src/pipeline/stages/routeLambda/constants/strategy.picker.tsx +47 -0
- package/src/pipeline/stages/routeLambda/constants/versions.constants.ts +31 -0
- package/src/pipeline/stages/routeLambda/index.ts +11 -0
- package/src/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStage.tsx +20 -0
- package/src/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStageConfig.tsx +41 -0
- package/src/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStageExecutionDetails.tsx +31 -0
- package/src/pipeline/stages/updateCodeLambda/components/UpdateCodeStageForm.tsx +122 -0
- package/src/pipeline/stages/updateCodeLambda/components/index.ts +4 -0
- package/src/pipeline/stages/updateCodeLambda/index.ts +11 -0
- package/src/serverGroup/details/scalingPolicy/upsert/step/StepPolicyAction.tsx +2 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { IExecutionDetailsSectionProps, IStageTypeConfig } from '@spinnaker/core';
|
|
3
|
+
export declare function DeleteLambdaExecutionDetails(props: IExecutionDetailsSectionProps): JSX.Element;
|
|
4
|
+
export declare const initialize: () => void;
|
|
5
|
+
export declare namespace DeleteLambdaExecutionDetails {
|
|
6
|
+
const title = "Delete Lambda Stage";
|
|
7
|
+
}
|
|
8
|
+
export declare const lambdaDeleteStage: IStageTypeConfig;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IFormikStageConfigInjectedProps } from '@spinnaker/core';
|
|
3
|
+
export interface IVersionPickerProps {
|
|
4
|
+
config: IFormikStageConfigInjectedProps;
|
|
5
|
+
value: string;
|
|
6
|
+
showingDetails: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface IVersionPickerState {
|
|
9
|
+
value: string;
|
|
10
|
+
label: string;
|
|
11
|
+
description: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class DeleteVersionPicker extends React.Component<IVersionPickerProps, IVersionPickerState> {
|
|
14
|
+
constructor(props: IVersionPickerProps);
|
|
15
|
+
render(): JSX.Element;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LambdaDeleteStage';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { IExecutionDetailsSectionProps } from '@spinnaker/core';
|
|
3
|
+
export declare function LambdaDeploymentExecutionDetails(props: IExecutionDetailsSectionProps): JSX.Element;
|
|
4
|
+
export declare namespace LambdaDeploymentExecutionDetails {
|
|
5
|
+
const title = "Lambda Deployment Stage";
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function upsertDefaults(initialValues: any, defaultValues: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './config/LambdaDeploymentStage';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { IExecutionDetailsSectionProps, IStageTypeConfig } from '@spinnaker/core';
|
|
3
|
+
export declare function InvokeLambdaExecutionDetails(props: IExecutionDetailsSectionProps): JSX.Element;
|
|
4
|
+
export declare const initialize: () => void;
|
|
5
|
+
export declare namespace InvokeLambdaExecutionDetails {
|
|
6
|
+
const title = "Invoke Lambda Stage";
|
|
7
|
+
}
|
|
8
|
+
export declare const lambdaInvokeStage: IStageTypeConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './InvokeLambdaOperation';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LambdaInvokeStage';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { IExecutionDetailsSectionProps, IStageTypeConfig } from '@spinnaker/core';
|
|
3
|
+
export declare function RouteLambdaExecutionDetails(props: IExecutionDetailsSectionProps): JSX.Element;
|
|
4
|
+
export declare const initialize: () => void;
|
|
5
|
+
export declare namespace RouteLambdaExecutionDetails {
|
|
6
|
+
const title = "Route Lambda Traffic Stage";
|
|
7
|
+
}
|
|
8
|
+
export declare const lambdaRouteStage: IStageTypeConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './BlueGreenDeploymentForm';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface IVersionPickerProps {
|
|
3
|
+
value: string;
|
|
4
|
+
showingDetails: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface IVersionPickerState {
|
|
7
|
+
value: string;
|
|
8
|
+
label: string;
|
|
9
|
+
description: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class VersionPicker extends React.Component<IVersionPickerProps, IVersionPickerState> {
|
|
12
|
+
constructor(props: IVersionPickerProps);
|
|
13
|
+
render(): JSX.Element;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DeploymentStrategyForm';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IFormikStageConfigInjectedProps } from '@spinnaker/core';
|
|
3
|
+
export interface IVersionPickerProps {
|
|
4
|
+
config: IFormikStageConfigInjectedProps;
|
|
5
|
+
value: string;
|
|
6
|
+
showingDetails: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface IVersionPickerState {
|
|
9
|
+
value: string;
|
|
10
|
+
label: string;
|
|
11
|
+
description: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class DeploymentStrategyPicker extends React.Component<IVersionPickerProps, IVersionPickerState> {
|
|
14
|
+
constructor(props: IVersionPickerProps);
|
|
15
|
+
render(): JSX.Element;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LambdaRouteStage';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { IStage, IStageConfigProps } from '@spinnaker/core';
|
|
3
|
+
import './LambdaUpdateCodeStage.less';
|
|
4
|
+
export declare function LambdaUpdateCodeConfig(props: IStageConfigProps): JSX.Element;
|
|
5
|
+
export declare function validate(stageConfig: IStage): any;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { IExecutionDetailsSectionProps } from '@spinnaker/core';
|
|
3
|
+
export declare function LambdaUpdateCodeExecutionDetails(props: IExecutionDetailsSectionProps): JSX.Element;
|
|
4
|
+
export declare namespace LambdaUpdateCodeExecutionDetails {
|
|
5
|
+
const title = "Lambda Update Code Stage";
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './UpdateCodeStageForm';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LambdaUpdateCodeStage';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spinnaker/amazon",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.14.1",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"lib": "npm run build"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@spinnaker/core": "^0.
|
|
16
|
+
"@spinnaker/core": "^0.26.0",
|
|
17
17
|
"@uirouter/angularjs": "1.0.26",
|
|
18
18
|
"@uirouter/core": "6.0.8",
|
|
19
19
|
"@uirouter/react": "1.0.7",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"shx": "0.3.3",
|
|
56
56
|
"typescript": "4.3.5"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "581f9d4358d0c90a385df0119a7ae0a41b81c1cb"
|
|
59
59
|
}
|
package/src/aws.module.ts
CHANGED
|
@@ -6,9 +6,9 @@ import { AWSProviderSettings } from './aws.settings';
|
|
|
6
6
|
import { COMMON_MODULE } from './common/common.module';
|
|
7
7
|
import './deploymentStrategy/rollingPush.strategy';
|
|
8
8
|
import { AmazonFunctionDetails } from './function';
|
|
9
|
-
import { CreateLambdaFunction } from './function
|
|
9
|
+
import { CreateLambdaFunction } from './function';
|
|
10
|
+
import { AwsFunctionTransformer } from './function';
|
|
10
11
|
import { AWS_FUNCTION_MODULE } from './function/function.module';
|
|
11
|
-
import { AwsFunctionTransformer } from './function/function.transformer';
|
|
12
12
|
import './help/amazon.help';
|
|
13
13
|
import { AwsImageReader } from './image';
|
|
14
14
|
import { AMAZON_INSTANCE_AWSINSTANCETYPE_SERVICE } from './instance/awsInstanceType.service';
|
|
@@ -18,11 +18,11 @@ import { INSTANCE_DNS_COMPONENT } from './instance/details/instanceDns.component
|
|
|
18
18
|
import { INSTANCE_SECURITY_GROUPS_COMPONENT } from './instance/details/instanceSecurityGroups.component';
|
|
19
19
|
import { INSTANCE_STATUS_COMPONENT } from './instance/details/instanceStatus.component';
|
|
20
20
|
import { INSTANCE_TAGS_COMPONENT } from './instance/details/instanceTags.component';
|
|
21
|
-
import { AmazonLoadBalancerClusterContainer } from './loadBalancer
|
|
22
|
-
import { AmazonLoadBalancersTag } from './loadBalancer
|
|
23
|
-
import { AmazonLoadBalancerChoiceModal } from './loadBalancer
|
|
21
|
+
import { AmazonLoadBalancerClusterContainer } from './loadBalancer';
|
|
22
|
+
import { AmazonLoadBalancersTag } from './loadBalancer';
|
|
23
|
+
import { AmazonLoadBalancerChoiceModal } from './loadBalancer';
|
|
24
|
+
import { AwsLoadBalancerTransformer } from './loadBalancer';
|
|
24
25
|
import { AWS_LOAD_BALANCER_MODULE } from './loadBalancer/loadBalancer.module';
|
|
25
|
-
import { AwsLoadBalancerTransformer } from './loadBalancer/loadBalancer.transformer';
|
|
26
26
|
import amazonLogo from './logo/amazon.logo.svg';
|
|
27
27
|
import { AMAZON_PIPELINE_STAGES_BAKE_AWSBAKESTAGE } from './pipeline/stages/bake/awsBakeStage';
|
|
28
28
|
import { AMAZON_PIPELINE_STAGES_CLONESERVERGROUP_AWSCLONESERVERGROUPSTAGE } from './pipeline/stages/cloneServerGroup/awsCloneServerGroupStage';
|
package/src/aws.validators.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isEmpty } from 'lodash';
|
|
2
2
|
|
|
3
3
|
export const iamRoleValidator = (value: string, label: string) => {
|
|
4
|
-
const isIAMRole = value.match(/^arn:aws:iam::\d{12}:role\/?\/[a-zA-Z_0-9
|
|
4
|
+
const isIAMRole = value.match(/^arn:aws:iam::\d{12}:role\/?\/[a-zA-Z_0-9+=,.@\-/]+/);
|
|
5
5
|
return isIAMRole
|
|
6
6
|
? undefined
|
|
7
7
|
: `Invalid role. ${label} must match regular expression: arn:aws:iam::d{12}:role/?[a-zA-Z_0-9+=,.@-_/]+`;
|
|
@@ -9,10 +9,9 @@ export const iamRoleValidator = (value: string, label: string) => {
|
|
|
9
9
|
|
|
10
10
|
export const s3BucketNameValidator = (value: string, label: string) => {
|
|
11
11
|
const s3BucketName = value.match(/^[0-9A-Za-z.-]*[^.]$/);
|
|
12
|
-
|
|
12
|
+
return s3BucketName
|
|
13
13
|
? undefined
|
|
14
14
|
: `Invalid S3 Bucket name. ${label} must match regular expression: [0-9A-Za-z.-]*[^.]$`;
|
|
15
|
-
return err;
|
|
16
15
|
};
|
|
17
16
|
|
|
18
17
|
export const awsArnValidator = (value: string, label: string) => {
|
|
@@ -25,3 +24,8 @@ export const awsArnValidator = (value: string, label: string) => {
|
|
|
25
24
|
export const awsTagsValidator = (value: string | { [key: string]: string }, label: string) => {
|
|
26
25
|
return isEmpty(value) ? `At least one ${label} is required` : undefined;
|
|
27
26
|
};
|
|
27
|
+
|
|
28
|
+
export const simpleStringValidator = (value: string, label: string) => {
|
|
29
|
+
const simpleString = value.match(/^[0-9A-Za-z]*$/);
|
|
30
|
+
return simpleString ? undefined : `Invalid String Value. ${label} must match regular expression: [0-9A-Za-z]`;
|
|
31
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
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 { AccountService, FormikFormField, HelpField, NumberInput, ReactSelectInput, useData } from '@spinnaker/core';
|
|
15
|
+
|
|
16
|
+
import { DeleteVersionList, DeleteVersionPicker } from './constants';
|
|
17
|
+
import type { IAmazonFunctionSourceData } from '../../../domain';
|
|
18
|
+
|
|
19
|
+
export function DeleteLambdaFunctionStageForm(props: IFormikStageConfigInjectedProps) {
|
|
20
|
+
const { values } = props.formik;
|
|
21
|
+
const { functions } = props.application;
|
|
22
|
+
|
|
23
|
+
const { result: fetchAccountsResult, status: fetchAccountsStatus } = useData(
|
|
24
|
+
() => AccountService.listAccounts('aws'),
|
|
25
|
+
[],
|
|
26
|
+
[],
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const onAccountChange = (fieldName: string, fieldValue: any): void => {
|
|
30
|
+
props.formik.setFieldValue('region', null);
|
|
31
|
+
props.formik.setFieldValue('functionName', null);
|
|
32
|
+
|
|
33
|
+
props.formik.setFieldValue(fieldName, fieldValue);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const onRegionChange = (fieldName: string, fieldValue: any): void => {
|
|
37
|
+
props.formik.setFieldValue('functionName', null);
|
|
38
|
+
|
|
39
|
+
props.formik.setFieldValue(fieldName, fieldValue);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const availableFunctions =
|
|
43
|
+
values.account && values.region
|
|
44
|
+
? functions.data
|
|
45
|
+
.filter((f: IFunction) => f.account === values.account)
|
|
46
|
+
.filter((f: IFunction) => f.region === values.region)
|
|
47
|
+
.map((f: IFunction) => f.functionName)
|
|
48
|
+
: [];
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<div className="form-horizontal">
|
|
52
|
+
<FormikFormField
|
|
53
|
+
label="Account"
|
|
54
|
+
name="account"
|
|
55
|
+
onChange={onAccountChange}
|
|
56
|
+
required={true}
|
|
57
|
+
input={(inputProps: IFormInputProps) => (
|
|
58
|
+
<ReactSelectInput
|
|
59
|
+
{...inputProps}
|
|
60
|
+
clearable={false}
|
|
61
|
+
isLoading={fetchAccountsStatus === 'PENDING'}
|
|
62
|
+
stringOptions={fetchAccountsResult.map((acc: IAccount) => acc.name)}
|
|
63
|
+
/>
|
|
64
|
+
)}
|
|
65
|
+
/>
|
|
66
|
+
<FormikFormField
|
|
67
|
+
label="Region"
|
|
68
|
+
name="region"
|
|
69
|
+
onChange={onRegionChange}
|
|
70
|
+
input={(inputProps: IFormInputProps) => (
|
|
71
|
+
<ReactSelectInput
|
|
72
|
+
clearable={false}
|
|
73
|
+
disabled={!values.account}
|
|
74
|
+
placeholder={values.account ? 'Select...' : 'Select an Account...'}
|
|
75
|
+
{...inputProps}
|
|
76
|
+
isLoading={fetchAccountsStatus === 'PENDING'}
|
|
77
|
+
stringOptions={fetchAccountsResult
|
|
78
|
+
.filter((acc: IAccountDetails) => acc.name === values.account)
|
|
79
|
+
.flatMap((acc: IAccountDetails) => acc.regions)
|
|
80
|
+
.map((reg: IRegion) => reg.name)}
|
|
81
|
+
/>
|
|
82
|
+
)}
|
|
83
|
+
/>
|
|
84
|
+
<FormikFormField
|
|
85
|
+
label="Function Name"
|
|
86
|
+
name="functionName"
|
|
87
|
+
input={(inputProps: IFormInputProps) => (
|
|
88
|
+
<ReactSelectInput
|
|
89
|
+
clearable={false}
|
|
90
|
+
disabled={!(values.account && values.region)}
|
|
91
|
+
placeholder={values.account && values.region ? 'Select...' : 'Select an Account and Region...'}
|
|
92
|
+
{...inputProps}
|
|
93
|
+
stringOptions={availableFunctions}
|
|
94
|
+
/>
|
|
95
|
+
)}
|
|
96
|
+
/>
|
|
97
|
+
<FormikFormField
|
|
98
|
+
label="Target Version"
|
|
99
|
+
name="version"
|
|
100
|
+
input={(inputProps: IFormInputProps) => (
|
|
101
|
+
<ReactSelectInput
|
|
102
|
+
{...inputProps}
|
|
103
|
+
clearable={false}
|
|
104
|
+
options={DeleteVersionList}
|
|
105
|
+
optionRenderer={(option) => (
|
|
106
|
+
<DeleteVersionPicker config={props} value={option.value as any} showingDetails={true} />
|
|
107
|
+
)}
|
|
108
|
+
/>
|
|
109
|
+
)}
|
|
110
|
+
/>
|
|
111
|
+
{values.version === '$PROVIDED' ? (
|
|
112
|
+
<FormikFormField
|
|
113
|
+
label="Version Number"
|
|
114
|
+
name="versionNumber"
|
|
115
|
+
input={(inputProps: IFormInputProps) => (
|
|
116
|
+
<ReactSelectInput
|
|
117
|
+
{...inputProps}
|
|
118
|
+
clearable={false}
|
|
119
|
+
stringOptions={functions.data
|
|
120
|
+
.filter((f: IAmazonFunctionSourceData) => f.account === values.account)
|
|
121
|
+
.filter((f: IAmazonFunctionSourceData) => f.region === values.region)
|
|
122
|
+
.filter((f: IAmazonFunctionSourceData) => f.functionName === values.functionName)
|
|
123
|
+
.flatMap((f: IAmazonFunctionSourceData) =>
|
|
124
|
+
Object.values(f.revisions).sort(function (a: number, b: number) {
|
|
125
|
+
return b - a;
|
|
126
|
+
}),
|
|
127
|
+
)
|
|
128
|
+
.filter((r: any) => r !== '$LATEST')}
|
|
129
|
+
/>
|
|
130
|
+
)}
|
|
131
|
+
/>
|
|
132
|
+
) : null}
|
|
133
|
+
{values.version === '$MOVING' ? (
|
|
134
|
+
<FormikFormField
|
|
135
|
+
name="retentionNumber"
|
|
136
|
+
help={<HelpField content="The number of Lambda versions to retain" />}
|
|
137
|
+
label="Prior Versions to Retain"
|
|
138
|
+
input={(props) => <NumberInput {...props} min={1} max={100} />}
|
|
139
|
+
/>
|
|
140
|
+
) : null}
|
|
141
|
+
</div>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
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
|
+
IExecutionDetailsSectionProps,
|
|
8
|
+
IFormikStageConfigInjectedProps,
|
|
9
|
+
IStage,
|
|
10
|
+
IStageConfigProps,
|
|
11
|
+
IStageTypeConfig,
|
|
12
|
+
} from '@spinnaker/core';
|
|
13
|
+
import {
|
|
14
|
+
ExecutionDetailsSection,
|
|
15
|
+
ExecutionDetailsTasks,
|
|
16
|
+
FormikStageConfig,
|
|
17
|
+
FormValidator,
|
|
18
|
+
HelpContentsRegistry,
|
|
19
|
+
StageFailureMessage,
|
|
20
|
+
} from '@spinnaker/core';
|
|
21
|
+
|
|
22
|
+
import { DeleteLambdaFunctionStageForm } from './DeleteLambdaFunctionStageForm';
|
|
23
|
+
|
|
24
|
+
export function DeleteLambdaExecutionDetails(props: IExecutionDetailsSectionProps) {
|
|
25
|
+
const { stage, name, current } = props;
|
|
26
|
+
return (
|
|
27
|
+
<ExecutionDetailsSection name={name} current={current}>
|
|
28
|
+
<StageFailureMessage stage={stage} message={stage.outputs.failureMessage} />
|
|
29
|
+
<div>
|
|
30
|
+
<p>
|
|
31
|
+
{' '}
|
|
32
|
+
<b> Status: </b> {stage.outputs.deleteTask === 'done' ? 'COMPLETE' : stage.outputs.deleteTask}{' '}
|
|
33
|
+
</p>
|
|
34
|
+
<p>
|
|
35
|
+
{' '}
|
|
36
|
+
<b> Deleted Version: </b>{' '}
|
|
37
|
+
{stage.outputs['deleteTask:deleteVersion'] ? stage.outputs['deleteTask:deleteVersion'] : 'N/A'}{' '}
|
|
38
|
+
</p>
|
|
39
|
+
</div>
|
|
40
|
+
</ExecutionDetailsSection>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function DeleteLambdaConfig(props: IStageConfigProps) {
|
|
45
|
+
return (
|
|
46
|
+
<div className="DeleteLambdaStageConfig">
|
|
47
|
+
<FormikStageConfig
|
|
48
|
+
{...props}
|
|
49
|
+
validate={validate}
|
|
50
|
+
onChange={props.updateStage}
|
|
51
|
+
render={(props: IFormikStageConfigInjectedProps) => <DeleteLambdaFunctionStageForm {...props} />}
|
|
52
|
+
/>
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const initialize = () => {
|
|
58
|
+
HelpContentsRegistry.register('aws.lambdaDeploymentStage.lambda', 'Lambda Name');
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
function validate(stageConfig: IStage) {
|
|
62
|
+
const validator = new FormValidator(stageConfig);
|
|
63
|
+
validator.field('account', 'Account Name').required();
|
|
64
|
+
|
|
65
|
+
validator.field('region', 'Region').required();
|
|
66
|
+
|
|
67
|
+
validator.field('functionName', 'Lambda Function Name').required();
|
|
68
|
+
|
|
69
|
+
validator.field('version', 'Lambda Function Version').required();
|
|
70
|
+
|
|
71
|
+
return validator.validateForm();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// eslint-disable-next-line
|
|
75
|
+
export namespace DeleteLambdaExecutionDetails {
|
|
76
|
+
export const title = 'Delete Lambda Stage';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const lambdaDeleteStage: IStageTypeConfig = {
|
|
80
|
+
key: 'Aws.LambdaDeleteStage',
|
|
81
|
+
label: `AWS Lambda Delete`,
|
|
82
|
+
description: 'Delete an AWS Lambda Function',
|
|
83
|
+
component: DeleteLambdaConfig, // stage config
|
|
84
|
+
executionDetailsSections: [DeleteLambdaExecutionDetails, ExecutionDetailsTasks],
|
|
85
|
+
validateFn: validate,
|
|
86
|
+
};
|