@spinnaker/oracle 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 (138) hide show
  1. package/dist/image/image.reader.d.ts +4 -2
  2. package/dist/index.d.ts +3 -1
  3. package/dist/index.js +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/instance/details/OracleInstanceDetails.d.ts +2 -0
  6. package/dist/loadBalancer/details/OracleLoadBalancerDetails.d.ts +10 -0
  7. package/dist/loadBalancer/loadBalancer.transformer.d.ts +4 -5
  8. package/dist/oracle.provider.d.ts +3 -0
  9. package/dist/pipeline/stages/bake/OracleBakeStageConfig.d.ts +50 -0
  10. package/dist/pipeline/stages/destroyAsg/OracleDestroyAsgStageConfig.d.ts +26 -0
  11. package/dist/pipeline/stages/disableAsg/OracleDisableAsgStageConfig.d.ts +26 -0
  12. package/dist/pipeline/stages/findAmi/OracleFindAmiStageConfig.d.ts +19 -0
  13. package/dist/pipeline/stages/findImageFromTags/OracleFindImageFromTagsStageConfig.d.ts +16 -0
  14. package/dist/pipeline/stages/resizeAsg/OracleResizeAsgStageConfig.d.ts +26 -0
  15. package/dist/pipeline/stages/scaleDownCluster/OracleScaleDownClusterStageConfig.d.ts +20 -0
  16. package/dist/pipeline/stages/shrinkCluster/OracleShrinkClusterStageConfig.d.ts +19 -0
  17. package/dist/securityGroup/details/OracleSecurityGroupDetails.d.ts +2 -0
  18. package/dist/securityGroup/securityGroup.reader.d.ts +3 -2
  19. package/dist/securityGroup/securityGroup.transformer.d.ts +3 -2
  20. package/dist/serverGroup/configure/serverGroupCommandBuilder.service.d.ts +41 -2
  21. package/dist/serverGroup/configure/serverGroupConfiguration.service.d.ts +8 -2
  22. package/dist/serverGroup/details/OracleServerGroupDetails.d.ts +6 -0
  23. package/dist/serverGroup/serverGroup.transformer.d.ts +4 -2
  24. package/package.json +5 -9
  25. package/src/image/image.reader.js +4 -13
  26. package/src/index.ts +4 -1
  27. package/src/instance/details/OracleInstanceDetails.tsx +21 -0
  28. package/src/loadBalancer/details/OracleLoadBalancerDetails.spec.tsx +48 -0
  29. package/src/loadBalancer/details/OracleLoadBalancerDetails.tsx +84 -0
  30. package/src/loadBalancer/loadBalancer.transformer.ts +5 -11
  31. package/src/oracle.provider.spec.ts +45 -0
  32. package/src/oracle.provider.ts +85 -0
  33. package/src/pipeline/stages/bake/OracleBakeStageConfig.tsx +325 -0
  34. package/src/pipeline/stages/destroyAsg/OracleDestroyAsgStageConfig.tsx +87 -0
  35. package/src/pipeline/stages/disableAsg/OracleDisableAsgStageConfig.tsx +105 -0
  36. package/src/pipeline/stages/findAmi/OracleFindAmiStageConfig.tsx +103 -0
  37. package/src/pipeline/stages/findImageFromTags/OracleFindImageFromTagsStageConfig.tsx +90 -0
  38. package/src/pipeline/stages/resizeAsg/OracleResizeAsgStageConfig.tsx +225 -0
  39. package/src/pipeline/stages/scaleDownCluster/OracleScaleDownClusterStageConfig.tsx +122 -0
  40. package/src/pipeline/stages/shrinkCluster/OracleShrinkClusterStageConfig.tsx +136 -0
  41. package/src/securityGroup/details/OracleSecurityGroupDetails.tsx +19 -0
  42. package/src/securityGroup/securityGroup.reader.js +3 -11
  43. package/src/securityGroup/securityGroup.transformer.js +8 -15
  44. package/src/serverGroup/configure/serverGroupCommandBuilder.service.js +71 -87
  45. package/src/serverGroup/configure/serverGroupConfiguration.service.js +210 -214
  46. package/src/serverGroup/details/OracleServerGroupDetails.spec.ts +47 -0
  47. package/src/serverGroup/details/OracleServerGroupDetails.tsx +106 -0
  48. package/src/serverGroup/serverGroup.transformer.js +11 -23
  49. package/dist/common/footer.component.d.ts +0 -2
  50. package/dist/instance/details/instance.details.controller.d.ts +0 -2
  51. package/dist/loadBalancer/configure/createLoadBalancer.controller.d.ts +0 -87
  52. package/dist/loadBalancer/details/loadBalancerDetail.controller.d.ts +0 -21
  53. package/dist/oracle.module.d.ts +0 -2
  54. package/dist/pipeline/stages/bake/bakeExecutionDetails.controller.d.ts +0 -2
  55. package/dist/pipeline/stages/bake/ociBakeStage.d.ts +0 -2
  56. package/dist/pipeline/stages/destroyAsg/destroyAsgStage.d.ts +0 -2
  57. package/dist/pipeline/stages/disableAsg/disableAsgStage.d.ts +0 -2
  58. package/dist/pipeline/stages/findAmi/findAmiStage.d.ts +0 -2
  59. package/dist/pipeline/stages/findImageFromTags/oracleFindImageFromTagsStage.d.ts +0 -2
  60. package/dist/pipeline/stages/resizeAsg/resizeAsgStage.d.ts +0 -2
  61. package/dist/pipeline/stages/scaleDownCluster/scaleDownClusterStage.d.ts +0 -2
  62. package/dist/pipeline/stages/shrinkCluster/shrinkClusterStage.d.ts +0 -2
  63. package/dist/securityGroup/configure/createSecurityGroup.controller.d.ts +0 -2
  64. package/dist/serverGroup/configure/serverGroup.configure.module.d.ts +0 -2
  65. package/dist/serverGroup/configure/wizard/basicSettings/basicSettings.controller.d.ts +0 -2
  66. package/dist/serverGroup/configure/wizard/capacity/capacitySelector.component.d.ts +0 -2
  67. package/dist/serverGroup/configure/wizard/cloneServerGroup.controller.d.ts +0 -2
  68. package/dist/serverGroup/details/resize/resizeCapacity.component.d.ts +0 -2
  69. package/dist/serverGroup/details/resize/resizeServerGroup.controller.d.ts +0 -2
  70. package/dist/serverGroup/details/rollback/rollbackServerGroup.controller.d.ts +0 -2
  71. package/dist/serverGroup/details/serverGroupDetails.controller.d.ts +0 -2
  72. package/src/common/footer.component.html +0 -7
  73. package/src/common/footer.component.js +0 -18
  74. package/src/common/ocid/ocid.component.js +0 -15
  75. package/src/common/ocid/ocid.template.html +0 -10
  76. package/src/common/ocid/truncateOcid.filter.js +0 -14
  77. package/src/instance/details/instance.details.controller.js +0 -56
  78. package/src/instance/details/instanceDetails.html +0 -31
  79. package/src/loadBalancer/configure/backendSets.html +0 -67
  80. package/src/loadBalancer/configure/certificates.html +0 -63
  81. package/src/loadBalancer/configure/createLoadBalancer.controller.spec.ts +0 -201
  82. package/src/loadBalancer/configure/createLoadBalancer.controller.ts +0 -540
  83. package/src/loadBalancer/configure/createLoadBalancer.html +0 -25
  84. package/src/loadBalancer/configure/createLoadBalancerProperties.html +0 -167
  85. package/src/loadBalancer/configure/editLoadBalancer.html +0 -26
  86. package/src/loadBalancer/configure/listeners.html +0 -88
  87. package/src/loadBalancer/details/loadBalancerDetail.controller.spec.ts +0 -62
  88. package/src/loadBalancer/details/loadBalancerDetail.controller.ts +0 -163
  89. package/src/loadBalancer/details/loadBalancerDetail.html +0 -100
  90. package/src/oracle.module.ts +0 -94
  91. package/src/pipeline/disableAsg/disableAsgStage.html +0 -11
  92. package/src/pipeline/disableAsg/disableAsgStage.js +0 -62
  93. package/src/pipeline/disableAsg/disableAsgStepLabel.html +0 -1
  94. package/src/pipeline/stages/bake/bakeExecutionDetails.controller.js +0 -38
  95. package/src/pipeline/stages/bake/bakeExecutionDetails.html +0 -52
  96. package/src/pipeline/stages/bake/bakeStage.html +0 -109
  97. package/src/pipeline/stages/bake/ociBakeStage.js +0 -147
  98. package/src/pipeline/stages/destroyAsg/destroyAsgStage.html +0 -9
  99. package/src/pipeline/stages/destroyAsg/destroyAsgStage.js +0 -64
  100. package/src/pipeline/stages/destroyAsg/destroyAsgStepLabel.html +0 -1
  101. package/src/pipeline/stages/disableAsg/disableAsgStage.html +0 -11
  102. package/src/pipeline/stages/disableAsg/disableAsgStage.js +0 -63
  103. package/src/pipeline/stages/disableAsg/disableAsgStepLabel.html +0 -1
  104. package/src/pipeline/stages/findAmi/findAmiStage.html +0 -20
  105. package/src/pipeline/stages/findAmi/findAmiStage.js +0 -82
  106. package/src/pipeline/stages/findImageFromTags/findImageFromTagsExecutionDetails.html +0 -44
  107. package/src/pipeline/stages/findImageFromTags/findImageFromTagsStage.html +0 -11
  108. package/src/pipeline/stages/findImageFromTags/oracleFindImageFromTagsStage.js +0 -36
  109. package/src/pipeline/stages/resizeAsg/resizeAsgStage.html +0 -89
  110. package/src/pipeline/stages/resizeAsg/resizeAsgStage.js +0 -101
  111. package/src/pipeline/stages/resizeAsg/resizeAsgStepLabel.html +0 -1
  112. package/src/pipeline/stages/scaleDownCluster/scaleDownClusterStage.html +0 -35
  113. package/src/pipeline/stages/scaleDownCluster/scaleDownClusterStage.js +0 -75
  114. package/src/pipeline/stages/shrinkCluster/shrinkClusterStage.html +0 -34
  115. package/src/pipeline/stages/shrinkCluster/shrinkClusterStage.js +0 -71
  116. package/src/securityGroup/configure/createSecurityGroup.controller.js +0 -19
  117. package/src/securityGroup/configure/createSecurityGroup.html +0 -19
  118. package/src/serverGroup/configure/serverGroup.configure.module.js +0 -15
  119. package/src/serverGroup/configure/wizard/advancedSettings/advancedSettings.html +0 -13
  120. package/src/serverGroup/configure/wizard/basicSettings/basicSettings.controller.js +0 -35
  121. package/src/serverGroup/configure/wizard/basicSettings/basicSettings.html +0 -134
  122. package/src/serverGroup/configure/wizard/capacity/capacity.html +0 -7
  123. package/src/serverGroup/configure/wizard/capacity/capacitySelector.component.html +0 -13
  124. package/src/serverGroup/configure/wizard/capacity/capacitySelector.component.js +0 -17
  125. package/src/serverGroup/configure/wizard/cloneServerGroup.controller.js +0 -109
  126. package/src/serverGroup/configure/wizard/instanceType/instanceType.html +0 -29
  127. package/src/serverGroup/configure/wizard/loadBalancers/loadBalancers.html +0 -44
  128. package/src/serverGroup/configure/wizard/network/networkSettings.html +0 -15
  129. package/src/serverGroup/configure/wizard/serverGroupWizard.html +0 -40
  130. package/src/serverGroup/configure/wizard/templateSelection/templateSelection.html +0 -9
  131. package/src/serverGroup/details/resize/resizeCapacity.component.html +0 -36
  132. package/src/serverGroup/details/resize/resizeCapacity.component.js +0 -42
  133. package/src/serverGroup/details/resize/resizeServerGroup.controller.js +0 -62
  134. package/src/serverGroup/details/resize/resizeServerGroup.html +0 -33
  135. package/src/serverGroup/details/rollback/rollbackServerGroup.controller.js +0 -73
  136. package/src/serverGroup/details/rollback/rollbackServerGroup.html +0 -41
  137. package/src/serverGroup/details/serverGroupDetails.controller.js +0 -230
  138. package/src/serverGroup/details/serverGroupDetails.html +0 -94
