@spinnaker/ecs 2026.2.2 → 2026.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/dist/ecs.module.d.ts +3 -1
  2. package/dist/ecsCluster/ecsCluster.read.service.d.ts +2 -3
  3. package/dist/iamRoles/iamRole.read.service.d.ts +1 -2
  4. package/dist/index.d.ts +5 -0
  5. package/dist/index.js +1 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/instance/details/EcsInstanceDetails.d.ts +50 -0
  8. package/dist/loadBalancer/loadBalancer.transformer.d.ts +1 -5
  9. package/dist/loadBalancer/targetGroup.states.d.ts +2 -1
  10. package/dist/metricAlarm/metricAlarm.read.service.d.ts +1 -2
  11. package/dist/pipeline/stages/cloneServerGroup/ecsCloneServerGroupStage.d.ts +1 -0
  12. package/dist/pipeline/stages/common/EcsServerGroupStepLabel.d.ts +7 -0
  13. package/dist/pipeline/stages/common/EcsStageConfigs.d.ts +11 -0
  14. package/dist/pipeline/stages/destroyAsg/ecsDestroyAsgStage.d.ts +1 -2
  15. package/dist/pipeline/stages/disableAsg/ecsDisableAsgStage.d.ts +1 -2
  16. package/dist/pipeline/stages/disableCluster/ecsDisableClusterStage.d.ts +1 -2
  17. package/dist/pipeline/stages/enableAsg/ecsEnableAsgStage.d.ts +1 -2
  18. package/dist/pipeline/stages/findImageFromTags/EcsFindImageFromTagsExecutionDetails.d.ts +5 -0
  19. package/dist/pipeline/stages/findImageFromTags/ecsFindImageFromTagStage.d.ts +1 -2
  20. package/dist/pipeline/stages/resizeAsg/ecsResizeAsgStage.d.ts +1 -2
  21. package/dist/pipeline/stages/scaleDownCluster/ecsScaleDownClusterStage.d.ts +1 -2
  22. package/dist/pipeline/stages/shrinkCluster/ecsShrinkClusterStage.d.ts +1 -2
  23. package/dist/placementStrategy/placementStrategy.service.d.ts +0 -1
  24. package/dist/secrets/secret.read.service.d.ts +1 -2
  25. package/dist/securityGroup/details/EcsSecurityGroupDetails.d.ts +45 -0
  26. package/dist/securityGroup/securityGroup.reader.d.ts +0 -1
  27. package/dist/securityGroup/securityGroup.transformer.d.ts +3 -2
  28. package/dist/serverGroup/configure/dockerImage.util.d.ts +3 -0
  29. package/dist/serverGroup/configure/serverGroupCommandBuilder.service.d.ts +111 -2
  30. package/dist/serverGroup/configure/serverGroupConfiguration.service.d.ts +13 -63
  31. package/dist/serverGroup/configure/wizard/EcsCloneServerGroupModal.d.ts +64 -0
  32. package/dist/serverGroup/configure/wizard/capacityProvider/CapacityProvider.d.ts +29 -4
  33. package/dist/serverGroup/configure/wizard/container/Container.d.ts +3 -3
  34. package/dist/serverGroup/configure/wizard/networking/Networking.d.ts +3 -3
  35. package/dist/serverGroup/configure/wizard/pages/AdvancedSettings.d.ts +3 -0
  36. package/dist/serverGroup/configure/wizard/pages/BasicSettings.d.ts +3 -0
  37. package/dist/serverGroup/configure/wizard/pages/ContainerSettings.d.ts +3 -0
  38. package/dist/serverGroup/configure/wizard/pages/HorizontalScalingSettings.d.ts +3 -0
  39. package/dist/serverGroup/configure/wizard/pages/LoggingSettings.d.ts +3 -0
  40. package/dist/serverGroup/configure/wizard/pages/NetworkingSettings.d.ts +3 -0
  41. package/dist/serverGroup/configure/wizard/pages/ServiceDiscoverySettings.d.ts +3 -0
  42. package/dist/serverGroup/configure/wizard/pages/TaskDefinitionSettings.d.ts +3 -0
  43. package/dist/serverGroup/configure/wizard/pages/common.d.ts +8 -0
  44. package/dist/serverGroup/configure/wizard/pages/validation.d.ts +22 -0
  45. package/dist/serverGroup/configure/wizard/serviceDiscovery/ServiceDiscovery.d.ts +5 -3
  46. package/dist/serverGroup/configure/wizard/taskDefinition/TaskDefinition.d.ts +3 -3
  47. package/dist/serverGroup/details/EcsServerGroupActions.d.ts +6 -0
  48. package/dist/serverGroup/details/ecsServerGroupDetailsGetter.d.ts +3 -0
  49. package/dist/serverGroup/details/resize/EcsResizeServerGroupModal.d.ts +43 -0
  50. package/dist/serverGroup/details/resize/index.d.ts +1 -0
  51. package/dist/serverGroup/details/rollback/EcsRollbackServerGroupModal.d.ts +46 -0
  52. package/dist/serverGroup/details/rollback/index.d.ts +1 -0
  53. package/dist/serverGroup/details/sections/EcsServerGroupDetailsSections.d.ts +9 -0
  54. package/dist/serverGroup/details/sections/EcsServerGroupEventsSection.d.ts +3 -0
  55. package/dist/serverGroup/details/sections/EcsServerGroupInformationSection.d.ts +3 -0
  56. package/dist/serverGroup/events/EcsServerGroupEventsModal.d.ts +22 -0
  57. package/dist/serverGroup/events/EventsLink.d.ts +2 -0
  58. package/dist/serverGroup/events/serverGroupEventsReader.service.d.ts +1 -1
  59. package/dist/serverGroup/serverGroup.transformer.d.ts +1 -2
  60. package/dist/serviceDiscovery/serviceDiscovery.read.service.d.ts +1 -1
  61. package/package.json +3 -9
  62. package/src/ecs.module.spec.ts +86 -0
  63. package/src/ecs.module.ts +68 -84
  64. package/src/ecsCluster/ecsCluster.read.service.ts +3 -9
  65. package/src/iamRoles/iamRole.read.service.ts +1 -7
  66. package/src/index.ts +6 -0
  67. package/src/instance/details/EcsInstanceDetails.spec.tsx +426 -0
  68. package/src/instance/details/EcsInstanceDetails.tsx +474 -0
  69. package/src/loadBalancer/details/loadBalancerDetails.tsx +1 -1
  70. package/src/loadBalancer/details/targetGroupDetails.tsx +1 -1
  71. package/src/loadBalancer/loadBalancer.transformer.ts +2 -7
  72. package/src/loadBalancer/targetGroup.states.ts +55 -53
  73. package/src/metricAlarm/metricAlarm.read.service.ts +1 -7
  74. package/src/pipeline/stages/cloneServerGroup/ecsCloneServerGroupStage.js +22 -94
  75. package/src/pipeline/stages/common/EcsServerGroupStepLabel.tsx +16 -0
  76. package/src/pipeline/stages/common/EcsStageConfigs.tsx +587 -0
  77. package/src/pipeline/stages/destroyAsg/ecsDestroyAsgStage.js +29 -65
  78. package/src/pipeline/stages/disableAsg/ecsDisableAsgStage.js +27 -70
  79. package/src/pipeline/stages/disableCluster/ecsDisableClusterStage.js +21 -84
  80. package/src/pipeline/stages/enableAsg/ecsEnableAsgStage.js +22 -73
  81. package/src/pipeline/stages/findImageFromTags/EcsFindImageFromTagsExecutionDetails.tsx +40 -0
  82. package/src/pipeline/stages/findImageFromTags/ecsFindImageFromTagStage.js +12 -24
  83. package/src/pipeline/stages/resizeAsg/ecsResizeAsgStage.js +30 -128
  84. package/src/pipeline/stages/scaleDownCluster/ecsScaleDownClusterStage.js +24 -78
  85. package/src/pipeline/stages/shrinkCluster/ecsShrinkClusterStage.js +19 -73
  86. package/src/placementStrategy/placementStrategy.service.ts +0 -6
  87. package/src/secrets/secret.read.service.ts +1 -7
  88. package/src/securityGroup/details/EcsSecurityGroupDetails.spec.tsx +245 -0
  89. package/src/securityGroup/details/EcsSecurityGroupDetails.tsx +285 -0
  90. package/src/securityGroup/securityGroup.reader.ts +0 -5
  91. package/src/securityGroup/securityGroup.transformer.js +5 -13
  92. package/src/serverGroup/configure/dockerImage.util.ts +29 -0
  93. package/src/serverGroup/configure/serverGroupCommandBuilder.service.js +215 -278
  94. package/src/serverGroup/configure/serverGroupCommandBuilder.service.spec.ts +83 -0
  95. package/src/serverGroup/configure/serverGroupConfiguration.service.ts +16 -633
  96. package/src/serverGroup/configure/wizard/EcsCloneServerGroupModal.spec.tsx +2078 -0
  97. package/src/serverGroup/configure/wizard/EcsCloneServerGroupModal.tsx +712 -0
  98. package/src/serverGroup/configure/wizard/capacityProvider/CapacityProvider.tsx +98 -49
  99. package/src/serverGroup/configure/wizard/container/Container.spec.tsx +20 -8
  100. package/src/serverGroup/configure/wizard/container/Container.tsx +53 -24
  101. package/src/serverGroup/configure/wizard/networking/Networking.tsx +60 -38
  102. package/src/serverGroup/configure/wizard/pages/AdvancedSettings.tsx +290 -0
  103. package/src/serverGroup/configure/wizard/pages/BasicSettings.tsx +101 -0
  104. package/src/serverGroup/configure/wizard/pages/ContainerSettings.tsx +10 -0
  105. package/src/serverGroup/configure/wizard/pages/HorizontalScalingSettings.tsx +137 -0
  106. package/src/serverGroup/configure/wizard/pages/LoggingSettings.tsx +60 -0
  107. package/src/serverGroup/configure/wizard/pages/NetworkingSettings.tsx +10 -0
  108. package/src/serverGroup/configure/wizard/pages/ServiceDiscoverySettings.tsx +10 -0
  109. package/src/serverGroup/configure/wizard/pages/TaskDefinitionSettings.tsx +59 -0
  110. package/src/serverGroup/configure/wizard/pages/common.ts +10 -0
  111. package/src/serverGroup/configure/wizard/pages/validation.tsx +190 -0
  112. package/src/serverGroup/configure/wizard/serviceDiscovery/ServiceDiscovery.tsx +83 -34
  113. package/src/serverGroup/configure/wizard/taskDefinition/TaskDefinition.spec.tsx +21 -8
  114. package/src/serverGroup/configure/wizard/taskDefinition/TaskDefinition.tsx +63 -33
  115. package/src/serverGroup/details/EcsServerGroupActions.spec.tsx +244 -0
  116. package/src/serverGroup/details/EcsServerGroupActions.tsx +152 -0
  117. package/src/serverGroup/details/ecsServerGroupDetailsGetter.spec.ts +110 -0
  118. package/src/serverGroup/details/ecsServerGroupDetailsGetter.ts +73 -0
  119. package/src/serverGroup/details/resize/EcsResizeServerGroupModal.spec.tsx +130 -0
  120. package/src/serverGroup/details/resize/EcsResizeServerGroupModal.tsx +263 -0
  121. package/src/serverGroup/details/resize/index.ts +1 -0
  122. package/src/serverGroup/details/rollback/EcsRollbackServerGroupModal.spec.tsx +173 -0
  123. package/src/serverGroup/details/rollback/EcsRollbackServerGroupModal.tsx +285 -0
  124. package/src/serverGroup/details/rollback/index.ts +1 -0
  125. package/src/serverGroup/details/sections/EcsServerGroupDetailsSections.spec.tsx +130 -0
  126. package/src/serverGroup/details/sections/EcsServerGroupDetailsSections.tsx +172 -0
  127. package/src/serverGroup/details/sections/EcsServerGroupEventsSection.tsx +14 -0
  128. package/src/serverGroup/details/sections/EcsServerGroupInformationSection.tsx +25 -0
  129. package/src/serverGroup/events/EcsServerGroupEventsModal.spec.tsx +109 -0
  130. package/src/serverGroup/events/EcsServerGroupEventsModal.tsx +112 -0
  131. package/src/serverGroup/events/EventsLink.tsx +18 -0
  132. package/src/serverGroup/events/serverGroupEventsReader.service.spec.ts +41 -0
  133. package/src/serverGroup/events/serverGroupEventsReader.service.ts +2 -8
  134. package/src/serverGroup/serverGroup.transformer.spec.ts +10 -24
  135. package/src/serverGroup/serverGroup.transformer.ts +1 -5
  136. package/src/serviceDiscovery/serviceDiscovery.read.service.ts +1 -1
  137. package/dist/common/common.module.d.ts +0 -1
  138. package/dist/common/footer.component.d.ts +0 -1
  139. package/dist/instance/details/instance.details.controller.d.ts +0 -2
  140. package/dist/securityGroup/details/securityGroupDetail.controller.d.ts +0 -2
  141. package/dist/securityGroup/securityGroup.module.d.ts +0 -1
  142. package/dist/serverGroup/configure/wizard/CloneServerGroup.ecs.controller.d.ts +0 -2
  143. package/dist/serverGroup/configure/wizard/advancedSettings/advancedSettings.component.d.ts +0 -2
  144. package/dist/serverGroup/configure/wizard/horizontalScaling/horizontalScaling.component.d.ts +0 -2
  145. package/dist/serverGroup/configure/wizard/location/ServerGroupBasicSettings.controller.d.ts +0 -2
  146. package/dist/serverGroup/configure/wizard/logging/logging.component.d.ts +0 -1
  147. package/dist/serverGroup/details/resize/resizeCapacity.component.d.ts +0 -1
  148. package/dist/serverGroup/details/resize/resizeServerGroup.controller.d.ts +0 -2
  149. package/dist/serverGroup/details/rollback/rollbackServerGroup.controller.d.ts +0 -2
  150. package/dist/serverGroup/details/serverGroupDetails.ecs.controller.d.ts +0 -2
  151. package/dist/serverGroup/details/serverGroupDetails.module.d.ts +0 -1
  152. package/dist/serverGroup/events/events.component.d.ts +0 -3
  153. package/dist/serverGroup/events/events.controller.d.ts +0 -19
  154. package/dist/serverGroup/serverGroup.module.d.ts +0 -1
  155. package/src/common/common.module.ts +0 -6
  156. package/src/common/footer.component.ts +0 -29
  157. package/src/instance/details/instance.details.controller.js +0 -356
  158. package/src/instance/details/instanceDetails.html +0 -204
  159. package/src/pipeline/stages/cloneServerGroup/cloneServerGroupStage.html +0 -101
  160. package/src/pipeline/stages/cloneServerGroup/cloneServerGroupStepLabel.html +0 -1
  161. package/src/pipeline/stages/destroyAsg/destroyAsgStage.html +0 -9
  162. package/src/pipeline/stages/destroyAsg/destroyAsgStepLabel.html +0 -1
  163. package/src/pipeline/stages/disableAsg/disableAsgStage.html +0 -11
  164. package/src/pipeline/stages/disableAsg/disableAsgStepLabel.html +0 -1
  165. package/src/pipeline/stages/disableCluster/disableClusterStage.html +0 -26
  166. package/src/pipeline/stages/enableAsg/enableAsgStage.html +0 -11
  167. package/src/pipeline/stages/enableAsg/enableAsgStepLabel.html +0 -1
  168. package/src/pipeline/stages/findImageFromTags/findImageFromTagsExecutionDetails.html +0 -36
  169. package/src/pipeline/stages/findImageFromTags/findImageFromTagsStage.html +0 -9
  170. package/src/pipeline/stages/resizeAsg/resizeAsgStage.html +0 -87
  171. package/src/pipeline/stages/resizeAsg/resizeAsgStepLabel.html +0 -1
  172. package/src/pipeline/stages/scaleDownCluster/scaleDownClusterStage.html +0 -35
  173. package/src/pipeline/stages/shrinkCluster/shrinkClusterStage.html +0 -34
  174. package/src/securityGroup/details/securityGroupDetail.controller.js +0 -147
  175. package/src/securityGroup/details/securityGroupDetail.html +0 -104
  176. package/src/securityGroup/securityGroup.module.ts +0 -12
  177. package/src/serverGroup/configure/wizard/CloneServerGroup.ecs.controller.js +0 -259
  178. package/src/serverGroup/configure/wizard/advancedSettings/advancedSettings.component.html +0 -194
  179. package/src/serverGroup/configure/wizard/advancedSettings/advancedSettings.component.js +0 -17
  180. package/src/serverGroup/configure/wizard/advancedSettings/advancedSettings.html +0 -10
  181. package/src/serverGroup/configure/wizard/capacityProvider/capacityProvider.html +0 -11
  182. package/src/serverGroup/configure/wizard/container/container.html +0 -9
  183. package/src/serverGroup/configure/wizard/horizontalScaling/horizontalScaling.component.html +0 -118
  184. package/src/serverGroup/configure/wizard/horizontalScaling/horizontalScaling.component.js +0 -20
  185. package/src/serverGroup/configure/wizard/horizontalScaling/horizontalScaling.html +0 -13
  186. package/src/serverGroup/configure/wizard/location/ServerGroupBasicSettings.controller.js +0 -41
  187. package/src/serverGroup/configure/wizard/location/basicSettings.html +0 -137
  188. package/src/serverGroup/configure/wizard/logging/logging.component.html +0 -29
  189. package/src/serverGroup/configure/wizard/logging/logging.component.ts +0 -12
  190. package/src/serverGroup/configure/wizard/logging/logging.html +0 -7
  191. package/src/serverGroup/configure/wizard/networking/networking.html +0 -9
  192. package/src/serverGroup/configure/wizard/serverGroupWizard.html +0 -55
  193. package/src/serverGroup/configure/wizard/serviceDiscovery/serviceDiscovery.html +0 -11
  194. package/src/serverGroup/configure/wizard/taskDefinition/taskDefinition.html +0 -51
  195. package/src/serverGroup/configure/wizard/templateSelection/templateSelection.html +0 -9
  196. package/src/serverGroup/configure/wizard/verticalScaling/verticalScaling.html +0 -10
  197. package/src/serverGroup/details/resize/resizeCapacity.component.html +0 -94
  198. package/src/serverGroup/details/resize/resizeCapacity.component.ts +0 -14
  199. package/src/serverGroup/details/resize/resizeServerGroup.controller.js +0 -85
  200. package/src/serverGroup/details/resize/resizeServerGroup.html +0 -28
  201. package/src/serverGroup/details/rollback/rollbackServerGroup.controller.js +0 -97
  202. package/src/serverGroup/details/rollback/rollbackServerGroup.html +0 -67
  203. package/src/serverGroup/details/serverGroupDetails.ecs.controller.js +0 -366
  204. package/src/serverGroup/details/serverGroupDetails.html +0 -216
  205. package/src/serverGroup/details/serverGroupDetails.module.ts +0 -5
  206. package/src/serverGroup/events/events.component.ts +0 -35
  207. package/src/serverGroup/events/events.controller.ts +0 -45
  208. package/src/serverGroup/events/events.html +0 -36
  209. package/src/serverGroup/serverGroup.module.ts +0 -6
