@spinnaker/amazon 0.11.1 → 0.12.3

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 (75) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/domain/IAmazonLaunchTemplate.d.ts +1 -1
  3. package/dist/domain/IAmazonServerGroup.d.ts +10 -0
  4. package/dist/index.js +1 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/instance/awsInstanceType.service.d.ts +10 -2
  7. package/dist/instance/awsInstanceTypes.d.ts +10 -0
  8. package/dist/instance/details/CostFactor.d.ts +6 -0
  9. package/dist/reactShims/aws.react.injector.d.ts +2 -1
  10. package/dist/search/searchResultFormatter.d.ts +2 -2
  11. package/dist/serverGroup/configure/serverGroupCommandBuilder.service.d.ts +17 -2
  12. package/dist/serverGroup/configure/serverGroupConfiguration.service.d.ts +39 -0
  13. package/dist/serverGroup/configure/wizard/instanceType/CpuCreditsToggle.d.ts +3 -4
  14. package/dist/serverGroup/configure/wizard/instanceType/InstanceTypeSelector.d.ts +9 -0
  15. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/AdvancedModeSelector.d.ts +13 -0
  16. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceProfileSelector.d.ts +9 -0
  17. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeRow.d.ts +11 -0
  18. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTable.d.ts +14 -0
  19. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTableBody.d.ts +12 -0
  20. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTableParts.d.ts +15 -0
  21. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstancesDistribution.d.ts +8 -0
  22. package/dist/serverGroup/configure/wizard/instanceType/simpleMode/SimpleModeSelector.d.ts +8 -0
  23. package/dist/serverGroup/configure/wizard/pages/ServerGroupInstanceType.d.ts +9 -6
  24. package/dist/serverGroup/serverGroup.transformer.d.ts +2 -1
  25. package/package.json +5 -5
  26. package/src/domain/IAmazonLaunchTemplate.ts +1 -1
  27. package/src/domain/IAmazonServerGroup.ts +11 -0
  28. package/src/function/details/FunctionActions.spec.tsx +10 -9
  29. package/src/help/amazon.help.ts +9 -6
  30. package/src/image/image.reader.spec.ts +75 -0
  31. package/src/instance/awsInstanceType.service.spec.js +37 -71
  32. package/src/instance/awsInstanceType.service.ts +191 -0
  33. package/src/instance/awsInstanceTypes.ts +311 -0
  34. package/src/instance/details/CostFactor.tsx +29 -0
  35. package/src/instance/details/InstanceInformation.spec.tsx +2 -1
  36. package/src/instance/details/instance.details.controller.js +471 -473
  37. package/src/loadBalancer/details/loadBalancerDetails.controller.spec.ts +5 -3
  38. package/src/reactShims/aws.react.injector.ts +2 -1
  39. package/src/search/{searchResultFormatter.js → searchResultFormatter.ts} +5 -4
  40. package/src/serverGroup/configure/AmazonImageSelectInput.spec.tsx +10 -7
  41. package/src/serverGroup/configure/serverGroupCommandBuilder.aws.service.spec.js +302 -1
  42. package/src/serverGroup/configure/{serverGroupCommandBuilder.service.js → serverGroupCommandBuilder.service.ts} +182 -73
  43. package/src/serverGroup/configure/serverGroupCommandBuilder.spec.js +25 -8
  44. package/src/serverGroup/configure/serverGroupConfiguration.service.spec.ts +6 -13
  45. package/src/serverGroup/configure/serverGroupConfiguration.service.ts +53 -0
  46. package/src/serverGroup/configure/wizard/AmazonCloneServerGroupModal.tsx +1 -1
  47. package/src/serverGroup/configure/wizard/instanceType/CpuCreditsToggle.tsx +31 -31
  48. package/src/serverGroup/configure/wizard/instanceType/InstanceTypeSelector.tsx +133 -0
  49. package/src/serverGroup/configure/wizard/instanceType/advancedMode/AdvancedModeSelector.tsx +99 -0
  50. package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstanceProfileSelector.tsx +36 -0
  51. package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeRow.tsx +144 -0
  52. package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTable.tsx +138 -0
  53. package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTableBody.tsx +135 -0
  54. package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTableParts.tsx +137 -0
  55. package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstancesDistribution.less +5 -0
  56. package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstancesDistribution.tsx +108 -0
  57. package/src/serverGroup/configure/wizard/instanceType/advancedMode/advancedMode.less +110 -0
  58. package/src/serverGroup/configure/wizard/instanceType/simpleMode/SimpleModeSelector.tsx +62 -0
  59. package/src/serverGroup/configure/wizard/pages/ServerGroupInstanceType.tsx +107 -62
  60. package/src/serverGroup/configure/wizard/pages/advancedSettings/ServerGroupAdvancedSettingsCommon.tsx +1 -1
  61. package/src/serverGroup/details/scalingPolicy/scalingPolicySummary.component.ts +6 -2
  62. package/src/serverGroup/details/scalingProcesses/AutoScalingProcessService.spec.ts +1 -2
  63. package/src/serverGroup/details/sections/InstancesDistributionDetailsSection.spec.tsx +8 -5
  64. package/src/serverGroup/details/sections/LaunchTemplateDetailsSection.spec.tsx +8 -5
  65. package/src/serverGroup/serverGroup.transformer.spec.ts +5 -3
  66. package/src/serverGroup/serverGroup.transformer.ts +24 -22
  67. package/src/subnet/SubnetSelectInput.spec.tsx +7 -4
  68. package/src/vpc/{VpcReader.spec.js → VpcReader.spec.ts} +2 -10
  69. package/src/vpc/VpcTag.spec.tsx +37 -0
  70. package/src/vpc/vpc.module.ts +6 -2
  71. package/dist/vpc/vpcTag.directive.d.ts +0 -2
  72. package/src/image/image.reader.spec.js +0 -123
  73. package/src/instance/awsInstanceType.service.js +0 -437
  74. package/src/vpc/vpcTag.directive.js +0 -34
  75. package/src/vpc/vpcTag.directive.spec.js +0 -60