@@ -1,15 +1,7 @@
1
1
  'use strict';
2
2
 
3
- import { module } from 'angular';
4
-
5
- export const ORACLE_SECURITYGROUP_SECURITYGROUP_READER = 'spinnaker.oracle.securityGroup.reader';
6
- export const name = ORACLE_SECURITYGROUP_SECURITYGROUP_READER; // for backwards compatibility
7
- module(ORACLE_SECURITYGROUP_SECURITYGROUP_READER, []).factory('oracleSecurityGroupReader', function () {
8
- function resolveIndexedSecurityGroup(indexedSecurityGroups, container, securityGroupId) {
3
+ export class OracleSecurityGroupReader {
4
+ resolveIndexedSecurityGroup(indexedSecurityGroups, container, securityGroupId) {
9
5
  return indexedSecurityGroups[container.account][container.region][securityGroupId];
10
6
  }
11
-
12
- return {
13
- resolveIndexedSecurityGroup: resolveIndexedSecurityGroup,
14
- };
15
- });
7
+ }
@@ -1,25 +1,18 @@
1
1
  'use strict';
2
2
 
3
- import { module } from 'angular';
4
3
  import _ from 'lodash';
5
4
 
6
5
  import { NetworkReader } from '@spinnaker/core';
7
6
 
8
- export const ORACLE_SECURITYGROUP_SECURITYGROUP_TRANSFORMER = 'spinnaker.oracle.securityGroup.transformer';
9
- export const name = ORACLE_SECURITYGROUP_SECURITYGROUP_TRANSFORMER; // for backwards compatibility
10
- module(ORACLE_SECURITYGROUP_SECURITYGROUP_TRANSFORMER, []).factory('oracleSecurityGroupTransformer', function () {
11
- const provider = 'oracle';
12
-
13
- function normalizeSecurityGroup(securityGroup) {
7
+ export class OracleSecurityGroupTransformer {
8
+ normalizeSecurityGroup(securityGroup) {
14
9
  return NetworkReader.listNetworksByProvider(provider).then(_.partial(addVcnNameToSecurityGroup, securityGroup));
15
10
  }
11
+ }
16
12
 
17
- function addVcnNameToSecurityGroup(securityGroup, vcns) {
18
- const matches = vcns.find((vcn) => vcn.id === securityGroup.network);
19
- securityGroup.vpcName = matches.length ? matches[0].name : '';
20
- }
13
+ const provider = 'oracle';
21
14
 
22
- return {
23
- normalizeSecurityGroup: normalizeSecurityGroup,
24
- };
25
- });
15
+ function addVcnNameToSecurityGroup(securityGroup, vcns) {
16
+ const match = vcns.find((vcn) => vcn.id === securityGroup.network);
17
+ securityGroup.vpcName = match ? match.name : '';
18
+ }
@@ -1,105 +1,89 @@
1
1
  'use strict';
2
2
 
3
- import * as angular from 'angular';
4
3
  import _ from 'lodash';
5
4
 
6
5
  import { NameUtils } from '@spinnaker/core';
7
6
 
8
7
  import { OracleProviderSettings } from '../../oracle.settings';
9
8
 
10
- export const ORACLE_SERVERGROUP_CONFIGURE_SERVERGROUPCOMMANDBUILDER_SERVICE =
11
- 'spinnaker.oracle.serverGroupCommandBuilder.service';
12
- export const name = ORACLE_SERVERGROUP_CONFIGURE_SERVERGROUPCOMMANDBUILDER_SERVICE; // for backwards compatibility
13
- angular
14
- .module(ORACLE_SERVERGROUP_CONFIGURE_SERVERGROUPCOMMANDBUILDER_SERVICE, [])
15
- .factory('oracleServerGroupCommandBuilder', [
16
- '$q',
17
- function ($q) {
18
- const oracle = 'oracle';
9
+ const oracle = 'oracle';
19
10
 
20
- function buildNewServerGroupCommand(application, defaults) {
21
- defaults = defaults || {};
11
+ export class OracleServerGroupCommandBuilder {
12
+ buildNewServerGroupCommand(application, defaults) {
13
+ defaults = defaults || {};
22
14
 
23
- const defaultAccount = defaults.account || OracleProviderSettings.defaults.account;
24
- const defaultRegion = defaults.region || OracleProviderSettings.defaults.region;
15
+ const defaultAccount = defaults.account || OracleProviderSettings.defaults.account;
16
+ const defaultRegion = defaults.region || OracleProviderSettings.defaults.region;
25
17
 
26
- const command = {
27
- account: defaultAccount,
28
- application: application.name,
29
- capacity: {
30
- desired: 1,
31
- },
32
- region: defaultRegion,
33
- selectedProvider: oracle,
34
- viewState: {
35
- mode: defaults.mode || 'create',
36
- disableStrategySelection: true,
37
- },
38
- };
18
+ const command = {
19
+ account: defaultAccount,
20
+ application: application.name,
21
+ capacity: {
22
+ desired: 1,
23
+ },
24
+ region: defaultRegion,
25
+ selectedProvider: oracle,
26
+ viewState: {
27
+ mode: defaults.mode || 'create',
28
+ disableStrategySelection: true,
29
+ },
30
+ };
39
31
 
40
- return $q.when(command);
41
- }
32
+ return Promise.resolve(command);
33
+ }
42
34
 
43
- function buildServerGroupCommandFromExisting(application, serverGroup, mode) {
44
- mode = mode || 'clone';
45
- const serverGroupName = NameUtils.parseServerGroupName(serverGroup.name);
35
+ buildServerGroupCommandFromExisting(application, serverGroup, mode) {
36
+ mode = mode || 'clone';
37
+ const serverGroupName = NameUtils.parseServerGroupName(serverGroup.name);
46
38
 
47
- const command = {
48
- account: serverGroup.account,
49
- application: application.name,
50
- shape: serverGroup.launchConfig.shape,
51
- strategy: '',
52
- stack: serverGroupName.stack,
53
- vpcId: serverGroup.launchConfig.vpcId,
54
- subnetId: serverGroup.launchConfig.subnetId,
55
- region: serverGroup.region,
56
- availabilityDomain: serverGroup.launchConfig.availabilityDomain,
57
- sshAuthorizedKeys: serverGroup.launchConfig.sshAuthorizedKeys,
58
- selectedProvider: oracle,
59
- capacity: {
60
- desired: serverGroup.capacity.desired,
61
- },
62
- viewState: {
63
- mode: mode,
64
- disableStrategySelection: true,
65
- },
66
- };
67
- return $q.when(command);
68
- }
39
+ const command = {
40
+ account: serverGroup.account,
41
+ application: application.name,
42
+ shape: serverGroup.launchConfig.shape,
43
+ strategy: '',
44
+ stack: serverGroupName.stack,
45
+ vpcId: serverGroup.launchConfig.vpcId,
46
+ subnetId: serverGroup.launchConfig.subnetId,
47
+ region: serverGroup.region,
48
+ availabilityDomain: serverGroup.launchConfig.availabilityDomain,
49
+ sshAuthorizedKeys: serverGroup.launchConfig.sshAuthorizedKeys,
50
+ selectedProvider: oracle,
51
+ capacity: {
52
+ desired: serverGroup.capacity.desired,
53
+ },
54
+ viewState: {
55
+ mode: mode,
56
+ disableStrategySelection: true,
57
+ },
58
+ };
59
+ return Promise.resolve(command);
60
+ }
69
61
 
70
- function buildServerGroupCommandFromPipeline(application, originalCluster) {
71
- const pipelineCluster = _.cloneDeep(originalCluster);
72
- const commandDefaults = { account: pipelineCluster.account, region: pipelineCluster.region };
73
- return buildNewServerGroupCommand(application, commandDefaults).then((command) => {
74
- const viewState = {
75
- disableImageSelection: true,
76
- mode: 'editPipeline',
77
- submitButtonLabel: 'Done',
78
- templatingEnabled: true,
79
- };
80
-
81
- const viewOverrides = {
82
- viewState: viewState,
83
- };
62
+ buildServerGroupCommandFromPipeline(application, originalCluster) {
63
+ const pipelineCluster = _.cloneDeep(originalCluster);
64
+ const commandDefaults = { account: pipelineCluster.account, region: pipelineCluster.region };
65
+ return this.buildNewServerGroupCommand(application, commandDefaults).then((command) => {
66
+ const viewState = {
67
+ disableImageSelection: true,
68
+ mode: 'editPipeline',
69
+ submitButtonLabel: 'Done',
70
+ templatingEnabled: true,
71
+ };
84
72
 
85
- pipelineCluster.strategy = pipelineCluster.strategy || '';
86
- return angular.extend({}, command, pipelineCluster, viewOverrides);
87
- });
88
- }
73
+ const viewOverrides = {
74
+ viewState: viewState,
75
+ };
89
76
 
90
- function buildNewServerGroupCommandForPipeline() {
91
- return $q.when({
92
- viewState: {
93
- requiresTemplateSelection: true,
94
- },
95
- });
96
- }
77
+ pipelineCluster.strategy = pipelineCluster.strategy || '';
78
+ return _.assign({}, command, pipelineCluster, viewOverrides);
79
+ });
80
+ }
97
81
 
98
- return {
99
- buildNewServerGroupCommand: buildNewServerGroupCommand,
100
- buildServerGroupCommandFromExisting: buildServerGroupCommandFromExisting,
101
- buildNewServerGroupCommandForPipeline: buildNewServerGroupCommandForPipeline,
102
- buildServerGroupCommandFromPipeline: buildServerGroupCommandFromPipeline,
103
- };
104
- },
105
- ]);
82
+ buildNewServerGroupCommandForPipeline() {
83
+ return Promise.resolve({
84
+ viewState: {
85
+ requiresTemplateSelection: true,
86
+ },
87
+ });
88
+ }
89
+ }
@@ -1,229 +1,225 @@
1
1
  'use strict';
2
2
 
3
- import { module } from 'angular';
4
3
  import _ from 'lodash';
5
4
 
6
- import { AccountService, NetworkReader, SECURITY_GROUP_READER, SubnetReader } from '@spinnaker/core';
5
+ import { AccountService, NetworkReader, SubnetReader } from '@spinnaker/core';
6
+
7
+ import { OracleImageReader } from '../../image/image.reader';
7
8
  import { OracleProviderSettings } from '../../oracle.settings';
8
9
 
9
- export const ORACLE_SERVERGROUP_CONFIGURE_SERVERGROUPCONFIGURATION_SERVICE =
10
- 'spinnaker.oracle.serverGroup.configure.configuration.service';
11
- export const name = ORACLE_SERVERGROUP_CONFIGURE_SERVERGROUPCONFIGURATION_SERVICE; // for backwards compatibility
12
- module(ORACLE_SERVERGROUP_CONFIGURE_SERVERGROUPCONFIGURATION_SERVICE, [SECURITY_GROUP_READER]).factory(
13
- 'oracleServerGroupConfigurationService',
14
- [
15
- '$q',
16
- 'oracleImageReader',
17
- 'securityGroupReader',
18
- function ($q, oracleImageReader, securityGroupReader) {
19
- const oracle = 'oracle';
20
-
21
- const getShapes = (image) => {
22
- if (!image || !image.compatibleShapes) {
23
- return [];
24
- }
25
- return image.compatibleShapes.map((shape) => {
26
- return { name: shape };
27
- });
28
- };
10
+ const oracle = 'oracle';
29
11
 
30
- const loadAndSelectRegions = (command, backingData) => {
31
- if (command.account) {
32
- const selectedAccountDetails = backingData.credentialsKeyedByAccount[command.account];
33
- if (!selectedAccountDetails) {
34
- return;
35
- }
36
- backingData.filtered.regions = _.map(selectedAccountDetails.regions, (region) => {
37
- return { name: region.name };
38
- });
39
- if (selectedAccountDetails) {
40
- command.region = selectedAccountDetails.region;
41
- }
42
- }
43
- };
44
-
45
- const loadAvailabilityDomains = (command) => {
46
- if (command.account && command.region) {
47
- AccountService.getAvailabilityZonesForAccountAndRegion(oracle, command.account, command.region).then(
48
- (availDoms) => {
49
- if (availDoms) {
50
- command.backingData.filtered.availabilityDomains = availDoms.map((av) => {
51
- return { name: av };
52
- });
53
- } else {
54
- command.backingData.filtered.availabilityDomains = [];
55
- command.availabilityDomain = null;
56
- }
57
- },
58
- );
59
- }
60
- };
12
+ export class OracleServerGroupConfigurationService {
13
+ static requiresDeckRuntimeServices = true;
61
14
 
62
- const loadLoadBalancers = (command) => {
63
- if (command.account && command.region) {
64
- command.backingData.filtered.loadBalancers = command.backingData.loadBalancers.filter(function (lb) {
65
- return lb.region === command.region && lb.account === command.account;
66
- });
67
- }
68
- };
69
-
70
- function configureCommand(application, command) {
71
- const defaults = command || {};
72
- const defaultCredentials =
73
- defaults.account || application.defaultCredentials.oracle || OracleProviderSettings.defaults.account;
74
- const defaultRegion =
75
- defaults.region || application.defaultRegions.oracle || OracleProviderSettings.defaults.region;
76
-
77
- return $q
78
- .all([
79
- AccountService.getCredentialsKeyedByAccount(oracle),
80
- NetworkReader.listNetworksByProvider(oracle),
81
- SubnetReader.listSubnetsByProvider(oracle),
82
- securityGroupReader.getAllSecurityGroups(),
83
- loadImages(),
84
- AccountService.getAvailabilityZonesForAccountAndRegion(oracle, defaultCredentials, defaultRegion),
85
- ])
86
- .then(function ([credentialsKeyedByAccount, networks, subnets, securityGroups, images, availDomains]) {
87
- const backingData = {
88
- credentialsKeyedByAccount,
89
- networks,
90
- subnets,
91
- securityGroups,
92
- images,
93
- availDomains,
94
- };
95
-
96
- backingData.accounts = _.keys(backingData.credentialsKeyedByAccount);
97
- backingData.filtered = {};
98
- loadAndSelectRegions(command, backingData);
99
- backingData.filtered.availabilityDomains = _.map(backingData.availDomains, function (zone) {
100
- return { name: zone };
101
- });
15
+ constructor(_promiseService, runtimeServices) {
16
+ this.oracleImageReader = new OracleImageReader();
17
+ this.securityGroupReader = runtimeServices.securityGroupReader;
18
+ }
102
19
 
103
- backingData.filterSubnets = function () {
104
- if (command.vpcId && command.availabilityDomain) {
105
- return _.filter(backingData.subnets, {
106
- vcnId: command.vpcId,
107
- availabilityDomain: command.availabilityDomain,
108
- });
109
- }
110
- return backingData.subnets;
111
- };
112
-
113
- backingData.loadBalancers = application.loadBalancers.data;
114
-
115
- backingData.accountOnChange = function () {
116
- loadAndSelectRegions(command, command.backingData);
117
- loadAvailabilityDomains(command);
118
- loadLoadBalancers(command);
119
- };
120
-
121
- backingData.regionOnChange = function () {
122
- loadAvailabilityDomains(command);
123
- loadLoadBalancers(command);
124
- };
125
-
126
- backingData.availabilityDomainOnChange = function () {
127
- command.subnetId = null;
128
- backingData.seclists = null;
129
- };
130
-
131
- backingData.vpcOnChange = function () {
132
- command.subnetId = null;
133
- backingData.seclists = null;
134
- };
135
-
136
- backingData.subnetOnChange = function () {
137
- const subnet = _.find(backingData.subnets, { id: command.subnetId });
138
- const mySecGroups = backingData.securityGroups[command.account][oracle][command.region];
139
- const secLists = [];
140
- _.forEach(subnet.securityListIds, function (sid) {
141
- const sgRef = _.find(mySecGroups, { id: sid });
142
- securityGroupReader
143
- .getSecurityGroupDetails(
144
- command.application,
145
- command.account,
146
- oracle,
147
- command.region,
148
- command.vpcId,
149
- sgRef.name,
150
- )
151
- .then(function (sgd) {
152
- secLists.push(sgd);
153
- backingData.seclists = secLists;
154
- });
20
+ configureCommand(application, command) {
21
+ const oracleImageReader = this.oracleImageReader;
22
+ const securityGroupReader = this.securityGroupReader;
23
+
24
+ const getShapes = (image) => {
25
+ if (!image || !image.compatibleShapes) {
26
+ return [];
27
+ }
28
+ return image.compatibleShapes.map((shape) => {
29
+ return { name: shape };
30
+ });
31
+ };
32
+
33
+ const loadAndSelectRegions = (command, backingData) => {
34
+ if (command.account) {
35
+ const selectedAccountDetails = backingData.credentialsKeyedByAccount[command.account];
36
+ if (!selectedAccountDetails) {
37
+ return;
38
+ }
39
+ backingData.filtered.regions = _.map(selectedAccountDetails.regions, (region) => {
40
+ return { name: region.name };
41
+ });
42
+ if (selectedAccountDetails) {
43
+ command.region = selectedAccountDetails.region;
44
+ }
45
+ }
46
+ };
47
+
48
+ const loadAvailabilityDomains = (command) => {
49
+ if (command.account && command.region) {
50
+ AccountService.getAvailabilityZonesForAccountAndRegion(oracle, command.account, command.region).then(
51
+ (availDoms) => {
52
+ if (availDoms) {
53
+ command.backingData.filtered.availabilityDomains = availDoms.map((av) => {
54
+ return { name: av };
155
55
  });
156
- };
157
-
158
- backingData.findBackendSetsByLoadBalancerId = (loadBalancerId) => {
159
- const lb = backingData.filtered.loadBalancers.find((lb) => lb.id === loadBalancerId);
160
- if (lb && lb.backendSets) {
161
- //reduce the backendSets object to an array. The object is keyed by the backendSet name
162
- const bsetArray = [];
163
- Object.keys(lb.backendSets).reduce((arr, bsetName) => {
164
- const bset = lb.backendSets[bsetName];
165
- bset['name'] = bsetName;
166
- arr.push(bset);
167
- return arr;
168
- }, bsetArray);
169
- return bsetArray;
170
- } else {
171
- return [];
172
- }
173
- };
174
-
175
- backingData.findLoadBalListenersByBackendSetName = (loadBalancerId, backendSetName) => {
176
- const lb = backingData.filtered.loadBalancers.find((lb) => lb.id === loadBalancerId);
177
- if (lb && lb.listeners) {
178
- return Object.keys(lb.listeners)
179
- .filter((lisName) => lb.listeners[lisName].defaultBackendSetName === backendSetName)
180
- .map((lisName) => lb.listeners[lisName]);
181
- } else {
182
- return [];
183
- }
184
- };
185
-
186
- backingData.loadBalancerOnChange = () => {
187
- if (command.loadBalancerId) {
188
- backingData.filtered.backendSets = backingData.findBackendSetsByLoadBalancerId(command.loadBalancerId);
189
- } else {
190
- //no backend set name should be set if no load balancer id is set
191
- command.backendSetName = undefined;
192
- backingData.backendSetOnChange();
193
- backingData.filtered.backendSets = [];
194
- }
195
- };
196
-
197
- backingData.backendSetOnChange = () => {
198
- backingData.filtered.listeners =
199
- command.loadBalancerId && command.backendSetName
200
- ? backingData.findLoadBalListenersByBackendSetName(command.loadBalancerId, command.backendSetName)
201
- : [];
202
- };
203
-
204
- backingData.filtered.images = backingData.images;
205
- const shapesMap = {};
206
- _.forEach(backingData.filtered.images, (image) => {
207
- shapesMap[image.id] = getShapes(image);
208
- });
209
- backingData.filtered.shapes = shapesMap;
210
- backingData.filtered.allShapes = _.uniqBy(_.flatten(_.values(shapesMap)), 'name');
211
- command.backingData = backingData;
212
- if (command.account) {
213
- loadLoadBalancers(command);
214
- backingData.loadBalancerOnChange();
215
- backingData.backendSetOnChange();
56
+ } else {
57
+ command.backingData.filtered.availabilityDomains = [];
58
+ command.availabilityDomain = null;
216
59
  }
217
- });
60
+ },
61
+ );
218
62
  }
63
+ };
219
64
 
220
- function loadImages() {
221
- return oracleImageReader.findImages({ provider: oracle });
65
+ const loadLoadBalancers = (command) => {
66
+ if (command.account && command.region) {
67
+ command.backingData.filtered.loadBalancers = command.backingData.loadBalancers.filter(function (lb) {
68
+ return lb.region === command.region && lb.account === command.account;
69
+ });
222
70
  }
71
+ };
72
+
73
+ {
74
+ const defaults = command || {};
75
+ const defaultCredentials =
76
+ defaults.account || application.defaultCredentials.oracle || OracleProviderSettings.defaults.account;
77
+ const defaultRegion =
78
+ defaults.region || application.defaultRegions.oracle || OracleProviderSettings.defaults.region;
79
+
80
+ return Promise.all([
81
+ AccountService.getCredentialsKeyedByAccount(oracle),
82
+ NetworkReader.listNetworksByProvider(oracle),
83
+ SubnetReader.listSubnetsByProvider(oracle),
84
+ securityGroupReader.getAllSecurityGroups(),
85
+ loadImages(),
86
+ AccountService.getAvailabilityZonesForAccountAndRegion(oracle, defaultCredentials, defaultRegion),
87
+ ]).then(function ([credentialsKeyedByAccount, networks, subnets, securityGroups, images, availDomains]) {
88
+ const backingData = {
89
+ credentialsKeyedByAccount,
90
+ networks,
91
+ subnets,
92
+ securityGroups,
93
+ images,
94
+ availDomains,
95
+ };
96
+
97
+ backingData.accounts = _.keys(backingData.credentialsKeyedByAccount);
98
+ backingData.filtered = {};
99
+ loadAndSelectRegions(command, backingData);
100
+ backingData.filtered.availabilityDomains = _.map(backingData.availDomains, function (zone) {
101
+ return { name: zone };
102
+ });
223
103
 
224
- return {
225
- configureCommand: configureCommand,
226
- };
227
- },
228
- ],
229
- );
104
+ backingData.filterSubnets = function () {
105
+ if (command.vpcId && command.availabilityDomain) {
106
+ return _.filter(backingData.subnets, {
107
+ vcnId: command.vpcId,
108
+ availabilityDomain: command.availabilityDomain,
109
+ });
110
+ }
111
+ return backingData.subnets;
112
+ };
113
+
114
+ backingData.loadBalancers = application.loadBalancers.data;
115
+
116
+ backingData.accountOnChange = function () {
117
+ loadAndSelectRegions(command, command.backingData);
118
+ loadAvailabilityDomains(command);
119
+ loadLoadBalancers(command);
120
+ };
121
+
122
+ backingData.regionOnChange = function () {
123
+ loadAvailabilityDomains(command);
124
+ loadLoadBalancers(command);
125
+ };
126
+
127
+ backingData.availabilityDomainOnChange = function () {
128
+ command.subnetId = null;
129
+ backingData.seclists = null;
130
+ };
131
+
132
+ backingData.vpcOnChange = function () {
133
+ command.subnetId = null;
134
+ backingData.seclists = null;
135
+ };
136
+
137
+ backingData.subnetOnChange = function () {
138
+ const subnet = _.find(backingData.subnets, { id: command.subnetId });
139
+ const mySecGroups = backingData.securityGroups[command.account][oracle][command.region];
140
+ const secLists = [];
141
+ _.forEach(subnet.securityListIds, function (sid) {
142
+ const sgRef = _.find(mySecGroups, { id: sid });
143
+ securityGroupReader
144
+ .getSecurityGroupDetails(
145
+ command.application,
146
+ command.account,
147
+ oracle,
148
+ command.region,
149
+ command.vpcId,
150
+ sgRef.name,
151
+ )
152
+ .then(function (sgd) {
153
+ secLists.push(sgd);
154
+ backingData.seclists = secLists;
155
+ });
156
+ });
157
+ };
158
+
159
+ backingData.findBackendSetsByLoadBalancerId = (loadBalancerId) => {
160
+ const lb = backingData.filtered.loadBalancers.find((lb) => lb.id === loadBalancerId);
161
+ if (lb && lb.backendSets) {
162
+ //reduce the backendSets object to an array. The object is keyed by the backendSet name
163
+ const bsetArray = [];
164
+ Object.keys(lb.backendSets).reduce((arr, bsetName) => {
165
+ const bset = lb.backendSets[bsetName];
166
+ bset['name'] = bsetName;
167
+ arr.push(bset);
168
+ return arr;
169
+ }, bsetArray);
170
+ return bsetArray;
171
+ } else {
172
+ return [];
173
+ }
174
+ };
175
+
176
+ backingData.findLoadBalListenersByBackendSetName = (loadBalancerId, backendSetName) => {
177
+ const lb = backingData.filtered.loadBalancers.find((lb) => lb.id === loadBalancerId);
178
+ if (lb && lb.listeners) {
179
+ return Object.keys(lb.listeners)
180
+ .filter((lisName) => lb.listeners[lisName].defaultBackendSetName === backendSetName)
181
+ .map((lisName) => lb.listeners[lisName]);
182
+ } else {
183
+ return [];
184
+ }
185
+ };
186
+
187
+ backingData.loadBalancerOnChange = () => {
188
+ if (command.loadBalancerId) {
189
+ backingData.filtered.backendSets = backingData.findBackendSetsByLoadBalancerId(command.loadBalancerId);
190
+ } else {
191
+ //no backend set name should be set if no load balancer id is set
192
+ command.backendSetName = undefined;
193
+ backingData.backendSetOnChange();
194
+ backingData.filtered.backendSets = [];
195
+ }
196
+ };
197
+
198
+ backingData.backendSetOnChange = () => {
199
+ backingData.filtered.listeners =
200
+ command.loadBalancerId && command.backendSetName
201
+ ? backingData.findLoadBalListenersByBackendSetName(command.loadBalancerId, command.backendSetName)
202
+ : [];
203
+ };
204
+
205
+ backingData.filtered.images = backingData.images;
206
+ const shapesMap = {};
207
+ _.forEach(backingData.filtered.images, (image) => {
208
+ shapesMap[image.id] = getShapes(image);
209
+ });
210
+ backingData.filtered.shapes = shapesMap;
211
+ backingData.filtered.allShapes = _.uniqBy(_.flatten(_.values(shapesMap)), 'name');
212
+ command.backingData = backingData;
213
+ if (command.account) {
214
+ loadLoadBalancers(command);
215
+ backingData.loadBalancerOnChange();
216
+ backingData.backendSetOnChange();
217
+ }
218
+ });
219
+ }
220
+
221
+ function loadImages() {
222
+ return oracleImageReader.findImages({ provider: oracle });
223
+ }
224
+ }
225
+ }