@@ -1,56 +1,16 @@
1
- import type { IQService } from 'angular';
2
- import { module } from 'angular';
3
- import { chain, clone, extend, find, flatten, has, intersection, keys, some, xor } from 'lodash';
4
-
5
- import type { IAmazonLoadBalancer } from '@spinnaker/amazon';
6
- import type {
7
- IAccountDetails,
8
- IArtifact,
9
- IDeploymentStrategy,
10
- IPipeline,
11
- IRegion,
12
- IServerGroupCommand,
13
- IServerGroupCommandBackingData,
14
- IServerGroupCommandBackingDataFiltered,
15
- IServerGroupCommandDirty,
16
- IServerGroupCommandResult,
17
- IServerGroupCommandViewState,
18
- IStage,
19
- ISubnet,
20
- LoadBalancerReader,
21
- SecurityGroupReader,
22
- ServerGroupCommandRegistry,
23
- } from '@spinnaker/core';
24
- import {
25
- AccountService,
26
- CACHE_INITIALIZER_SERVICE,
27
- LOAD_BALANCER_READ_SERVICE,
28
- NameUtils,
29
- SECURITY_GROUP_READER,
30
- SERVER_GROUP_COMMAND_REGISTRY_PROVIDER,
31
- SubnetReader,
32
- } from '@spinnaker/core';
1
+ import type { IArtifact, IPipeline, IServerGroupCommandResult, IStage } from '@spinnaker/core';
33
2
  import type { IDockerImage } from '@spinnaker/docker';