@@ -1,2 +1,10 @@
1
- export const AMAZON_INSTANCE_AWSINSTANCETYPE_SERVICE: "spinnaker.amazon.instanceType.service";
2
- export const name: "spinnaker.amazon.instanceType.service";
1
+ import type { IInstanceTypeCategory, IPreferredInstanceType } from '@spinnaker/core';
2
+ export interface IAmazonPreferredInstanceType extends IPreferredInstanceType {
3
+ cpuCreditsPerHour?: number;
4
+ }
5
+ export interface IAmazonInstanceTypeCategory extends IInstanceTypeCategory {
6
+ showCpuCredits?: boolean;
7
+ descriptionListOverride?: string[];
8
+ }
9
+ export declare const AMAZON_INSTANCE_AWSINSTANCETYPE_SERVICE = "spinnaker.amazon.instanceType.service";
10
+ export declare const name = "spinnaker.amazon.instanceType.service";
@@ -0,0 +1,10 @@
1
+ import type { IInstanceTypeCategory, IInstanceTypeFamily } from '@spinnaker/core';
2
+ interface IAwsInstanceTypeCategory extends IInstanceTypeCategory {
3
+ showCpuCredits?: boolean;
4
+ descriptionListOverride?: string[];
5
+ }
6
+ export declare const defaultCategories: IAwsInstanceTypeCategory[];
7
+ export declare const categories: (IAwsInstanceTypeCategory & {
8
+ families: IInstanceTypeFamily[];
9
+ })[];
10
+ export {};
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export interface ICostFactorProps {
3
+ min: number;
4
+ max?: number;
5
+ }
6
+ export declare const CostFactor: ({ min, max }: ICostFactorProps) => JSX.Element;
@@ -3,11 +3,12 @@ import IInjectorService = angular.auto.IInjectorService;
3
3
  import type { FunctionReader } from '@spinnaker/core';
4
4
  import { ReactInject } from '@spinnaker/core';
5
5
  import type { EvaluateCloudFormationChangeSetExecutionService } from '../pipeline/stages/deployCloudFormation/evaluateCloudFormationChangeSetExecution.service';
6
+ import type { AwsServerGroupCommandBuilder } from '../serverGroup/configure/serverGroupCommandBuilder.service';
6
7
  import type { AwsServerGroupConfigurationService } from '../serverGroup/configure/serverGroupConfiguration.service';
7
8
  import type { AwsServerGroupTransformer } from '../serverGroup/serverGroup.transformer';
