@spinnaker/amazon 0.11.0 → 0.12.2

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 (116) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/aws.settings.d.ts +1 -0
  3. package/dist/index.js +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/instance/awsInstanceType.service.d.ts +10 -2
  6. package/dist/instance/awsInstanceTypes.d.ts +10 -0
  7. package/dist/instance/details/CostFactor.d.ts +6 -0
  8. package/dist/search/searchResultFormatter.d.ts +2 -2
  9. package/dist/serverGroup/configure/serverGroupConfiguration.service.d.ts +14 -1
  10. package/dist/serverGroup/configure/wizard/instanceType/CpuCreditsToggle.d.ts +3 -4
  11. package/dist/serverGroup/configure/wizard/instanceType/InstanceTypeSelector.d.ts +9 -0
  12. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/AdvancedModeSelector.d.ts +13 -0
  13. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceProfileSelector.d.ts +9 -0
  14. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeRow.d.ts +11 -0
  15. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTable.d.ts +14 -0
  16. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTableBody.d.ts +12 -0
  17. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTableParts.d.ts +15 -0
  18. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstancesDistribution.d.ts +8 -0
  19. package/dist/serverGroup/configure/wizard/instanceType/simpleMode/SimpleModeSelector.d.ts +8 -0
  20. package/dist/serverGroup/configure/wizard/pages/ServerGroupInstanceType.d.ts +9 -6
  21. package/dist/serverGroup/details/scalingPolicy/ScalingPolicySummary.d.ts +0 -1
  22. package/dist/serverGroup/details/scalingPolicy/chart/MetricAlarmChart.d.ts +0 -4
  23. package/dist/serverGroup/details/scalingPolicy/index.d.ts +0 -1
  24. package/dist/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingChart.d.ts +1 -3
  25. package/package.json +5 -5
  26. package/src/aws.module.ts +3 -3
  27. package/src/aws.settings.ts +2 -0
  28. package/src/function/details/FunctionActions.spec.tsx +15 -12
  29. package/src/function/details/FunctionActions.tsx +2 -1
  30. package/src/help/amazon.help.ts +9 -6
  31. package/src/image/image.reader.spec.ts +75 -0
  32. package/src/instance/awsInstanceType.service.spec.js +37 -71
  33. package/src/instance/awsInstanceType.service.ts +191 -0
  34. package/src/instance/awsInstanceTypes.ts +311 -0
  35. package/src/instance/details/CostFactor.tsx +29 -0
  36. package/src/instance/details/InstanceInformation.spec.tsx +2 -1
  37. package/src/instance/details/instance.details.controller.js +472 -473
  38. package/src/loadBalancer/details/LoadBalancerActions.tsx +2 -1
  39. package/src/loadBalancer/details/loadBalancerDetails.controller.spec.ts +5 -3
  40. package/src/search/{searchResultFormatter.js → searchResultFormatter.ts} +5 -4
  41. package/src/securityGroup/details/securityGroupDetail.controller.js +2 -1
  42. package/src/serverGroup/configure/AmazonImageSelectInput.spec.tsx +10 -7
  43. package/src/serverGroup/configure/serverGroupCommandBuilder.aws.service.spec.js +302 -1
  44. package/src/serverGroup/configure/serverGroupCommandBuilder.service.js +96 -24
  45. package/src/serverGroup/configure/serverGroupCommandBuilder.spec.js +25 -8
  46. package/src/serverGroup/configure/serverGroupConfiguration.service.spec.ts +6 -13
  47. package/src/serverGroup/configure/serverGroupConfiguration.service.ts +26 -1
  48. package/src/serverGroup/configure/wizard/AmazonCloneServerGroupModal.tsx +1 -1
  49. package/src/serverGroup/configure/wizard/instanceType/CpuCreditsToggle.tsx +31 -31
  50. package/src/serverGroup/configure/wizard/instanceType/InstanceTypeSelector.tsx +133 -0
  51. package/src/serverGroup/configure/wizard/instanceType/advancedMode/AdvancedModeSelector.tsx +99 -0
  52. package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstanceProfileSelector.tsx +36 -0
  53. package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeRow.tsx +144 -0
  54. package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTable.tsx +137 -0
  55. package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTableBody.tsx +135 -0
  56. package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTableParts.tsx +137 -0
  57. package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstancesDistribution.less +5 -0
  58. package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstancesDistribution.tsx +108 -0
  59. package/src/serverGroup/configure/wizard/instanceType/advancedMode/advancedMode.less +110 -0
  60. package/src/serverGroup/configure/wizard/instanceType/simpleMode/SimpleModeSelector.tsx +62 -0
  61. package/src/serverGroup/configure/wizard/pages/ServerGroupInstanceType.tsx +106 -62
  62. package/src/serverGroup/configure/wizard/pages/advancedSettings/ServerGroupAdvancedSettingsCommon.tsx +1 -1
  63. package/src/serverGroup/details/AmazonServerGroupActions.tsx +2 -1
  64. package/src/serverGroup/details/scalingPolicy/ScalingPolicySummary.tsx +7 -3
  65. package/src/serverGroup/details/scalingPolicy/StepPolicySummary.tsx +26 -28
  66. package/src/serverGroup/details/scalingPolicy/chart/MetricAlarmChart.tsx +1 -25
  67. package/src/serverGroup/details/scalingPolicy/index.ts +0 -1
  68. package/src/serverGroup/details/scalingPolicy/scalingPolicy.module.ts +1 -9
  69. package/src/serverGroup/details/scalingPolicy/scalingPolicySummary.component.ts +6 -2
  70. package/src/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingChart.tsx +2 -17
  71. package/src/serverGroup/details/scalingPolicy/upsert/alarm/AlarmConfigurer.less +1 -1
  72. package/src/serverGroup/details/scalingProcesses/AutoScalingProcessService.spec.ts +1 -2
  73. package/src/serverGroup/details/sections/AdvancedSettingsDetailsSection.tsx +3 -2
  74. package/src/serverGroup/details/sections/AmazonCapacityDetailsSection.tsx +3 -8
  75. package/src/serverGroup/details/sections/InstancesDistributionDetailsSection.spec.tsx +8 -5
  76. package/src/serverGroup/details/sections/LaunchTemplateDetailsSection.spec.tsx +8 -5
  77. package/src/serverGroup/details/sections/ScalingPoliciesDetailsSection.tsx +3 -3
  78. package/src/serverGroup/details/sections/ScalingProcessesDetailsSection.tsx +3 -10
  79. package/src/serverGroup/details/sections/ScheduledActionsDetailsSection.tsx +3 -2
  80. package/src/serverGroup/details/sections/SecurityGroupsDetailsSection.tsx +3 -2
  81. package/src/serverGroup/serverGroup.transformer.spec.ts +5 -3
  82. package/src/subnet/SubnetSelectInput.spec.tsx +7 -4
  83. package/src/vpc/{VpcReader.spec.js → VpcReader.spec.ts} +2 -10
  84. package/src/vpc/VpcTag.spec.tsx +37 -0
  85. package/src/vpc/vpc.module.ts +6 -2
  86. package/dist/reactShims/aws.ngReact.d.ts +0 -11
  87. package/dist/serverGroup/details/scalingPolicy/ScalingPolicyTypeRegistry.d.ts +0 -10
  88. package/dist/serverGroup/details/scalingPolicy/alarmBasedSummary.component.d.ts +0 -2
  89. package/dist/serverGroup/details/scalingPolicy/detailsSummary.component.d.ts +0 -12
  90. package/dist/serverGroup/details/scalingPolicy/popover/scalingPolicyPopover.component.d.ts +0 -1
  91. package/dist/serverGroup/details/scalingPolicy/stepPolicySummary.component.d.ts +0 -1
  92. package/dist/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingPolicy.config.d.ts +0 -1
  93. package/dist/serverGroup/details/scalingPolicy/targetTracking/targetTracking.module.d.ts +0 -2
  94. package/dist/serverGroup/details/scalingPolicy/targetTracking/targetTrackingChart.component.d.ts +0 -1
  95. package/dist/serverGroup/details/scalingPolicy/targetTracking/targetTrackingSummary.component.d.ts +0 -1
  96. package/dist/vpc/vpcTag.directive.d.ts +0 -2
  97. package/src/image/image.reader.spec.js +0 -123
  98. package/src/instance/awsInstanceType.service.js +0 -437
  99. package/src/reactShims/aws.ngReact.ts +0 -27
  100. package/src/serverGroup/details/scalingPolicy/ScalingPolicyTypeRegistry.ts +0 -18
  101. package/src/serverGroup/details/scalingPolicy/alarmBasedSummary.component.html +0 -35
  102. package/src/serverGroup/details/scalingPolicy/alarmBasedSummary.component.js +0 -60
  103. package/src/serverGroup/details/scalingPolicy/alarmBasedSummary.template.html +0 -5
  104. package/src/serverGroup/details/scalingPolicy/detailsSummary.component.ts +0 -32
  105. package/src/serverGroup/details/scalingPolicy/popover/scalingPolicyDetails.popover.html +0 -1
  106. package/src/serverGroup/details/scalingPolicy/popover/scalingPolicyPopover.component.html +0 -107
  107. package/src/serverGroup/details/scalingPolicy/popover/scalingPolicyPopover.component.ts +0 -31
  108. package/src/serverGroup/details/scalingPolicy/scalingPolicySummary.component.less +0 -15
  109. package/src/serverGroup/details/scalingPolicy/stepPolicySummary.component.ts +0 -10
  110. package/src/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingPolicy.config.ts +0 -6
  111. package/src/serverGroup/details/scalingPolicy/targetTracking/targetTracking.module.ts +0 -8
  112. package/src/serverGroup/details/scalingPolicy/targetTracking/targetTrackingChart.component.ts +0 -16
  113. package/src/serverGroup/details/scalingPolicy/targetTracking/targetTrackingSummary.component.ts +0 -14
  114. package/src/serverGroup/details/scalingPolicy/targetTracking/targetTrackingSummary.html +0 -5
  115. package/src/vpc/vpcTag.directive.js +0 -34
  116. 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;