34
- import { DockerImageReader } from '@spinnaker/docker';
35
3
 
36
4
  import type { IEcsCapacityProviderDetails } from '../../ecsCluster/IEcsCapacityProviderDetails';
37
5
  import type { IEcsClusterDescriptor } from '../../ecsCluster/IEcsCluster';
38
- import type { EcsClusterReader } from '../../ecsCluster/ecsCluster.read.service';
39
6
  import type { IRoleDescriptor } from '../../iamRoles/IRole';
40
- import type { IamRoleReader } from '../../iamRoles/iamRole.read.service';
41
7
  import type { IMetricAlarmDescriptor } from '../../metricAlarm/MetricAlarm';
42
- import type { MetricAlarmReader } from '../../metricAlarm/metricAlarm.read.service';
43
8
  import type { IPlacementStrategy } from '../../placementStrategy/IPlacementStrategy';
44
- import type { PlacementStrategyService } from '../../placementStrategy/placementStrategy.service';
45
9
  import type { ISecretDescriptor } from '../../secrets/ISecret';
46
- import type { SecretReader } from '../../secrets/secret.read.service';
47
10
  import type { IServiceDiscoveryRegistryDescriptor } from '../../serviceDiscovery/IServiceDiscovery';
48
- import { ServiceDiscoveryReader } from '../../serviceDiscovery/serviceDiscovery.read.service';
49
11
 