8
9
  export declare class AwsReactInject extends ReactInject {
9
10
  get awsInstanceTypeService(): any;
10
- get awsServerGroupCommandBuilder(): any;
11
+ get awsServerGroupCommandBuilder(): AwsServerGroupCommandBuilder;
11
12
  get awsServerGroupConfigurationService(): AwsServerGroupConfigurationService;
12
13
  get awsServerGroupTransformer(): AwsServerGroupTransformer;
13
14
  get functionReader(): FunctionReader;
@@ -1,2 +1,2 @@
1
- export const AMAZON_SEARCH_SEARCHRESULTFORMATTER: "spinnaker.amazon.search.searchResultFormatter";
2
- export const name: "spinnaker.amazon.search.searchResultFormatter";
1
+ export declare const AMAZON_SEARCH_SEARCHRESULTFORMATTER = "spinnaker.amazon.search.searchResultFormatter";
2
+ export declare const name = "spinnaker.amazon.search.searchResultFormatter";
@@ -1,2 +1,17 @@
1
- export const AMAZON_SERVERGROUP_CONFIGURE_SERVERGROUPCOMMANDBUILDER_SERVICE: "spinnaker.amazon.serverGroupCommandBuilder.service";
2
- export const name: "spinnaker.amazon.serverGroupCommandBuilder.service";
1
+ import type { Application } from '@spinnaker/core';
2
+ import type { IAmazonServerGroup, IAmazonServerGroupView } from '../../domain';
3
+ import type { IAmazonServerGroupCommand, IAmazonServerGroupDeployConfiguration } from './serverGroupConfiguration.service';
4
+ export declare const AMAZON_SERVERGROUP_CONFIGURE_SERVERGROUPCOMMANDBUILDER_SERVICE = "spinnaker.amazon.serverGroupCommandBuilder.service";
5
+ export declare const name = "spinnaker.amazon.serverGroupCommandBuilder.service";
6
+ export interface AwsServerGroupCommandBuilder {
7
+ buildNewServerGroupCommand(application: Application, defaults?: {
8
+ account?: string;
9
+ region?: string;
10
+ subnet?: string;
11
+ mode?: string;
12
+ }): PromiseLike<Partial<IAmazonServerGroupCommand>>;
13
+ buildServerGroupCommandFromExisting(application: Application, serverGroup: IAmazonServerGroupView, mode?: string): PromiseLike<Partial<IAmazonServerGroupCommand>>;
14
+ buildNewServerGroupCommandForPipeline(): PromiseLike<Partial<IAmazonServerGroupCommand>>;
15
+ buildServerGroupCommandFromPipeline(application: Application, originalCluster: IAmazonServerGroupDeployConfiguration): PromiseLike<Partial<IAmazonServerGroupCommand>>;
16
+ buildUpdateServerGroupCommand(serverGroup: IAmazonServerGroup): Partial<IAmazonServerGroupCommand>;
17
+ }
@@ -19,14 +19,39 @@ export interface IAmazonServerGroupCommandBackingData extends IServerGroupComman
19
19
  scalingProcesses: IScalingProcess[];
20
20
  }
21
21
  export interface IAmazonServerGroupCommandViewState extends IServerGroupCommandViewState {
22
+ isNew: boolean;
22
23
  dirty: IAmazonServerGroupCommandDirty;
23
24
  spelTargetGroups: string[];
24
25
  spelLoadBalancers: string[];
26
+ useSimpleInstanceTypeSelector: boolean;
27
+ }
28
+ export interface IAmazonInstanceTypeOverride {
29
+ instanceType: string;
30
+ weightedCapacity?: string;
31
+ priority?: number;
32
+ }
33
+ /**
34
+ * We model server group commands in two subtly different ways.
35
+ * It's unclear what the intention is, but we should converge on a single model eventually.
36
+ *
37
+ * This model is stored in a Aws Deploy Stage under `clusters[]`.
38
+ * It is also sent across the wire during a deploy task from infrastructure view
39
+ * (i.e., "clone server group", "create server group")
40
+ */
41
+ export interface IAmazonServerGroupDeployConfiguration extends IAmazonServerGroupCommand_Internal {
42
+ account: string;
43
+ availabilityZones: {
44
+ [region: string]: string[];
45
+ };
46
+ }
47
+ interface IAmazonServerGroupCommand_Internal extends IAmazonServerGroupCommand {
48
+ availabilityZones: any;
25
49
  }