@@ -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";
@@ -22,8 +22,15 @@ export interface IAmazonServerGroupCommandViewState extends IServerGroupCommandV
22
22
  dirty: IAmazonServerGroupCommandDirty;
23
23
  spelTargetGroups: string[];
24
24
  spelLoadBalancers: string[];
25
+ useSimpleInstanceTypeSelector: boolean;
26
+ }
27
+ export interface IAmazonInstanceTypeOverride {
28
+ instanceType: string;
29
+ weightedCapacity?: number;
30
+ priority?: number;
25
31
  }
26
32
  export interface IAmazonServerGroupCommand extends IServerGroupCommand {
33
+ viewState: IAmazonServerGroupCommandViewState;
27
34
  associateIPv6Address?: boolean;
28
35
  associatePublicIpAddress: boolean;
29
36
  backingData: IAmazonServerGroupCommandBackingData;
@@ -41,11 +48,17 @@ export interface IAmazonServerGroupCommand extends IServerGroupCommand {
41
48
  setLaunchTemplate?: boolean;
42
49
  unlimitedCpuCredits?: boolean;
43
50
  capacityRebalance?: boolean;
44
- viewState: IAmazonServerGroupCommandViewState;
51
+ onDemandAllocationStrategy?: string;
52
+ onDemandBaseCapacity?: number;
53
+ onDemandPercentageAboveBaseCapacity?: number;
54
+ spotAllocationStrategy?: string;
55
+ spotInstancePools?: number;
56
+ launchTemplateOverridesForInstanceType?: IAmazonInstanceTypeOverride[];
45
57
  getBlockDeviceMappingsSource: (command: IServerGroupCommand) => IBlockDeviceMappingSource;
46
58
  selectBlockDeviceMappingsSource: (command: IServerGroupCommand, selection: string) => void;
47
59
  usePreferredZonesChanged: (command: IServerGroupCommand) => IAmazonServerGroupCommandResult;
48
60
  regionIsDeprecated: (command: IServerGroupCommand) => boolean;
61
+ launchTemplateOverridesChanged: (command: IServerGroupCommand) => void;
49
62
  }
50
63
  export declare class AwsServerGroupConfigurationService {
51
64
  private securityGroupReader;
@@ -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,7 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { Application, IServerGroup } from '@spinnaker/core';
3
3
  import type { IScalingPolicyView } from '../../../domain';
4
- import './scalingPolicySummary.component.less';
5
4
  export interface IScalingPolicySummaryProps {
6
5
  application: Application;
7
6
  policy: IScalingPolicyView;
@@ -1,15 +1,11 @@
1
1
  /// <reference types="react" />
2
- import type { Observable } from 'rxjs';
3
2
  import type { ICloudMetricStatistics } from '@spinnaker/core';
4
3
  import type { IAmazonServerGroup, IScalingPolicyAlarm } from '../../../../domain';
5
4
  interface IMetricAlarmChartProps {
6
5
  serverGroup: IAmazonServerGroup;
7
6
  alarm: IScalingPolicyAlarm;
8
- alarmUpdated?: Observable<any>;
9
7
  onChartLoaded?: (stats: ICloudMetricStatistics) => void;
10
8
  }
11
9
  export declare function MetricAlarmChart(props: IMetricAlarmChartProps): JSX.Element;
12
10
  export declare function MetricAlarmChartImpl(props: IMetricAlarmChartProps): JSX.Element;
13
- export declare const AMAZON_SERVERGROUP_DETAILS_SCALINGPOLICY_CHART_METRICALARMCHART_COMPONENT = "spinnaker.amazon.serverGroup.details.scalingPolicy.metricAlarmChart.component";
14
- export declare const name = "spinnaker.amazon.serverGroup.details.scalingPolicy.metricAlarmChart.component";
15
11
  export {};
@@ -1,6 +1,5 @@
1
1
  export { DateLineChart } from './chart/DateLineChart';
2
2
  export { MetricAlarmChart } from './chart/MetricAlarmChart';
3
- export * from './ScalingPolicyTypeRegistry';
4
3
  export * from './CreateScalingPolicyButton';
5
4
  export * from './ScalingPolicyWriter';
6
5
  export * from './StepPolicySummary';
@@ -1,11 +1,9 @@
1
1
  /// <reference types="react" />
2
- import { Subject } from 'rxjs';
3
2
  import type { IAmazonServerGroup, ITargetTrackingConfiguration } from '../../../../domain';
4
3
  export interface ITargetTrackingChartProps {
5
- alarmUpdated?: Subject<void>;
6
4
  config: ITargetTrackingConfiguration;
7
5
  serverGroup: IAmazonServerGroup;
8
6
  unit?: string;
9
7
  updateUnit?: (unit: string) => void;
10
8
  }
11
- export declare const TargetTrackingChart: ({ alarmUpdated, config, serverGroup, updateUnit, }: ITargetTrackingChartProps) => JSX.Element;
9
+ export declare const TargetTrackingChart: ({ config, serverGroup, updateUnit }: ITargetTrackingChartProps) => JSX.Element;
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.0",
4
+ "version": "0.12.2",
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.1",
16
+ "@spinnaker/core": "^0.16.0",
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": "b36e5fa30e23cd60007e6839b0dab5e41bd410d5"
58
+ "gitHead": "59026ea6af7b81ffb8e8c59e18f43396906ddafb"
59
59
  }
package/src/aws.module.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { module } from 'angular';
2
2
 
3
- import { CloudProviderRegistry, DeploymentStrategyRegistry, SETTINGS } from '@spinnaker/core';
3
+ import { CloudProviderRegistry, DeploymentStrategyRegistry } from '@spinnaker/core';
4
4
 
5
+ import { AWSProviderSettings } from './aws.settings';
5
6
  import { COMMON_MODULE } from './common/common.module';
6
7
  import './deploymentStrategy/rollingPush.strategy';
7
8
  import { AmazonFunctionDetails } from './function';
@@ -52,7 +53,6 @@ import {
52
53
  AmazonUpsertTargetTrackingModal,
53
54
  TargetTrackingChart,
54
55
  } from './serverGroup/details/scalingPolicy';
55
-
56
56
  import {
57
57
  AdvancedSettingsDetailsSection,
58
58
  AmazonCapacityDetailsSection,
@@ -117,7 +117,7 @@ module(AMAZON_MODULE, [
117
117
  ]).config(() => {
118
118
  CloudProviderRegistry.registerProvider('aws', {
119
119
  name: 'Amazon',
120
- adHocInfrastructureWritesEnabled: SETTINGS.awsAdHocInfraWritesEnabled,
120
+ adHocInfrastructureWritesEnabled: AWSProviderSettings.adHocInfraWritesEnabled,
121
121
  logo: {
122
122
  path: amazonLogo,
123
123
  },
@@ -7,6 +7,7 @@ export interface IClassicLaunchAllowlist {
7
7
  }
8
8
 
9
9
  export interface IAWSProviderSettings extends IProviderSettings {
10
+ adHocInfraWritesEnabled?: boolean;
10
11
  bakeWarning?: string;
11
12
  classicLaunchLockout?: number;
12
13
  classicLaunchAllowlist?: IClassicLaunchAllowlist[];
@@ -65,5 +66,6 @@ export const AWSProviderSettings: IAWSProviderSettings = (SETTINGS.providers.aws
65
66
  defaults: {},
66
67
  };
67
68
  if (AWSProviderSettings) {
69
+ AWSProviderSettings.adHocInfraWritesEnabled = AWSProviderSettings.adHocInfraWritesEnabled ?? true;
68
70
  AWSProviderSettings.resetToOriginal = SETTINGS.resetProvider('aws');
69
71
  }
@@ -1,15 +1,18 @@
1
- import React from 'react';
2
1
  import { shallow } from 'enzyme';
2
+ import React from 'react';
3
+
4
+ import type { Application } from '@spinnaker/core';
3
5
 
4
- import { Application, SETTINGS } from '@spinnaker/core';
5
- import { IAmazonFunction, FunctionActions } from '../../index';
6
+ import { AWSProviderSettings } from '../../aws.settings';
7
+ import type { IAmazonFunction } from '../../index';
8
+ import { FunctionActions } from '../../index';
6
9
 
7
10
  describe('FunctionActions', () => {
8
11
  it('should render correct state when all attributes exist', () => {
9
- let app = { name: 'app' } as Application;
12
+ const app = { name: 'app' } as Application;
10
13
 
11
- let functionDef = { functionName: 'app-function' } as IAmazonFunction;
12
- SETTINGS.awsAdHocInfraWritesEnabled = true;
14
+ const functionDef = { functionName: 'app-function' } as IAmazonFunction;
15
+ AWSProviderSettings.adHocInfraWritesEnabled = true;
13
16
 
14
17
  const wrapper = shallow(
15
18
  <FunctionActions
@@ -23,16 +26,16 @@ describe('FunctionActions', () => {
23
26
  />,
24
27
  );
25
28
 
26
- let dropDown = wrapper.find('DropdownToggle');
29
+ const dropDown = wrapper.find('DropdownToggle');
27
30
 
28
31
  expect(dropDown.childAt(0).text()).toEqual('Function Actions');
29
32
  });
30
33
 
31
- it('should not render DropdownToggle if awsAdHocInfraWritesEnabled is false', () => {
32
- let app = { name: 'app' } as Application;
34
+ it('should not render DropdownToggle if aws.adHocInfraWritesEnabled is false', () => {
35
+ const app = { name: 'app' } as Application;
33
36
 
34
- let functionDef = { functionName: 'app-function' } as IAmazonFunction;
35
- SETTINGS.awsAdHocInfraWritesEnabled = false;
37
+ const functionDef = { functionName: 'app-function' } as IAmazonFunction;
38
+ AWSProviderSettings.adHocInfraWritesEnabled = false;
36
39
 
37
40
  const wrapper = shallow(
38
41
  <FunctionActions
@@ -46,7 +49,7 @@ describe('FunctionActions', () => {
46
49
  />,
47
50
  );
48
51
 
49
- let dropDown = wrapper.find('div');
52
+ const dropDown = wrapper.find('div');
50
53
  expect(dropDown.children().length).toEqual(0);
51
54
  });
52
55
  });
@@ -12,6 +12,7 @@ import {
12
12
 
13
13
  import type { IFunctionFromStateParams } from './AmazonFunctionDetails';
14
14
  import { CreateLambdaFunction } from '../CreateLambdaFunction';
15
+ import { AWSProviderSettings } from '../../aws.settings';
15
16
  import type { IAmazonFunction, IAmazonFunctionDeleteCommand } from '../../domain';
16
17
 
17
18
  export interface IFunctionActionsProps {
@@ -96,7 +97,7 @@ export class FunctionActions extends React.Component<IFunctionActionsProps, IFun
96
97
 
97
98
  return (
98
99
  <div style={{ display: 'inline-block' }}>
99
- {SETTINGS.awsAdHocInfraWritesEnabled && (
100
+ {AWSProviderSettings.adHocInfraWritesEnabled && (
100
101
  <Dropdown className="dropdown" id="function-actions-dropdown">
101
102
  <Dropdown.Toggle className="btn btn-sm btn-primary dropdown-toggle">
102
103
  <span>Function Actions</span>
@@ -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
+ });