50
- export interface IEcsServerGroupCommandDirty extends IServerGroupCommandDirty {
51
- targetGroups?: string[];
52
- defaulCapacityProviders?: string[];
53
- customCapacityProviders?: string[];
12
+ export interface IEcsServerGroupCommandDirty {
13
+ [key: string]: any;
54
14
  }
55
15
 
56
16
  export interface IEcsServerGroupCommandResult extends IServerGroupCommandResult {
@@ -58,6 +18,7 @@ export interface IEcsServerGroupCommandResult extends IServerGroupCommandResult
58
18
  }
59
19
 
60
20
  export interface IEcsDockerImage extends IDockerImage {
21
+ [key: string]: any;
61
22
  imageId: string;
62
23
  message: string;
63
24
  fromTrigger: boolean;
@@ -66,28 +27,31 @@ export interface IEcsDockerImage extends IDockerImage {
66
27
  imageLabelOrSha: string;
67
28
  }
68
29
 
69
- export interface IEcsServerGroupCommandViewState extends IServerGroupCommandViewState {
30
+ export interface IEcsServerGroupCommandViewState {
31
+ [key: string]: any;
70
32
  contextImages: IEcsDockerImage[];
71
33
  pipeline: IPipeline;
72
34
  currentStage: IStage;
73
35
  dirty: IEcsServerGroupCommandDirty;
74
36
  }
75
37
 
76
- export interface IEcsServerGroupCommandBackingDataFiltered extends IServerGroupCommandBackingDataFiltered {
38
+ export interface IEcsServerGroupCommandBackingDataFiltered {
39
+ [key: string]: any;
77
40
  targetGroups: string[];
78
41
  iamRoles: string[];
79
42
  ecsClusters: string[];
80
43
  availableCapacityProviders: string[];
81
44
  defaultCapacityProviderStrategy: IEcsCapacityProviderStrategyItem[];
82
45
  metricAlarms: IMetricAlarmDescriptor[];
83
- subnetTypes: ISubnet[];
46
+ subnetTypes: any[];
84
47
  securityGroupNames: string[];
85
48
  secrets: string[];
86
49
  serviceDiscoveryRegistries: IServiceDiscoveryRegistryDescriptor[];
87
50
  images: IEcsDockerImage[];
88
51
  }
89
52
 
90
- export interface IEcsServerGroupCommandBackingData extends IServerGroupCommandBackingData {
53
+ export interface IEcsServerGroupCommandBackingData {
54
+ [key: string]: any;
91
55
  filtered: IEcsServerGroupCommandBackingDataFiltered;
92
56
  targetGroups: string[];
93
57
  ecsClusters: IEcsClusterDescriptor[];
@@ -129,7 +93,8 @@ export interface IEcsCapacityProviderStrategyItem {
129
93
  weight: number;
130
94
  }
131
95
 
132
- export interface IEcsServerGroupCommand extends IServerGroupCommand {
96
+ export interface IEcsServerGroupCommand {
97
+ [key: string]: any;
133
98
  associatePublicIpAddress: boolean;
134
99
  backingData: IEcsServerGroupCommandBackingData;
135
100
  computeUnits: number;
@@ -154,599 +119,17 @@ export interface IEcsServerGroupCommand extends IServerGroupCommand {
154
119
  serviceDiscoveryAssociations: IEcsServiceDiscoveryRegistryAssociation[];
155
120
  useTaskDefinitionArtifact: boolean;
156
121
  evaluateTaskDefinitionArtifactExpressions: boolean;
157
-
158
122
  capacityProviderStrategy: IEcsCapacityProviderStrategyItem[];
159
123
  useDefaultCapacityProviders: boolean;
160
124
  ecsClusterName: string;
161
- subnetTypeChanged: (command: IEcsServerGroupCommand) => IServerGroupCommandResult;
162
- placementStrategyNameChanged: (command: IEcsServerGroupCommand) => IServerGroupCommandResult;
163
- regionIsDeprecated: (command: IEcsServerGroupCommand) => boolean;
164
-
165
- clusterChanged: (command: IServerGroupCommand) => void;
166
125
  }
167
126
 
168
127
  export class EcsServerGroupConfigurationService {
169
- // private enabledMetrics = ['GroupMinSize', 'GroupMaxSize', 'GroupDesiredCapacity', 'GroupInServiceInstances', 'GroupPendingInstances', 'GroupStandbyInstances', 'GroupTerminatingInstances', 'GroupTotalInstances'];
170
- // private healthCheckTypes = ['EC2', 'ELB'];
171
- // private terminationPolicies = ['OldestInstance', 'NewestInstance', 'OldestLaunchConfiguration', 'ClosestToNextInstanceHour', 'Default'];
172
- private launchTypes = ['EC2', 'FARGATE'];
173
- private networkModes = ['bridge', 'host', 'awsvpc', 'none', 'default'];
174
-
175
- public static $inject = [
176
- '$q',
177
- 'loadBalancerReader',
178
- 'serverGroupCommandRegistry',
179
- 'iamRoleReader',
180
- 'ecsClusterReader',
181
- 'metricAlarmReader',
182
- 'placementStrategyService',
183
- 'securityGroupReader',
184
- 'secretReader',
185
- ];
186
- constructor(
187
- private $q: IQService,
188
- private loadBalancerReader: LoadBalancerReader,
189
- private serverGroupCommandRegistry: ServerGroupCommandRegistry,
190
- private iamRoleReader: IamRoleReader,
191
- private ecsClusterReader: EcsClusterReader,
192
- private metricAlarmReader: MetricAlarmReader,
193
- private placementStrategyService: PlacementStrategyService,
194
- private securityGroupReader: SecurityGroupReader,
195
- private secretReader: SecretReader,
196
- ) {}
197
-
198
128
  public configureUpdateCommand(command: IEcsServerGroupCommand): void {
199
129
  command.backingData = {
200
- // terminationPolicies: clone(this.terminationPolicies)
201
- launchTypes: clone(this.launchTypes),
202
- networkModes: clone(this.networkModes),
130
+ filtered: {} as IEcsServerGroupCommandBackingDataFiltered,
131
+ launchTypes: ['EC2', 'FARGATE'],
132
+ networkModes: ['bridge', 'host', 'awsvpc', 'none', 'default'],
203
133
  } as IEcsServerGroupCommandBackingData;
204
134
  }
205
-
206
- // TODO (Bruno Carrier): Why do we need to inject an Application into this constructor so that the app works? This is strange, and needs investigating
207
- public configureCommand(cmd: IEcsServerGroupCommand, imageQuery = ''): PromiseLike<void> {
208
- this.applyOverrides('beforeConfiguration', cmd);
209
- cmd.toggleSuspendedProcess = (command: IEcsServerGroupCommand, process: string): void => {
210
- command.suspendedProcesses = command.suspendedProcesses || [];
211
- const processIndex = command.suspendedProcesses.indexOf(process);
212
- if (processIndex === -1) {
213
- command.suspendedProcesses.push(process);
214
- } else {
215
- command.suspendedProcesses.splice(processIndex, 1);
216
- }
217
- };
218
-
219
- cmd.processIsSuspended = (command: IEcsServerGroupCommand, process: string): boolean =>
220
- command.suspendedProcesses.includes(process);
221
-
222
- cmd.onStrategyChange = (command: IEcsServerGroupCommand, strategy: IDeploymentStrategy): void => {
223
- // Any strategy other than None or Custom should force traffic to be enabled
224
- if (strategy.key !== '' && strategy.key !== 'custom') {
225
- command.suspendedProcesses = (command.suspendedProcesses || []).filter((p) => p !== 'AddToLoadBalancer');
226
- }
227
- };
228
-
229
- cmd.regionIsDeprecated = (command: IEcsServerGroupCommand): boolean => {
230
- return (
231
- has(command, 'backingData.filtered.regions') &&
232
- command.backingData.filtered.regions.some((region) => region.name === command.region && region.deprecated)
233
- );
234
- };
235
-
236
- const imageQueries = cmd.imageDescription ? [this.grabImageAndTag(cmd.imageDescription.imageId)] : [];
237
-
238
- if (imageQuery) {
239
- imageQueries.push(imageQuery);
240
- }
241
-
242
- // Scope image search to a known account. If no account is available yet the Docker registry
243
- // account picker in the wizard will trigger an account-scoped reload once the user selects one.
244
- const searchAccount = cmd.imageDescription?.account;
245
-
246
- let imagesPromise;
247
- if (imageQueries.length && searchAccount) {
248
- imagesPromise = this.$q
249
- .all(
250
- imageQueries.map((q) =>
251
- DockerImageReader.findImages({
252
- provider: 'dockerRegistry',
253
- account: searchAccount,
254
- count: 50,
255
- q: q,
256
- }),
257
- ),
258
- )
259
- .then((promises) => flatten(promises));
260
- } else {
261
- imagesPromise = this.$q.when([]);
262
- }
263
-
264
- return this.$q
265
- .all({
266
- credentialsKeyedByAccount: AccountService.getCredentialsKeyedByAccount('ecs'),
267
- loadBalancers: this.loadBalancerReader.listLoadBalancers('ecs'),
268
- subnets: SubnetReader.listSubnetsByProvider('ecs'),
269
- iamRoles: this.iamRoleReader.listRoles('ecs'),
270
- ecsClusters: this.ecsClusterReader.listClusters(),
271
- capacityProviderDetails: this.ecsClusterReader.describeClusters(cmd.credentials, cmd.region),
272
- metricAlarms: this.metricAlarmReader.listMetricAlarms(),
273
- securityGroups: this.securityGroupReader.getAllSecurityGroups(),
274
- launchTypes: this.$q.when(clone(this.launchTypes)),
275
- networkModes: this.$q.when(clone(this.networkModes)),
276
- secrets: this.secretReader.listSecrets(),
277
- serviceDiscoveryRegistries: ServiceDiscoveryReader.listServiceDiscoveryRegistries(),
278
- images: imagesPromise,
279
- })
280
- .then((backingData: Partial<IEcsServerGroupCommandBackingData>) => {
281
- backingData.accounts = keys(backingData.credentialsKeyedByAccount);
282
- backingData.filtered = {} as IEcsServerGroupCommandBackingDataFiltered;
283
-
284
- if (cmd.viewState.contextImages) {
285
- backingData.images = backingData.images.concat(cmd.viewState.contextImages);
286
- }
287
- cmd.backingData = backingData as IEcsServerGroupCommandBackingData;
288
- this.configureVpcId(cmd);
289
- this.configureAvailableIamRoles(cmd);
290
- this.configureAvailableSubnetTypes(cmd);
291
- this.configureAvailableSecurityGroups(cmd);
292
- this.configureAvailableEcsClusters(cmd);
293
- this.setCapacityProviderDetails(cmd);
294
- this.configureAvailableSecrets(cmd);
295
- this.configureAvailableServiceDiscoveryRegistries(cmd);
296
- this.configureAvailableImages(cmd);
297
- this.configureAvailableRegions(cmd);
298
- this.configureLoadBalancerOptions(cmd);
299
- this.applyOverrides('afterConfiguration', cmd);
300
- this.attachEventHandlers(cmd);
301
- });
302
- }
303
-
304
- public setCapacityProviderDetails(command: IEcsServerGroupCommand): void {
305
- this.$q
306
- .all({
307
- capacityProviderDetails: this.ecsClusterReader.describeClusters(command.credentials, command.region),
308
- })
309
- .then((result: Partial<IEcsServerGroupCommandBackingData>) => {
310
- command.backingData.capacityProviderDetails = chain(result.capacityProviderDetails)
311
- .map((cluster) => this.mapCapacityProviderDetails(cluster))
312
- .value();
313
- });
314
-
315
- if (command.ecsClusterName != null && command.ecsClusterName.length > 0) {
316
- this.configureAvailableCapacityProviders(command);
317
- } else {
318
- command.backingData.filtered.availableCapacityProviders = [];
319
- command.backingData.filtered.defaultCapacityProviderStrategy = [];
320
- }
321
- this.checkDirtyCapacityProviders(command);
322
- }
323
-
324
- public configureAvailableCapacityProviders(command: IEcsServerGroupCommand): void {
325
- command.backingData.filtered.availableCapacityProviders = chain(command.backingData.capacityProviderDetails)
326
- .filter({
327
- clusterName: command.ecsClusterName,
328
- })
329
- .map((availableCPs) => availableCPs.capacityProviders)
330
- .flattenDeep<string>()
331
- .value();
332
-
333
- command.backingData.filtered.defaultCapacityProviderStrategy = chain(command.backingData.capacityProviderDetails)
334
- .filter({
335
- clusterName: command.ecsClusterName,
336
- })
337
- .map((availableCPs) => availableCPs.defaultCapacityProviderStrategy)
338
- .flattenDeep<IEcsCapacityProviderStrategyItem>()
339
- .value();
340
- }
341
-
342
- public mapCapacityProviderDetails(describeClusters: IEcsCapacityProviderDetails): IEcsCapacityProviderDetails {
343
- return {
344
- capacityProviders: describeClusters.capacityProviders,
345
- clusterName: describeClusters.clusterName,
346
- defaultCapacityProviderStrategy: describeClusters.defaultCapacityProviderStrategy,
347
- };
348
- }
349
-
350
- public applyOverrides(phase: string, command: IEcsServerGroupCommand): void {
351
- this.serverGroupCommandRegistry.getCommandOverrides('ecs').forEach((override: any) => {
352
- if (override[phase]) {
353
- override[phase](command);
354
- }
355
- });
356
- }
357
-
358
- public grabImageAndTag(imageId: string): string {
359
- return imageId.split('/').pop();
360
- }
361
-
362
- public buildImageId(image: IEcsDockerImage): string {
363
- if (image.fromContext) {
364
- return `${image.imageLabelOrSha}`;
365
- } else if (image.fromTrigger && !image.tag) {
366
- return `${image.registry}/${image.repository} (Tag resolved at runtime)`;
367
- } else {
368
- return `${image.registry}/${image.repository}:${image.tag}`;
369
- }
370
- }
371
-
372
- public mapImage(image: IEcsDockerImage): IEcsDockerImage {
373
- if (image.message !== undefined) {
374
- return image;
375
- }
376
-
377
- return {
378
- repository: image.repository,
379
- tag: image.tag,
380
- imageId: this.buildImageId(image),
381
- registry: image.registry,
382
- fromContext: image.fromContext,
383
- fromTrigger: image.fromTrigger,
384
- account: image.account,
385
- imageLabelOrSha: image.imageLabelOrSha,
386
- stageId: image.stageId,
387
- message: image.message,
388
- };
389
- }
390
-
391
- public configureAvailableImages(command: IEcsServerGroupCommand): void {
392
- // No filtering required, but need to decorate with the displayable image ID
393
- command.backingData.filtered.images = command.backingData.images.map((image) => this.mapImage(image));
394
- }
395
-
396
- public configureAvailabilityZones(command: IEcsServerGroupCommand): void {
397
- command.backingData.filtered.availabilityZones = find<IRegion>(
398
- command.backingData.credentialsKeyedByAccount[command.credentials].regions,
399
- { name: command.region },
400
- ).availabilityZones;
401
- command.availabilityZones = command.backingData.filtered.availabilityZones;
402
- }
403
-
404
- public configureAvailableSecurityGroups(command: IEcsServerGroupCommand): void {
405
- if (command.subnetType == null && (command.subnetTypes == null || command.subnetTypes.length == 0)) {
406
- command.backingData.filtered.securityGroups = [];
407
- return;
408
- }
409
-
410
- const vpcId = chain(command.backingData.subnets)
411
- .filter({
412
- account: command.credentials,
413
- region: command.region,
414
- purpose: command.subnetTypes ? command.subnetTypes[0] : command.subnetType,
415
- })
416
- .compact()
417
- .uniqBy('purpose')
418
- .map('vpcId')
419
- .value()[0];
420
-
421
- if (
422
- command.backingData.securityGroups[command.credentials] &&
423
- command.backingData.securityGroups[command.credentials]['ecs'] &&
424
- command.backingData.securityGroups[command.credentials]['ecs'][command.region]
425
- ) {
426
- const allSecurityGroups = command.backingData.securityGroups[command.credentials]['ecs'][command.region];
427
- command.backingData.filtered.securityGroupNames = chain(allSecurityGroups)
428
- .filter({ vpcId: vpcId })
429
- .map('name')
430
- .value() as string[];
431
- }
432
- }
433
-
434
- public configureAvailableSubnetTypes(command: IEcsServerGroupCommand): void {
435
- command.backingData.filtered.subnetTypes = chain(command.backingData.subnets)
436
- .filter({
437
- account: command.credentials,
438
- region: command.region,
439
- })
440
- .compact()
441
- .uniqBy('purpose')
442
- .value()
443
- .filter(function (e: ISubnet) {
444
- return e.purpose && e.purpose.length > 0;
445
- });
446
- }
447
-
448
- public configureAvailableEcsClusters(command: IEcsServerGroupCommand): void {
449
- command.backingData.filtered.ecsClusters = chain(command.backingData.ecsClusters)
450
- .filter({
451
- account: command.credentials,
452
- region: command.region,
453
- })
454
- .map('name')
455
- .value();
456
- }
457
-
458
- public configureAvailableSecrets(command: IEcsServerGroupCommand): void {
459
- command.backingData.filtered.secrets = chain(command.backingData.secrets)
460
- .filter({
461
- account: command.credentials,
462
- region: command.region,
463
- })
464
- .map('name')
465
- .value();
466
- }
467
-
468
- public buildServiceRegistryDisplayName(registry: IServiceDiscoveryRegistryDescriptor): string {
469
- return `${registry.name} (${registry.id})`;
470
- }
471
-
472
- public mapServiceRegistry(registry: IServiceDiscoveryRegistryDescriptor): IServiceDiscoveryRegistryDescriptor {
473
- return {
474
- account: registry.account,
475
- region: registry.region,
476
- name: registry.name,
477
- id: registry.id,
478
- arn: registry.arn,
479
- displayName: this.buildServiceRegistryDisplayName(registry),
480
- };
481
- }
482
-
483
- public configureAvailableServiceDiscoveryRegistries(command: IEcsServerGroupCommand): void {
484
- command.backingData.filtered.serviceDiscoveryRegistries = chain(command.backingData.serviceDiscoveryRegistries)
485
- .filter({
486
- account: command.credentials,
487
- region: command.region,
488
- })
489
- .map((registry) => this.mapServiceRegistry(registry))
490
- .value();
491
- }
492
-
493
- public configureAvailableRegions(command: IEcsServerGroupCommand): void {
494
- const regionsForAccount: IAccountDetails =
495
- command.backingData.credentialsKeyedByAccount[command.credentials] || ({ regions: [] } as IAccountDetails);
496
- command.backingData.filtered.regions = regionsForAccount.regions;
497
- }
498
-
499
- public configureAvailableIamRoles(command: IEcsServerGroupCommand): void {
500
- command.backingData.filtered.iamRoles = chain(command.backingData.iamRoles)
501
- .filter({ accountName: command.credentials })
502
- .map('name')
503
- .value();
504
- if (command.backingData.filtered.iamRoles.length > 0) {
505
- command.backingData.filtered.iamRoles.splice(0, 0, 'None (No IAM role)');
506
- }
507
- }
508
-
509
- public configureSubnetPurposes(command: IEcsServerGroupCommand): IServerGroupCommandResult {
510
- const result: IEcsServerGroupCommandResult = { dirty: {} };
511
- const filteredData = command.backingData.filtered;
512
- if (command.region === null) {
513
- return result;
514
- }
515
- filteredData.subnetPurposes = chain(command.backingData.subnets)
516
- .filter({ account: command.credentials, region: command.region })
517
- .reject({ target: 'elb' })
518
- .reject({ purpose: null })
519
- .uniqBy('purpose')
520
- .value();
521
-
522
- if (command.subnetTypes) {
523
- result.dirty.subnetType = !command.subnetTypes.every((subnetType) =>
524
- chain(filteredData.subnetPurposes).some({ purpose: subnetType }).value(),
525
- );
526
- } else if (!chain(filteredData.subnetPurposes).some({ purpose: command.subnetType }).value()) {
527
- result.dirty.subnetType = true;
528
- }
529
-
530
- if (result.dirty.subnetType) {
531
- command.subnetTypes = null;
532
- command.subnetType = null;
533
- }
534
-
535
- return result;
536
- }
537
-
538
- private getLoadBalancerMap(command: IEcsServerGroupCommand): IAmazonLoadBalancer[] {
539
- return chain(command.backingData.loadBalancers)
540
- .map('accounts')
541
- .flattenDeep()
542
- .filter({ name: command.credentials })
543
- .map('regions')
544
- .flattenDeep()
545
- .filter({ name: command.region })
546
- .map<IAmazonLoadBalancer>('loadBalancers')
547
- .flattenDeep<IAmazonLoadBalancer>()
548
- .value();
549
- }
550
-
551
- public getLoadBalancerNames(command: IEcsServerGroupCommand): string[] {
552
- const loadBalancers = this.getLoadBalancerMap(command).filter(
553
- (lb) => (!lb.loadBalancerType || lb.loadBalancerType === 'classic') && lb.vpcId === command.vpcId,
554
- );
555
- return loadBalancers.map((lb) => lb.name).sort();
556
- }
557
-
558
- public getVpcLoadBalancerNames(command: IEcsServerGroupCommand): string[] {
559
- const loadBalancersForVpc = this.getLoadBalancerMap(command).filter(
560
- (lb) => (!lb.loadBalancerType || lb.loadBalancerType === 'classic') && lb.vpcId,
561
- );
562
- return loadBalancersForVpc.map((lb) => lb.name).sort();
563
- }
564
-
565
- public getTargetGroupNames(command: IEcsServerGroupCommand): string[] {
566
- const loadBalancersV2 = this.getLoadBalancerMap(command).filter((lb) => lb.loadBalancerType !== 'classic') as any[];
567
- const allTargetGroups = flatten(loadBalancersV2.map<string[]>((lb) => lb.targetGroups));
568
- return allTargetGroups.sort();
569
- }
570
-
571
- public configureLoadBalancerOptions(command: IEcsServerGroupCommand): IServerGroupCommandResult {
572
- const result: IEcsServerGroupCommandResult = { dirty: {} };
573
- const currentLoadBalancers = (command.loadBalancers || []).concat(command.vpcLoadBalancers || []);
574
- const newLoadBalancers = this.getLoadBalancerNames(command);
575
- const vpcLoadBalancers = this.getVpcLoadBalancerNames(command);
576
- const allTargetGroups = this.getTargetGroupNames(command);
577
- const currentTargetGroups = command.targetGroupMappings.map((tg) => tg.targetGroup);
578
- if (currentLoadBalancers && command.loadBalancers) {
579
- const valid = command.vpcId ? newLoadBalancers : newLoadBalancers.concat(vpcLoadBalancers);
580
- const matched = intersection(valid, currentLoadBalancers);
581
- const removedLoadBalancers = xor(matched, currentLoadBalancers);
582
- command.loadBalancers = intersection(newLoadBalancers, matched);
583
- if (!command.vpcId) {
584
- command.vpcLoadBalancers = intersection(vpcLoadBalancers, matched);
585
- } else {
586
- delete command.vpcLoadBalancers;
587
- }
588
- if (removedLoadBalancers.length) {
589
- result.dirty.loadBalancers = removedLoadBalancers;
590
- }
591
- }
592
-
593
- if (currentTargetGroups) {
594
- const matched = intersection(allTargetGroups, currentTargetGroups);
595
- const removedTargetGroups = xor(matched, currentTargetGroups);
596
- if (removedTargetGroups && removedTargetGroups.length > 0) {
597
- command.viewState.dirty.targetGroups = removedTargetGroups;
598
- } else if (command.viewState.dirty && command.viewState.dirty.targetGroups) {
599
- command.viewState.dirty.targetGroups = [];
600
- }
601
- }
602
-
603
- command.backingData.filtered.loadBalancers = newLoadBalancers;
604
- command.backingData.filtered.vpcLoadBalancers = vpcLoadBalancers;
605
- command.backingData.filtered.targetGroups = allTargetGroups;
606
- return result;
607
- }
608
-
609
- public refreshLoadBalancers(command: IEcsServerGroupCommand, skipCommandReconfiguration?: boolean) {
610
- return this.loadBalancerReader.listLoadBalancers('ecs').then((loadBalancers) => {
611
- command.backingData.loadBalancers = loadBalancers;
612
- if (!skipCommandReconfiguration) {
613
- this.configureLoadBalancerOptions(command);
614
- }
615
- });
616
- }
617
-
618
- public configureVpcId(command: IEcsServerGroupCommand): IEcsServerGroupCommandResult {
619
- const result: IEcsServerGroupCommandResult = { dirty: {} };
620
- if (command.subnetType == null && (command.subnetTypes == null || command.subnetTypes.length == 0)) {
621
- command.vpcId = null;
622
- result.dirty.vpcId = true;
623
- } else if (command.subnetTypes != null && command.subnetTypes.length > 0) {
624
- command.subnetTypes.forEach(function (subnetType) {
625
- const subnet = find<ISubnet>(command.backingData.subnets, {
626
- purpose: subnetType,
627
- account: command.credentials,
628
- region: command.region,
629
- });
630
- command.vpcId = subnet ? subnet.vpcId : null;
631
- });
632
- } else {
633
- const subnet = find<ISubnet>(command.backingData.subnets, {
634
- purpose: command.subnetType,
635
- account: command.credentials,
636
- region: command.region,
637
- });
638
- command.vpcId = subnet ? subnet.vpcId : null;
639
- }
640
- return result;
641
- }
642
-
643
- public checkDirtyCapacityProviders(command: IEcsServerGroupCommand): void {
644
- if (command.capacityProviderStrategy) {
645
- const availableCustomCapacityProviders = command.backingData.filtered.availableCapacityProviders;
646
- const currentCapacityProviders = command.capacityProviderStrategy.map((cp) => cp.capacityProvider);
647
- const matchedCustomCapacityProviders = intersection(availableCustomCapacityProviders, currentCapacityProviders);
648
- const removedCustomCapacityProviders = xor(matchedCustomCapacityProviders, currentCapacityProviders);
649
-
650
- if (removedCustomCapacityProviders && removedCustomCapacityProviders.length > 0) {
651
- command.viewState.dirty.customCapacityProviders = removedCustomCapacityProviders;
652
- } else if (command.viewState.dirty && command.viewState.dirty.customCapacityProviders) {
653
- command.viewState.dirty.customCapacityProviders = [];
654
- }
655
-
656
- if (command.useDefaultCapacityProviders) {
657
- const availableDefaultCapacityProvider = command.backingData.filtered.defaultCapacityProviderStrategy.map(
658
- (cp) => cp.capacityProvider,
659
- );
660
- const matchedDefaultCapacityProviders = intersection(
661
- availableDefaultCapacityProvider,
662
- currentCapacityProviders,
663
- );
664
- const removedDefaultCapacityProviders = xor(matchedDefaultCapacityProviders, currentCapacityProviders);
665
-
666
- if (removedDefaultCapacityProviders && removedDefaultCapacityProviders.length > 0) {
667
- command.viewState.dirty.defaulCapacityProviders = removedDefaultCapacityProviders;
668
- }
669
- }
670
- }
671
- }
672
-
673
- public attachEventHandlers(cmd: IEcsServerGroupCommand): void {
674
- cmd.subnetChanged = (command: IEcsServerGroupCommand): IServerGroupCommandResult => {
675
- const result = this.configureVpcId(command);
676
- extend(result.dirty, this.configureLoadBalancerOptions(command).dirty);
677
- command.viewState.dirty = command.viewState.dirty || {};
678
- extend(command.viewState.dirty, result.dirty);
679
- return result;
680
- };
681
-
682
- cmd.regionChanged = (command: IEcsServerGroupCommand): IServerGroupCommandResult => {
683
- const result: IEcsServerGroupCommandResult = { dirty: {} };
684
- extend(result.dirty, this.configureSubnetPurposes(command).dirty);
685
- if (command.region) {
686
- extend(result.dirty, command.subnetChanged(command).dirty);
687
- this.configureAvailabilityZones(command);
688
- this.configureAvailableEcsClusters(command);
689
- this.configureAvailableSubnetTypes(command);
690
- this.configureAvailableSecurityGroups(command);
691
- this.configureAvailableSecrets(command);
692
- this.configureAvailableServiceDiscoveryRegistries(command);
693
- this.setCapacityProviderDetails(command);
694
- }
695
-
696
- return result;
697
- };
698
-
699
- cmd.subnetTypeChanged = (command: IEcsServerGroupCommand): IServerGroupCommandResult => {
700
- const result: IEcsServerGroupCommandResult = { dirty: {} };
701
- this.configureAvailableSecurityGroups(command);
702
- return result;
703
- };
704
-
705
- cmd.clusterChanged = (command: IEcsServerGroupCommand): void => {
706
- command.moniker = NameUtils.getMoniker(command.application, command.stack, command.freeFormDetails);
707
- };
708
-
709
- cmd.credentialsChanged = (command: IEcsServerGroupCommand): IServerGroupCommandResult => {
710
- const result: IEcsServerGroupCommandResult = { dirty: {} };
711
- const backingData = command.backingData;
712
- if (command.credentials) {
713
- this.configureAvailableIamRoles(command);
714
- this.configureAvailableEcsClusters(command);
715
- this.configureAvailableSubnetTypes(command);
716
- this.configureAvailableSecurityGroups(command);
717
- this.configureAvailableSecrets(command);
718
- this.configureAvailableServiceDiscoveryRegistries(command);
719
- this.configureAvailableRegions(command);
720
- this.setCapacityProviderDetails(command);
721
-
722
- if (!some(backingData.filtered.regions, { name: command.region })) {
723
- command.region = null;
724
- result.dirty.region = true;
725
- } else {
726
- extend(result.dirty, command.regionChanged(command).dirty);
727
- }
728
- } else {
729
- command.region = null;
730
- }
731
- return result;
732
- };
733
-
734
- cmd.placementStrategyNameChanged = (command: IEcsServerGroupCommand): IServerGroupCommandResult => {
735
- const result: IEcsServerGroupCommandResult = { dirty: {} };
736
- command.placementStrategySequence = this.placementStrategyService.getPredefinedStrategy(
737
- command.placementStrategyName,
738
- );
739
- return result;
740
- };
741
-
742
- this.applyOverrides('attachEventHandlers', cmd);
743
- }
744
135
  }
745
-
746
- export const ECS_SERVER_GROUP_CONFIGURATION_SERVICE = 'spinnaker.ecs.serverGroup.configure.service';
747
- module(ECS_SERVER_GROUP_CONFIGURATION_SERVICE, [
748
- LOAD_BALANCER_READ_SERVICE,
749
- SECURITY_GROUP_READER,
750
- CACHE_INITIALIZER_SERVICE,
751
- SERVER_GROUP_COMMAND_REGISTRY_PROVIDER,
752
- ]).service('ecsServerGroupConfigurationService', EcsServerGroupConfigurationService);