26
50
  export interface IAmazonServerGroupCommand extends IServerGroupCommand {
27
51
  associateIPv6Address?: boolean;
28
52
  associatePublicIpAddress: boolean;
29
53
  backingData: IAmazonServerGroupCommandBackingData;
54
+ base64UserData: string;
30
55
  copySourceCustomBlockDeviceMappings: boolean;
31
56
  ebsOptimized: boolean;
32
57
  healthCheckGracePeriod: number;
@@ -41,11 +66,24 @@ export interface IAmazonServerGroupCommand extends IServerGroupCommand {
41
66
  setLaunchTemplate?: boolean;
42
67
  unlimitedCpuCredits?: boolean;
43
68
  capacityRebalance?: boolean;
69
+ ramdiskId?: string;
44
70
  viewState: IAmazonServerGroupCommandViewState;
71
+ source: {
72
+ account: string;
73
+ region: string;
74
+ asgName: string;
75
+ };
76
+ onDemandAllocationStrategy?: string;
77
+ onDemandBaseCapacity?: number;
78
+ onDemandPercentageAboveBaseCapacity?: number;
79
+ spotAllocationStrategy?: string;
80
+ spotInstancePools?: number;
81
+ launchTemplateOverridesForInstanceType?: IAmazonInstanceTypeOverride[];
45
82
  getBlockDeviceMappingsSource: (command: IServerGroupCommand) => IBlockDeviceMappingSource;
46
83
  selectBlockDeviceMappingsSource: (command: IServerGroupCommand, selection: string) => void;
47
84
  usePreferredZonesChanged: (command: IServerGroupCommand) => IAmazonServerGroupCommandResult;
48
85
  regionIsDeprecated: (command: IServerGroupCommand) => boolean;
86
+ launchTemplateOverridesChanged: (command: IServerGroupCommand) => void;
49
87
  }
50
88
  export declare class AwsServerGroupConfigurationService {
51
89
  private securityGroupReader;
@@ -80,3 +118,4 @@ export declare class AwsServerGroupConfigurationService {
80
118
  attachEventHandlers(cmd: IAmazonServerGroupCommand): void;
81
119
  }
82
120
  export declare const AWS_SERVER_GROUP_CONFIGURATION_SERVICE = "spinnaker.amazon.serverGroup.configure.service";
121
+ export {};
@@ -1,9 +1,8 @@
1
1
  /// <reference types="react" />
2
- import type { IAmazonServerGroupCommand } from '../../serverGroupConfiguration.service';
3
2
  export interface ICpuCreditsToggleProps {
4
- command: IAmazonServerGroupCommand;
5
- newInstanceType?: string;
6
- newProfileType?: string;
3
+ unlimitedCpuCredits?: boolean;
4
+ selectedInstanceTypes: string[];
5
+ currentProfile: string;
7
6
  setUnlimitedCpuCredits: (unlimitedCpuCredits: boolean | undefined) => void;
8
7
  }
9
8
  export declare function CpuCreditsToggle(props: ICpuCreditsToggleProps): JSX.Element;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import type { FormikProps } from 'formik/dist/types';
3
+ import type { IInstanceTypeCategory } from '@spinnaker/core';
4
+ import type { IAmazonServerGroupCommand } from '../../serverGroupConfiguration.service';
5
+ export interface IInstanceTypeSelectorProps {
6
+ formik: FormikProps<IAmazonServerGroupCommand>;
7
+ instanceTypeDetails: IInstanceTypeCategory[];
8
+ }
9
+ export declare function InstanceTypeSelector(props: IInstanceTypeSelectorProps): JSX.Element;
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import type { FormikProps } from 'formik/dist/types';
3
+ import type { IAmazonInstanceTypeCategory } from '../../../../../instance/awsInstanceType.service';
4
+ import type { IAmazonServerGroupCommand } from '../../../serverGroupConfiguration.service';
5
+ export interface IAdvancedModeSelectorProps {
6
+ formik: FormikProps<IAmazonServerGroupCommand>;
7
+ instanceTypeDetails: IAmazonInstanceTypeCategory[];
8
+ setUnlimitedCpuCredits: (unlimitedCpuCredits: boolean | undefined) => void;
9
+ }
10
+ /**
11
+ * Note: Launch templates support is expected to be enabled if this component is rendered.
12
+ */
13
+ export declare function AdvancedModeSelector(props: IAdvancedModeSelectorProps): JSX.Element;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import type { IAmazonInstanceTypeCategory } from '../../../../../instance/awsInstanceType.service';
3
+ import './advancedMode.less';
4
+ export interface IInstanceProfileSelectorProps {
5
+ currentProfile: string;
6
+ handleProfileChange: (profile: string) => void;
7
+ instanceProfileList: IAmazonInstanceTypeCategory[];
8
+ }
9
+ export declare function InstanceProfileSelector(props: IInstanceProfileSelectorProps): JSX.Element;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import type { IAmazonPreferredInstanceType } from '../../../../../instance/awsInstanceType.service';
3
+ import type { IAmazonInstanceTypeOverride } from '../../../serverGroupConfiguration.service';
4
+ export interface IRowProps {
5
+ isCustom: boolean;
6
+ selectedType?: IAmazonInstanceTypeOverride;
7
+ instanceTypeDetails?: IAmazonPreferredInstanceType;
8
+ removeInstanceType?: (typeToRemove: string) => void;
9
+ addOrUpdateInstanceType: (instanceType: string, weight: string) => void;
10
+ }
11
+ export declare function InstanceTypeRow(props: IRowProps): JSX.Element;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import type { IAmazonInstanceTypeCategory } from '../../../../../instance/awsInstanceType.service';
3
+ import type { IAmazonInstanceTypeOverride } from '../../../serverGroupConfiguration.service';
4
+ import './advancedMode.less';
5
+ export interface IInstanceTypeTableProps {
6
+ currentProfile: string;
7
+ selectedInstanceTypesMap: Map<string, IAmazonInstanceTypeOverride>;
8
+ unlimitedCpuCreditsInCmd: boolean;
9
+ profileDetails: IAmazonInstanceTypeCategory;
10
+ availableInstanceTypesList: string[];
11
+ handleInstanceTypesChange: (instanceTypes: IAmazonInstanceTypeOverride[]) => void;
12
+ setUnlimitedCpuCredits: (unlimitedCpuCredits: boolean | undefined) => void;
13
+ }
14
+ export declare function InstanceTypeTable(props: IInstanceTypeTableProps): JSX.Element;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import type { SortEnd } from 'react-sortable-hoc';
3
+ import type { IInstanceTypeFamily } from '@spinnaker/core';
4
+ import type { IAmazonInstanceTypeOverride } from '../../../serverGroupConfiguration.service';
5
+ export declare function InstanceTypeTableBody(props: {
6
+ isCustom: boolean;
7
+ profileFamiliesDetails?: IInstanceTypeFamily[];
8
+ selectedInstanceTypesMap: Map<string, IAmazonInstanceTypeOverride>;
9
+ addOrUpdateInstanceType: (instanceType: string, weight: string) => void;
10
+ removeInstanceType: (instanceType: string) => void;
11
+ handleSortEnd: (sortEnd: SortEnd) => void;
12
+ }): JSX.Element;
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ export declare function Heading(props: {
3
+ isCustom: boolean;
4
+ profileLabel?: string;
5
+ profileDescriptionArr?: string[];
6
+ }): JSX.Element;
7
+ export declare function Header(props: {
8
+ isCustom: boolean;
9
+ showCpuCredits?: boolean;
10
+ }): JSX.Element;
11
+ export declare function Footer(props: {
12
+ isCustom: boolean;
13
+ availableInstanceTypesList: string[];
14
+ addOrUpdateInstanceType: (type: string, weight: string) => void;
15
+ }): JSX.Element;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import type { FormikProps } from 'formik';
3
+ import type { IAmazonServerGroupCommand } from '../../../serverGroupConfiguration.service';
4
+ import './InstancesDistribution.less';
5
+ export interface IInstancesDistributionProps {
6
+ formik: FormikProps<IAmazonServerGroupCommand>;
7
+ }
8
+ export declare function InstancesDistribution(props: IInstancesDistributionProps): JSX.Element;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import type { IAmazonServerGroupCommand } from '../../../serverGroupConfiguration.service';
3
+ export interface ISimpleModeSelectorProps {
4
+ command: IAmazonServerGroupCommand;
5
+ setUnlimitedCpuCredits: (unlimitedCpuCredits: boolean | undefined) => void;
6
+ setFieldValue: (field: keyof IAmazonServerGroupCommand, value: any, shouldValidate?: boolean) => void;
7
+ }
8
+ export declare function SimpleModeSelector(props: ISimpleModeSelectorProps): JSX.Element;
@@ -1,19 +1,22 @@
1
1
  import type { FormikErrors, FormikProps } from 'formik';
2
2
  import React from 'react';
3
3
  import type { IWizardPageComponent } from '@spinnaker/core';
4
+ import type { IAmazonInstanceTypeCategory } from '../../../../instance/awsInstanceType.service';
4
5
  import type { IAmazonServerGroupCommand } from '../../serverGroupConfiguration.service';
5
6
  export interface IServerGroupInstanceTypeProps {
6
7
  formik: FormikProps<IAmazonServerGroupCommand>;
7
8
  }
8
9
  export interface IServerGroupInstanceTypeState {
9
- newInstanceType?: string;
10
- newProfileType?: string;
10
+ instanceTypeDetails: IAmazonInstanceTypeCategory[];
11
11
  }
12
12
  export declare class ServerGroupInstanceType extends React.Component<IServerGroupInstanceTypeProps, IServerGroupInstanceTypeState> implements IWizardPageComponent<IAmazonServerGroupCommand> {
13
- constructor(props: IServerGroupInstanceTypeProps);
13
+ state: IServerGroupInstanceTypeState;
14
+ private props$;
15
+ private destroy$;
14
16
  validate(values: IAmazonServerGroupCommand): FormikErrors<IAmazonServerGroupCommand>;
15
- private instanceProfileChanged;
16
- private instanceTypeChanged;
17
- private setUnlimitedCpuCredits;
17
+ private validateAdvancedModeFields;
18
+ componentDidMount(): void;
19
+ componentDidUpdate(): void;
20
+ componentWillUnmount(): void;
18
21
  render(): JSX.Element;
19
22
  }
@@ -1,3 +1,4 @@
1
+ import type { IAmazonServerGroupCommand, IAmazonServerGroupDeployConfiguration } from './configure';
1
2
  import type { IAmazonServerGroup, IAmazonServerGroupView, IScalingPolicy, IScalingPolicyView, ITargetTrackingPolicy } from '../domain';
2
3
  export declare class AwsServerGroupTransformer {
3
4
  private addComparator;
@@ -6,7 +7,7 @@ export declare class AwsServerGroupTransformer {
6
7
  normalizeServerGroupDetails(serverGroup: IAmazonServerGroup): IAmazonServerGroupView;
7
8
  normalizeServerGroup(serverGroup: IAmazonServerGroup): PromiseLike<IAmazonServerGroup>;
8
9
  private addVpcNameToServerGroup;
9
- convertServerGroupCommandToDeployConfiguration(base: any): any;
10
+ convertServerGroupCommandToDeployConfiguration(base: IAmazonServerGroupCommand): IAmazonServerGroupDeployConfiguration;
10
11
  constructNewStepScalingPolicyTemplate(serverGroup: IAmazonServerGroup): IScalingPolicy;
11
12
  constructNewTargetTrackingPolicyTemplate(): ITargetTrackingPolicy;
12
13
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spinnaker/amazon",
3
3
  "license": "Apache-2.0",
4
- "version": "0.11.1",
4
+ "version": "0.12.3",
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.14.2",
16
+ "@spinnaker/core": "^0.16.1",
17
17
  "@uirouter/angularjs": "1.0.26",
18
18
  "@uirouter/core": "6.0.8",
19
19
  "@uirouter/react": "1.0.7",
@@ -39,9 +39,9 @@
39
39
  "rxjs": "6.6.7"
40
40
  },
41
41
  "devDependencies": {
42
- "@spinnaker/eslint-plugin": "^3.0.0",
42
+ "@spinnaker/eslint-plugin": "^3.0.1",
43
43
  "@spinnaker/mocks": "1.0.7",
44
- "@spinnaker/scripts": "^0.2.2",
44
+ "@spinnaker/scripts": "^0.2.4",
45
45
  "@types/angular": "1.6.26",
46
46
  "@types/angular-ui-bootstrap": "0.13.41",
47
47
  "@types/classnames": "2.2.0",
@@ -55,5 +55,5 @@
55
55
  "shx": "0.3.3",
56
56
  "typescript": "4.3.5"
57
57
  },
58
- "gitHead": "dbd5c6c7f9a3f282cd2534887caf132835cf49e2"
58
+ "gitHead": "17b98201c6de43729a39f6d205656d0c4be1db16"
59
59
  }
@@ -39,7 +39,7 @@ export interface ILicenseConfig {
39
39
  export interface IMetadataOptions {
40
40
  httpEndpoint?: 'disabled' | 'enabled';
41
41
  httpPutResponseHopLimit?: number;
42
- httpsTokens?: 'required' | 'optional';
42
+ httpTokens?: 'required' | 'optional';
43
43
  state?: 'pending' | 'applied';
44
44
  }
45
45
 
@@ -5,16 +5,27 @@ import type { IScalingPolicyView } from './IAmazonScalingPolicy';
5
5
  import type { IScalingPolicy } from './IScalingPolicy';
6
6
  import type { ISuspendedProcess } from './IScalingProcess';
7
7
 
8
+ export interface IAmazonAsgTag {
9
+ key: string;
10
+ value: string;
11
+ propagateAtLaunch: boolean;
12
+ resourceId: string;
13
+ resourceType: string;
14
+ }
15
+
8
16
  export interface IAmazonAsg extends IAsg {
9
17
  availabilityZones: string[];
18
+ autoScalingGroupName: string;
10
19
  defaultCooldown: number;
11
20
  healthCheckType: string;
12
21
  healthCheckGracePeriod: number;
22
+ loadBalancerNames: string[];
13
23
  terminationPolicies: string[];
14
24
  enabledMetrics: Array<{ metric: string }>;
15
25
  vpczoneIdentifier?: string;
16
26
  suspendedProcesses?: ISuspendedProcess[];
17
27
  capacityRebalance?: boolean;
28
+ tags: IAmazonAsgTag[];
18
29
  }
19
30
 
20
31
  export interface IAmazonServerGroup extends IServerGroup {
@@ -1,16 +1,17 @@
1
- import React from 'react';
2
1
  import { shallow } from 'enzyme';
2
+ import React from 'react';
3
3
 
4
- import { Application } from '@spinnaker/core';
4
+ import type { Application } from '@spinnaker/core';
5
5
 
6
- import { IAmazonFunction, FunctionActions } from '../../index';
7
6
  import { AWSProviderSettings } from '../../aws.settings';
7
+ import type { IAmazonFunction } from '../../index';
8
+ import { FunctionActions } from '../../index';
8
9
 
9
10
  describe('FunctionActions', () => {
10
11
  it('should render correct state when all attributes exist', () => {
11
- let app = { name: 'app' } as Application;
12
+ const app = { name: 'app' } as Application;
12
13
 
13
- let functionDef = { functionName: 'app-function' } as IAmazonFunction;
14
+ const functionDef = { functionName: 'app-function' } as IAmazonFunction;
14
15
  AWSProviderSettings.adHocInfraWritesEnabled = true;
15
16
 
16
17
  const wrapper = shallow(
@@ -25,15 +26,15 @@ describe('FunctionActions', () => {
25
26
  />,
26
27
  );
27
28
 
28
- let dropDown = wrapper.find('DropdownToggle');
29
+ const dropDown = wrapper.find('DropdownToggle');
29
30
 
30
31
  expect(dropDown.childAt(0).text()).toEqual('Function Actions');
31
32
  });
32
33
 
33
34
  it('should not render DropdownToggle if aws.adHocInfraWritesEnabled is false', () => {
34
- let app = { name: 'app' } as Application;
35
+ const app = { name: 'app' } as Application;
35
36
 
36
- let functionDef = { functionName: 'app-function' } as IAmazonFunction;
37
+ const functionDef = { functionName: 'app-function' } as IAmazonFunction;
37
38
  AWSProviderSettings.adHocInfraWritesEnabled = false;
38
39
 
39
40
  const wrapper = shallow(
@@ -48,7 +49,7 @@ describe('FunctionActions', () => {
48
49
  />,
49
50
  );
50
51
 
51
- let dropDown = wrapper.find('div');
52
+ const dropDown = wrapper.find('div');
52
53
  expect(dropDown.children().length).toEqual(0);
53
54
  });
54
55
  });
@@ -59,18 +59,20 @@ const helpContents: { [key: string]: string } = {
59
59
  '(Optional) <b>Detail</b> is a string of free-form alphanumeric characters and hyphens to describe any other variables.',
60
60
  'aws.serverGroup.imageName':
61
61
  '(Required) <b>Image</b> is the deployable Amazon Machine Image. Images are restricted to the account and region selected.',
62
+ 'aws.serverGroup.storageType': `AWS offers various storage options like temporary block-level storage via instance store (SSD, HDD) and Amazon Elastic Block Store (EBS). This column lists the storage type supported for the instance type.`,
63
+ 'aws.serverGroup.instancesDistribution': `Learn more in <a target="_blank" href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-purchase-options.html">AWS docs</a>.`,
62
64
  'aws.serverGroup.spotMaxPrice':
63
- 'The maximum price per unit hour to pay for a Spot instance. By default (empty), Amazon EC2 Auto Scaling uses the On-Demand price as the maximum Spot price',
65
+ 'The maximum price per unit hour to pay for a Spot instance. By <b>default (empty)</b>, Amazon EC2 Auto Scaling uses the On-Demand price as the maximum Spot price.',
64
66
  'aws.serverGroup.spotAllocationStrategy': `<p>Indicates how to allocate instances across Spot Instance pools.</p>
65
67
  <ul>
66
68
  <li><b>capacity-optimized (recommended)</b>: Instances launched using Spot pools that are optimally chosen based on the available Spot capacity.</li>
67
69
  <li><b>capacity-optimized-prioritized</b>: Instances launched using the priority on a best-effort basis to determine which launch template override to use first, but AWS optimizes for capacity first.</li>
68
- <li><b>lowest-price</b>: Instances launched using Spot pools with the lowest price, and evenly allocated across the number of Spot pools specified</li>
70
+ <li><b>lowest-price (default)</b>: Instances launched using Spot pools with the lowest price, and evenly allocated across the number of Spot pools specified</li>
69
71
  </ul>`,
70
- 'aws.serverGroup.spotInstancePoolCount': `Number of lowest priced Spot Instance pools to diversify across. Only applicable for strategy 'lowest-price'.`,
71
- 'aws.serverGroup.odAllocationStrategy': `The only strategy / default is 'prioritized'. The order of instance types in the list of launch template overrides is used to determine which instance type to use first when fulfilling On-Demand capacity.`,
72
- 'aws.serverGroup.odBase': `Minimum amount of the Auto Scaling Group's capacity that must be fulfilled by On-Demand Instances. This base portion is provisioned first as the group scales.`,
73
- 'aws.serverGroup.odPercentAboveBase': `Percentages of On-Demand and Spot instances for additional capacity beyond OnDemandBaseCapacity.`,
72
+ 'aws.serverGroup.spotInstancePoolCount': `Number of lowest priced Spot Instance pools to diversify across. Only applicable for strategy 'lowest-price'. <b>Default: 2.</b>`,
73
+ 'aws.serverGroup.odAllocationStrategy': `The only strategy / <b>default is 'prioritized'</b>. The order specified in the list of selected instance types is used to determine which instance type to use first when fulfilling On-Demand capacity.`,
74
+ 'aws.serverGroup.odBase': `Minimum amount of the Auto Scaling Group's capacity that must be fulfilled by On-Demand Instances. This base portion is provisioned first as the group scales. <b>Default: 0.</b>`,
75
+ 'aws.serverGroup.odPercentAboveBase': `Percentages of On-Demand and Spot instances for additional capacity beyond OnDemandBaseCapacity.<b>Default: 100.</b>`,
74
76
  'aws.serverGroup.instanceTypeWeight': `The number of capacity units gives the instance type a proportional weight to other instance types. When specified, weights count towards desired capacity.`,
75
77
  'aws.serverGroup.instanceTypes': `Specify up to 20 instance types.`,
76
78
  'aws.serverGroup.multipleInstanceTypes': `Instance types a server group can launch, first (highest priority) to last (lowest priority).`,
@@ -82,6 +84,7 @@ const helpContents: { [key: string]: string } = {
82
84
  To burst above the baseline, the instance spends credits that it has accrued in its CPU credit balance.</li>
83
85
  </ul>`,
84
86
  'aws.serverGroup.capacityRebalance': `Enabling <b>Capacity Rebalance</b> allows EC2 Auto Scaling to proactively replace Spot Instances that have received a rebalance recommendation, <b>before</b> it is interrupted by AWS EC2.`,
87
+ 'aws.serverGroup.advancedMode': `Advanced mode allows you to configure allocation strategies, multiple instance types with weighting, instance distribution across Spot / On-Demand and their proportions in the server group. Learn more in <a target="_blank" href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-purchase-options.html">AWS docs</a>.`,
85
88
  'aws.serverGroup.legacyUdf': `<p>(Optional) <b>User Data Format</b> allows overriding of the format used when generating user data during deployment. The default format used is configured
86
89
  in the application's attributes, editable via the 'Config' tab.</p>
87
90
  <p><b>Default</b> will use the value from the application's configuration.</p>
@@ -0,0 +1,75 @@
1
+ import { mock } from 'angular';
2
+ import { $rootScope } from 'ngimport';
3
+ // eslint-disable-next-line @spinnaker/import-from-npm-not-relative
4
+ import { mockHttpClient } from '../../../core/src/api/mock/jasmine';
5
+ import { AwsImageReader } from './image.reader';
6
+
7
+ describe('Service: aws Image Reader', function () {
8
+ let service: AwsImageReader;
9
+
10
+ beforeEach(() => (service = new AwsImageReader()));
11
+ beforeEach(mock.inject());
12
+
13
+ describe('findImages', function () {
14
+ const region = 'us-west-2';
15
+ const buildQueryString = (query: string, region: string) => `/images/find?q=${query}&region=${region}`;
16
+
17
+ it('queries gate when 3 characters are supplied', async function () {
18
+ const q = 'que';
19
+ const http = mockHttpClient({ autoFlush: true });
20
+ http.expectGET(buildQueryString(q, region)).respond(200, [{ success: true }]);
21
+ const result = await service.findImages({ q, region });
22
+
23
+ expect(result.length).toBe(1);
24
+ expect((result[0] as any).success).toBe(true);
25
+ });
26
+
27
+ it('queries gate when more than 3 characters are supplied', async function () {
28
+ const q = 'abcd';
29
+ const http = mockHttpClient({ autoFlush: true });
30
+ http.expectGET(buildQueryString(q, region)).respond(200, [{ success: true }]);
31
+ const result = await service.findImages({ q, region });
32
+ expect(result.length).toBe(1);
33
+ expect((result[0] as any).success).toBe(true);
34
+ });
35
+
36
+ it('returns a message prompting user to enter more characters when less than 3 are supplied', async function () {
37
+ const q = 'ab';
38
+ let result: any;
39
+ service.findImages({ q, region }).then((response) => (result = response));
40
+ $rootScope.$digest();
41
+ expect(result.length).toBe(1);
42
+ expect((result[0] as any).message).toBe('Please enter at least 3 characters...');
43
+ });
44
+
45
+ it('returns an empty array when server errors', async function () {
46
+ const q = 'abc';
47
+ const http = mockHttpClient({ autoFlush: true });
48
+ http.expectGET(buildQueryString(q, region)).respond(404, {});
49
+ const result = await service.findImages({ q, region });
50
+ expect(result.length).toBe(0);
51
+ });
52
+ });
53
+
54
+ describe('getImage', function () {
55
+ const imageName = 'abc';
56
+ const region = 'us-west-1';
57
+ const credentials = 'test';
58
+
59
+ const buildQueryString = () => `/images/${credentials}/${region}/${imageName}?provider=aws`;
60
+
61
+ it('returns null if server returns 404', async function () {
62
+ const http = mockHttpClient({ autoFlush: true });
63
+ http.expectGET(buildQueryString()).respond(404, {});
64
+ const result = await service.getImage(imageName, region, credentials);
65
+ expect(result).toBe(null);
66
+ });
67
+
68
+ it('returns null if server returns an empty list', async function () {
69
+ const http = mockHttpClient({ autoFlush: true });
70
+ http.expectGET(buildQueryString()).respond(200, []);
71
+ const result2 = await service.getImage(imageName, region, credentials);
72
+ expect(result2).toBe(null);
73
+ });
74
+ });
75
+ });