@spinnaker/tencentcloud 0.0.0-2025.1-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 (92) hide show
  1. package/CHANGELOG.md +751 -0
  2. package/LICENSE.txt +203 -0
  3. package/dist/domain/IKeyPair.d.ts +8 -0
  4. package/dist/domain/IScalingPolicy.d.ts +44 -0
  5. package/dist/domain/IScalingProcess.d.ts +10 -0
  6. package/dist/domain/ITargetTrackingPolicy.d.ts +21 -0
  7. package/dist/domain/ITencentcloudCertificate.d.ts +5 -0
  8. package/dist/domain/ITencentcloudHealth.d.ts +18 -0
  9. package/dist/domain/ITencentcloudInstance.d.ts +4 -0
  10. package/dist/domain/ITencentcloudLoadBalancer.d.ts +278 -0
  11. package/dist/domain/ITencentcloudLoadBalancerSourceData.d.ts +171 -0
  12. package/dist/domain/ITencentcloudScalingPolicy.d.ts +19 -0
  13. package/dist/domain/ITencentcloudServerGroup.d.ts +43 -0
  14. package/dist/domain/index.d.ts +11 -0
  15. package/dist/help/tencentcloud.help.d.ts +1 -0
  16. package/dist/image/image.reader.d.ts +35 -0
  17. package/dist/image/index.d.ts +1 -0
  18. package/dist/index.d.ts +2 -0
  19. package/dist/index.js +553 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/keyPairs/KeyPairsReader.d.ts +4 -0
  22. package/dist/keyPairs/index.d.ts +1 -0
  23. package/dist/pipeline/stages/disableCluster/DisableClusterConfig.d.ts +3 -0
  24. package/dist/pipeline/stages/disableCluster/DisableClusterStageForm.d.ts +3 -0
  25. package/dist/pipeline/stages/disableCluster/disableClusterStage.d.ts +1 -0
  26. package/dist/pipeline/stages/disableCluster/disableClusterValidators.d.ts +2 -0
  27. package/dist/pipeline/stages/rollbackCluster/RollbackClusterConfig.d.ts +3 -0
  28. package/dist/pipeline/stages/rollbackCluster/RollbackClusterStageForm.d.ts +3 -0
  29. package/dist/pipeline/stages/rollbackCluster/rollbackClusterStage.d.ts +1 -0
  30. package/dist/pipeline/stages/rollbackCluster/rollbackClusterValidators.d.ts +2 -0
  31. package/dist/pipeline/stages/scaleDownCluster/ScaleDownClusterConfig.d.ts +3 -0
  32. package/dist/pipeline/stages/scaleDownCluster/ScaleDownClusterStageForm.d.ts +3 -0
  33. package/dist/pipeline/stages/scaleDownCluster/scaleDownClusterStage.d.ts +1 -0
  34. package/dist/pipeline/stages/scaleDownCluster/scaledownClusterValidators.d.ts +2 -0
  35. package/dist/pipeline/stages/shrinkCluster/ShrinkClusterConfig.d.ts +3 -0
  36. package/dist/pipeline/stages/shrinkCluster/ShrinkClusterStageForm.d.ts +3 -0
  37. package/dist/pipeline/stages/shrinkCluster/shrinkClusterStage.d.ts +1 -0
  38. package/dist/pipeline/stages/shrinkCluster/shrinkClusterValidators.d.ts +2 -0
  39. package/dist/reactShims/index.d.ts +2 -0
  40. package/dist/reactShims/tencentcloud.ngReact.d.ts +8 -0
  41. package/dist/reactShims/tencentcloud.react.injector.d.ts +7 -0
  42. package/dist/reactShims/tencentcloud.react.module.d.ts +1 -0
  43. package/dist/search/searchResultFormatter.d.ts +1 -0
  44. package/dist/tencentcloud.module.d.ts +7 -0
  45. package/dist/tencentcloud.settings.d.ts +26 -0
  46. package/dist/validation/ApplicationNameValidator.d.ts +1 -0
  47. package/package.json +37 -0
  48. package/src/domain/IKeyPair.ts +8 -0
  49. package/src/domain/IScalingPolicy.ts +84 -0
  50. package/src/domain/IScalingProcess.ts +11 -0
  51. package/src/domain/ITargetTrackingPolicy.ts +26 -0
  52. package/src/domain/ITencentcloudCertificate.ts +6 -0
  53. package/src/domain/ITencentcloudHealth.ts +21 -0
  54. package/src/domain/ITencentcloudInstance.ts +5 -0
  55. package/src/domain/ITencentcloudLoadBalancer.ts +326 -0
  56. package/src/domain/ITencentcloudLoadBalancerSourceData.ts +189 -0
  57. package/src/domain/ITencentcloudScalingPolicy.ts +23 -0
  58. package/src/domain/ITencentcloudServerGroup.ts +46 -0
  59. package/src/domain/index.ts +11 -0
  60. package/src/help/tencentcloud.help.ts +5 -0
  61. package/src/image/image.reader.ts +53 -0
  62. package/src/image/index.ts +1 -0
  63. package/src/index.ts +2 -0
  64. package/src/keyPairs/KeyPairsReader.ts +11 -0
  65. package/src/keyPairs/index.ts +1 -0
  66. package/src/logo/tencentcloud.icon.svg +24 -0
  67. package/src/logo/tencentcloud.logo.less +5 -0
  68. package/src/logo/tencentcloud.logo.svg +53 -0
  69. package/src/pipeline/stages/disableCluster/DisableClusterConfig.tsx +27 -0
  70. package/src/pipeline/stages/disableCluster/DisableClusterStageForm.tsx +87 -0
  71. package/src/pipeline/stages/disableCluster/disableClusterStage.ts +12 -0
  72. package/src/pipeline/stages/disableCluster/disableClusterValidators.ts +10 -0
  73. package/src/pipeline/stages/rollbackCluster/RollbackClusterConfig.tsx +27 -0
  74. package/src/pipeline/stages/rollbackCluster/RollbackClusterStageForm.tsx +74 -0
  75. package/src/pipeline/stages/rollbackCluster/rollbackClusterStage.ts +12 -0
  76. package/src/pipeline/stages/rollbackCluster/rollbackClusterValidators.ts +10 -0
  77. package/src/pipeline/stages/scaleDownCluster/ScaleDownClusterConfig.tsx +27 -0
  78. package/src/pipeline/stages/scaleDownCluster/ScaleDownClusterStageForm.tsx +102 -0
  79. package/src/pipeline/stages/scaleDownCluster/scaleDownClusterStage.ts +12 -0
  80. package/src/pipeline/stages/scaleDownCluster/scaledownClusterValidators.ts +10 -0
  81. package/src/pipeline/stages/shrinkCluster/ShrinkClusterConfig.tsx +27 -0
  82. package/src/pipeline/stages/shrinkCluster/ShrinkClusterStageForm.tsx +104 -0
  83. package/src/pipeline/stages/shrinkCluster/shrinkClusterStage.ts +12 -0
  84. package/src/pipeline/stages/shrinkCluster/shrinkClusterValidators.ts +10 -0
  85. package/src/reactShims/index.ts +2 -0
  86. package/src/reactShims/tencentcloud.ngReact.ts +21 -0
  87. package/src/reactShims/tencentcloud.react.injector.ts +14 -0
  88. package/src/reactShims/tencentcloud.react.module.ts +14 -0
  89. package/src/search/searchResultFormatter.js +10 -0
  90. package/src/tencentcloud.module.ts +32 -0
  91. package/src/tencentcloud.settings.ts +35 -0
  92. package/src/validation/ApplicationNameValidator.ts +71 -0
package/dist/index.js ADDED
@@ -0,0 +1,553 @@
1
+ import { module } from 'angular';
2
+ import { HelpContentsRegistry, REST, AccountService, StageConfigField, FormikFormField, NumberInput, SelectInput, NgReact, FormikStageConfig, FormValidator, Registry, CheckboxInput, ReactInject, ApplicationNameValidator, FirewallLabels, CloudProviderRegistry, DeploymentStrategyRegistry, SETTINGS } from '@spinnaker/core';
3
+ import { $q } from 'ngimport';
4
+ import React from 'react';
5
+ import { cloneDeep } from 'lodash';
6
+
7
+ const helpContents = {};
8
+ Object.keys(helpContents).forEach((key) => HelpContentsRegistry.register(key, helpContents[key]));
9
+
10
+ class TencentcloudImageReader {
11
+ findImages(params) {
12
+ if (!params.q || params.q.length < 3) {
13
+ return $q.when([{ message: "Please enter at least 3 characters...", disabled: true }]);
14
+ }
15
+ return REST("/images/find").query({ ...params, provider: "tencentcloud" }).get().catch(() => []);
16
+ }
17
+ getImage(name, region, credentials) {
18
+ return REST("/images").path(credentials, region, name).query({ provider: "tencentcloud" }).get().then((results) => results && results.length ? results[0] : null).catch(() => null);
19
+ }
20
+ }
21
+
22
+ var logo = "data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3Csvg%20version%3D%221.1%22%20id%3D%22%E5%9B%BE%E5%B1%82_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%20%20width%3D%22120px%22%20height%3D%2248px%22%20viewBox%3D%220%200%20120%2048%22%20style%3D%22enable-background%3Anew%200%200%20120%2048%3B%22%20xml%3Aspace%3D%22preserve%22%3E%3Cg%3E%20%3Cg%3E%20%20%3Cpath%20d%3D%22M93.829%2C13.731H81.181v1.83h3.808v6.673h-4.364v1.83h4.364v11.19h2.013v-11.19h4.814V35.02h3.802v-1.831h-1.788V13.731z%20%20%20%20M87.002%2C22.234v-6.673h4.814v6.673H87.002z%22%2F%3E%20%20%3Crect%20x%3D%2258.743%22%20y%3D%2230.136%22%20width%3D%229.979%22%20height%3D%221.83%22%2F%3E%20%20%3Cpath%20d%3D%22M51.944%2C26.749c0%2C3.328-0.269%2C5.854-0.823%2C8.093c-0.058%2C0.207%2C0.004%2C0.263%2C0.113%2C0.263c0.038%2C0%2C1.525%2C0%2C1.835%2C0%20%20%20c0.613-3.075%2C0.693-5.626%2C0.703-7.477h2.565v5.69h-1.821c-0.089%2C0-0.157%2C0.058-0.11%2C0.184l0.502%2C1.646h3.257V13.777h-6.22V26.749z%20%20%20%20M53.774%2C25.98V21.6h2.563v4.38H53.774z%20M56.337%2C15.607v4.346h-2.563v-4.346H56.337z%22%2F%3E%20%20%3Cpath%20d%3D%22M69.429%2C21.196h2.457v-1.647h-7.16c0.216-0.526%2C0.41-1.091%2C0.588-1.702h6.123V16.2h-1.794%20%20%20c0.299-1.018%2C0.651-2.219%2C0.672-2.288c0.036-0.122-0.028-0.169-0.107-0.169h-1.558L67.927%2C16.2h-2.202%20%20%20c0.205-0.952%2C0.384-2.007%2C0.547-3.191c0.019-0.137-0.055-0.164-0.146-0.164c-0.073%2C0-1.278%2C0-1.774%2C0%20%20%20c-0.181%2C1.258-0.371%2C2.342-0.614%2C3.355h-1.08l-0.722-2.457h-1.558c-0.079%2C0-0.143%2C0.047-0.107%2C0.169%20%20%20c0.02%2C0.07%2C0.373%2C1.271%2C0.672%2C2.288h-1.747v1.647h4.079c-0.166%2C0.52-0.41%2C1.133-0.67%2C1.702h-3.858v1.647h2.898%20%20%20c-1.168%2C1.659-2.417%2C2.422-2.915%2C2.727c0%2C0.234%2C0%2C1.83%2C0%2C1.884c0%2C0.095%2C0.075%2C0.196%2C0.373%2C0.027%20%20%20c0.542-0.307%2C1.12-0.655%2C1.705-1.087h6.817l-0.058%2C2.467h-5.382l0.082-1.475c0-0.064-0.046-0.111-0.112-0.111%20%20%20c-0.102%2C0-1.721%2C0-1.721%2C0l-0.173%2C3.122c0%2C0.064%2C0.046%2C0.111%2C0.112%2C0.111c0.102%2C0%2C9.285%2C0%2C9.285%2C0v4.454h-4.185%20%20%20c-0.089%2C0-0.157%2C0.058-0.11%2C0.184l0.502%2C1.646h5.807v-7.931h-2.273l0.075-3.203c0.85%2C0.79%2C1.712%2C1.379%2C2.497%2C1.824%20%20%20c0.298%2C0.169%2C0.373%2C0.068%2C0.373-0.027c0-0.054%2C0-1.651%2C0-1.884C71.844%2C23.618%2C70.597%2C22.853%2C69.429%2C21.196z%20M67.188%2C21.196%20%20%20c0.438%2C0.721%2C0.91%2C1.351%2C1.398%2C1.903h-5.991c0.465-0.537%2C0.915-1.163%2C1.335-1.903H67.188z%22%2F%3E%20%20%3Cpath%20d%3D%22M82.457%2C28.864c-0.034%2C0.026-1.742%2C1.32-3.395%2C2.572V19.538h-4.704v2.013h2.704v11.4%20%20%20c-0.644%2C0.488-1.081%2C0.819-1.081%2C0.819l1.105%2C1.459l5.552-4.207c0%2C0%2C0-2.021%2C0-2.073C82.639%2C28.851%2C82.529%2C28.809%2C82.457%2C28.864z%22%20%20%20%2F%3E%20%20%3Cpath%20d%3D%22M77.329%2C17.736c0%2C0%2C2.15%2C0%2C2.2%2C0c0.098%2C0%2C0.137-0.106%2C0.094-0.171c-0.04-0.061-2.775-4.238-2.775-4.238s-2.117%2C0-2.2%2C0%20%20%20c-0.083%2C0-0.144%2C0.096-0.098%2C0.166C74.596%2C13.562%2C77.329%2C17.736%2C77.329%2C17.736z%22%2F%3E%20%20%3Crect%20x%3D%2299.874%22%20y%3D%2214.22%22%20width%3D%2215.888%22%20height%3D%222.013%22%2F%3E%20%20%3Cpath%20d%3D%22M105.637%2C23.841H118v-2.013H97.636v2.013h5.65c-1.167%2C3.064-4.095%2C10.753-4.115%2C10.809%20%20%20c-0.032%2C0.089%2C0.026%2C0.155%2C0.104%2C0.155c0.049%2C0%2C17.523%2C0%2C17.564%2C0c0.083%2C0%2C0.131-0.082%2C0.101-0.16%20%20%20c-0.019-0.049-2.619-6.885-2.619-6.885s-2.103%2C0-2.186%2C0s-0.133%2C0.08-0.105%2C0.153c0.028%2C0.073%2C1.853%2C4.879%2C1.853%2C4.879h-11.646%20%20%20L105.637%2C23.841z%22%2F%3E%20%3C%2Fg%3E%20%3Cg%3E%20%20%3Cpath%20style%3D%22fill%3A%2300A3FF%3B%22%20d%3D%22M39.157%2C33.89c-0.764%2C0.756-2.125%2C1.613-4.361%2C1.689c-1.034%2C0.035-2.241%2C0.039-2.793%2C0.039%20%20%20c-0.603%2C0-5.918%2C0-12.012%2C0c4.37-4.245%2C8.182-7.947%2C8.615-8.367c0.396-0.385%2C1.287-1.237%2C2.056-1.929%20%20%20c1.687-1.519%2C3.206-1.825%2C4.28-1.815c1.683%2C0.016%2C3.214%2C0.703%2C4.308%2C1.813C41.591%2C27.712%2C41.535%2C31.536%2C39.157%2C33.89%20%20%20%20M42.034%2C22.597c-1.795-1.83-4.296-2.983-7.077-2.984c-2.404%2C0-4.474%2C0.829-6.281%2C2.3c-0.788%2C0.641-1.614%2C1.409-2.653%2C2.419%20%20%20c-0.516%2C0.501-15.485%2C15.026-15.485%2C15.026c0.785%2C0.112%2C1.864%2C0.145%2C2.826%2C0.151c0.902%2C0.006%2C18.1%2C0.004%2C18.82%2C0.004%20%20%20c1.449%2C0%2C2.392-0.002%2C3.405-0.076c2.323-0.17%2C4.518-1.022%2C6.292-2.764C45.82%2C32.805%2C45.879%2C26.526%2C42.034%2C22.597z%22%2F%3E%20%20%3Cpath%20style%3D%22fill%3A%2300C8DC%3B%22%20d%3D%22M17.883%2C21.663c-1.76-1.317-3.729-2.053-5.963-2.05c-2.781%2C0-5.283%2C1.153-7.077%2C2.984%20%20%20c-3.845%2C3.93-3.786%2C10.209%2C0.154%2C14.077c1.582%2C1.553%2C3.498%2C2.398%2C5.541%2C2.684l3.854-3.74c-0.623-0.003-1.518-0.011-2.311-0.038%20%20%20c-2.235-0.076-3.597-0.934-4.361-1.689c-2.379-2.354-2.434-6.178-0.094-8.57c1.094-1.11%2C2.625-1.797%2C4.308-1.813%20%20%20c1.055-0.004%2C2.486%2C0.302%2C4.103%2C1.643c0.772%2C0.64%2C2.486%2C2.147%2C3.239%2C2.825c0.038%2C0.035%2C0.084%2C0.038%2C0.129%2C0.001l2.654-2.589%20%20%20c0.046-0.045%2C0.043-0.105-0.002-0.146C20.781%2C24.088%2C18.972%2C22.474%2C17.883%2C21.663%22%2F%3E%20%20%3Cpath%20style%3D%22fill%3A%23006EFF%3B%22%20d%3D%22M36%2C17.365c-1.831-5.172-6.762-8.879-12.562-8.879c-6.652%2C0-12.165%2C4.892-13.164%2C11.264%20%20%20c0.535-0.09%2C1.085-0.138%2C1.646-0.138c0.781-0.001%2C1.529%2C0.09%2C2.248%2C0.263c0.014%2C0.003%2C0.028%2C0.005%2C0.042%2C0.008%20%20%20c0.901-4.302%2C4.705-7.498%2C9.228-7.498c3.767%2C0%2C7.072%2C2.272%2C8.562%2C5.492c0.023%2C0.051%2C0.063%2C0.067%2C0.104%2C0.056%20%20%20c1.121-0.308%2C2.464-0.487%2C3.762-0.391C35.992%2C17.552%2C36.04%2C17.481%2C36%2C17.365%22%2F%3E%20%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E";
23
+
24
+ const { useEffect: useEffect$3, useState: useState$3 } = React;
25
+ const { AccountRegionClusterSelector: AccountRegionClusterSelector$3 } = NgReact;
26
+ function DisableClusterStageForm({ application, formik, pipeline }) {
27
+ const stage = formik.values;
28
+ const { setFieldValue } = formik;
29
+ const [accounts, setAccounts] = useState$3([]);
30
+ useEffect$3(() => {
31
+ var _a, _b, _c, _d, _e, _f, _g;
32
+ AccountService.listAccounts("tencentcloud").then((accounts2) => {
33
+ setAccounts(accounts2);
34
+ });
35
+ if (stage.isNew && ((_a = application == null ? void 0 : application.attributes) == null ? void 0 : _a.platformHealthOnlyShowOverride) && ((_b = application == null ? void 0 : application.attributes) == null ? void 0 : _b.platformHealthOnly)) {
36
+ setFieldValue("interestingHealthProviderNames", ["Tencentcloud"]);
37
+ }
38
+ if (!stage.credentials && ((_c = application == null ? void 0 : application.defaultCredentials) == null ? void 0 : _c.tencentcloud)) {
39
+ setFieldValue("credentials", (_d = application == null ? void 0 : application.defaultCredentials) == null ? void 0 : _d.tencentcloud);
40
+ }
41
+ if (!((_e = stage == null ? void 0 : stage.regions) == null ? void 0 : _e.length) && ((_f = application == null ? void 0 : application.defaultRegions) == null ? void 0 : _f.tencentcloud)) {
42
+ setFieldValue("regions", [...stage.regions, (_g = application == null ? void 0 : application.defaultRegions) == null ? void 0 : _g.tencentcloud]);
43
+ }
44
+ if (stage.remainingEnabledServerGroups === void 0) {
45
+ setFieldValue("remainingEnabledServerGroups", 1);
46
+ }
47
+ if (stage.preferLargerOverNewer === void 0) {
48
+ setFieldValue("preferLargerOverNewer", "false");
49
+ }
50
+ }, []);
51
+ const pluralize = function(str, val) {
52
+ if (val === 1) {
53
+ return str;
54
+ }
55
+ return str + "s";
56
+ };
57
+ return /* @__PURE__ */ React.createElement("div", {
58
+ className: "form-horizontal"
59
+ }, !pipeline.strategy && /* @__PURE__ */ React.createElement(AccountRegionClusterSelector$3, {
60
+ application,
61
+ clusterField: "cluster",
62
+ component: stage,
63
+ accounts
64
+ }), /* @__PURE__ */ React.createElement(StageConfigField, {
65
+ label: "Disable Options"
66
+ }, /* @__PURE__ */ React.createElement("div", {
67
+ className: "form-inline"
68
+ }, "Keep the", /* @__PURE__ */ React.createElement(FormikFormField, {
69
+ name: "remainingEnabledServerGroups",
70
+ required: true,
71
+ input: (props) => /* @__PURE__ */ React.createElement(NumberInput, {
72
+ ...props,
73
+ min: 0
74
+ })
75
+ }), /* @__PURE__ */ React.createElement(FormikFormField, {
76
+ name: "preferLargerOverNewer",
77
+ required: true,
78
+ input: (props) => /* @__PURE__ */ React.createElement(SelectInput, {
79
+ options: [
80
+ { label: "largest", value: "true" },
81
+ { label: "newest", value: "false" }
82
+ ],
83
+ ...props
84
+ })
85
+ }), pluralize("server group", stage.remainingEnabledServerGroups), " enabled.")));
86
+ }
87
+
88
+ function DisableClusterConfig({ application, pipeline, stage, updateStage }) {
89
+ const stageWithDefaults = React.useMemo(() => {
90
+ return {
91
+ cloudProvider: "tencentcloud",
92
+ regions: stage.regions || [],
93
+ ...cloneDeep(stage)
94
+ };
95
+ }, []);
96
+ return /* @__PURE__ */ React.createElement(FormikStageConfig, {
97
+ application,
98
+ onChange: updateStage,
99
+ pipeline,
100
+ stage: stageWithDefaults,
101
+ render: (props) => /* @__PURE__ */ React.createElement(DisableClusterStageForm, {
102
+ ...props
103
+ })
104
+ });
105
+ }
106
+
107
+ const validate$3 = (stage) => {
108
+ const formValidator = new FormValidator(stage);
109
+ formValidator.field("credentials", "Account").required();
110
+ formValidator.field("regions", "Regions").required();
111
+ formValidator.field("cluster", "Cluster").required();
112
+ return formValidator.validateForm();
113
+ };
114
+
115
+ Registry.pipeline.registerStage({
116
+ provides: "disableCluster",
117
+ key: "disableCluster",
118
+ cloudProvider: "tencentcloud",
119
+ component: DisableClusterConfig,
120
+ validateFn: validate$3
121
+ });
122
+
123
+ const { useEffect: useEffect$2, useState: useState$2 } = React;
124
+ const { AccountRegionClusterSelector: AccountRegionClusterSelector$2 } = NgReact;
125
+ function RollbackClusterStageForm({ application, formik, pipeline }) {
126
+ const stage = formik.values;
127
+ const { setFieldValue } = formik;
128
+ const [accounts, setAccounts] = useState$2([]);
129
+ useEffect$2(() => {
130
+ var _a, _b, _c, _d, _e, _f, _g;
131
+ AccountService.listAccounts("tencentcloud").then((accounts2) => {
132
+ setAccounts(accounts2);
133
+ });
134
+ if (stage.isNew && ((_a = application == null ? void 0 : application.attributes) == null ? void 0 : _a.platformHealthOnlyShowOverride) && ((_b = application == null ? void 0 : application.attributes) == null ? void 0 : _b.platformHealthOnly)) {
135
+ setFieldValue("interestingHealthProviderNames", ["Tencentcloud"]);
136
+ }
137
+ if (!stage.credentials && ((_c = application == null ? void 0 : application.defaultCredentials) == null ? void 0 : _c.tencentcloud)) {
138
+ setFieldValue("credentials", (_d = application == null ? void 0 : application.defaultCredentials) == null ? void 0 : _d.tencentcloud);
139
+ }
140
+ if (!((_e = stage == null ? void 0 : stage.regions) == null ? void 0 : _e.length) && ((_f = application == null ? void 0 : application.defaultRegions) == null ? void 0 : _f.tencentcloud)) {
141
+ setFieldValue("regions", [...stage.regions, (_g = application == null ? void 0 : application.defaultRegions) == null ? void 0 : _g.tencentcloud]);
142
+ }
143
+ if (stage.remainingEnabledServerGroups === void 0) {
144
+ setFieldValue("remainingEnabledServerGroups", 1);
145
+ }
146
+ if (stage.preferLargerOverNewer === void 0) {
147
+ setFieldValue("preferLargerOverNewer", "false");
148
+ }
149
+ }, []);
150
+ return /* @__PURE__ */ React.createElement("div", {
151
+ className: "form-horizontal"
152
+ }, !pipeline.strategy && /* @__PURE__ */ React.createElement(AccountRegionClusterSelector$2, {
153
+ application,
154
+ clusterField: "cluster",
155
+ component: stage,
156
+ accounts
157
+ }), /* @__PURE__ */ React.createElement(StageConfigField, {
158
+ label: "Rollback Options"
159
+ }, /* @__PURE__ */ React.createElement("div", {
160
+ className: "row"
161
+ }, /* @__PURE__ */ React.createElement("div", {
162
+ className: "col-sm-10 col-sm-offset-2"
163
+ }, "Wait", /* @__PURE__ */ React.createElement(FormikFormField, {
164
+ name: "wait",
165
+ required: true,
166
+ input: (props) => /* @__PURE__ */ React.createElement(NumberInput, {
167
+ ...props,
168
+ min: 0
169
+ })
170
+ }), "seconds between regional rollbacks."), /* @__PURE__ */ React.createElement("div", {
171
+ className: "col-sm-10 col-sm-offset-2"
172
+ }, "Consider rollback successful when", /* @__PURE__ */ React.createElement(FormikFormField, {
173
+ name: "remainingEnabledServerGroups",
174
+ required: true,
175
+ input: (props) => /* @__PURE__ */ React.createElement(NumberInput, {
176
+ ...props,
177
+ min: 0,
178
+ max: 100
179
+ })
180
+ }), "percent of instances are healthy."))));
181
+ }
182
+
183
+ function RollbackClusterConfig({ application, pipeline, stage, updateStage }) {
184
+ const stageWithDefaults = React.useMemo(() => {
185
+ return {
186
+ cloudProvider: "tencentcloud",
187
+ regions: stage.regions || [],
188
+ ...cloneDeep(stage)
189
+ };
190
+ }, []);
191
+ return /* @__PURE__ */ React.createElement(FormikStageConfig, {
192
+ application,
193
+ onChange: updateStage,
194
+ pipeline,
195
+ stage: stageWithDefaults,
196
+ render: (props) => /* @__PURE__ */ React.createElement(RollbackClusterStageForm, {
197
+ ...props
198
+ })
199
+ });
200
+ }
201
+
202
+ const validate$2 = (stage) => {
203
+ const formValidator = new FormValidator(stage);
204
+ formValidator.field("credentials", "Account").required();
205
+ formValidator.field("regions", "Regions").required();
206
+ formValidator.field("cluster", "Cluster").required();
207
+ return formValidator.validateForm();
208
+ };
209
+
210
+ Registry.pipeline.registerStage({
211
+ provides: "rollbackCluster",
212
+ key: "rollbackCluster",
213
+ cloudProvider: "tencentcloud",
214
+ component: RollbackClusterConfig,
215
+ validateFn: validate$2
216
+ });
217
+
218
+ const { useEffect: useEffect$1, useState: useState$1 } = React;
219
+ const { AccountRegionClusterSelector: AccountRegionClusterSelector$1 } = NgReact;
220
+ function ScaleDownClusterStageForm({ application, formik, pipeline }) {
221
+ const stage = formik.values;
222
+ const { setFieldValue } = formik;
223
+ const [accounts, setAccounts] = useState$1([]);
224
+ useEffect$1(() => {
225
+ var _a, _b, _c, _d, _e, _f, _g;
226
+ AccountService.listAccounts("tencentcloud").then((accounts2) => {
227
+ setAccounts(accounts2);
228
+ });
229
+ if (stage.isNew && ((_a = application == null ? void 0 : application.attributes) == null ? void 0 : _a.platformHealthOnlyShowOverride) && ((_b = application == null ? void 0 : application.attributes) == null ? void 0 : _b.platformHealthOnly)) {
230
+ setFieldValue("interestingHealthProviderNames", ["Tencentcloud"]);
231
+ }
232
+ if (!stage.credentials && ((_c = application == null ? void 0 : application.defaultCredentials) == null ? void 0 : _c.tencentcloud)) {
233
+ setFieldValue("credentials", (_d = application == null ? void 0 : application.defaultCredentials) == null ? void 0 : _d.tencentcloud);
234
+ }
235
+ if (!((_e = stage == null ? void 0 : stage.regions) == null ? void 0 : _e.length) && ((_f = application == null ? void 0 : application.defaultRegions) == null ? void 0 : _f.tencentcloud)) {
236
+ setFieldValue("regions", [...stage.regions, (_g = application == null ? void 0 : application.defaultRegions) == null ? void 0 : _g.tencentcloud]);
237
+ }
238
+ if (stage.remainingEnabledServerGroups === void 0) {
239
+ setFieldValue("remainingEnabledServerGroups", 1);
240
+ }
241
+ if (stage.preferLargerOverNewer === void 0) {
242
+ setFieldValue("preferLargerOverNewer", "false");
243
+ }
244
+ }, []);
245
+ const pluralize = function(str, val) {
246
+ if (val === 1) {
247
+ return str;
248
+ }
249
+ return str + "s";
250
+ };
251
+ return /* @__PURE__ */ React.createElement("div", {
252
+ className: "form-horizontal"
253
+ }, !pipeline.strategy && /* @__PURE__ */ React.createElement(AccountRegionClusterSelector$1, {
254
+ application,
255
+ clusterField: "cluster",
256
+ component: stage,
257
+ accounts
258
+ }), /* @__PURE__ */ React.createElement(StageConfigField, {
259
+ label: "ScaleDown Options"
260
+ }, /* @__PURE__ */ React.createElement("div", {
261
+ className: "form-inline"
262
+ }, "Keep the", /* @__PURE__ */ React.createElement(FormikFormField, {
263
+ name: "remainingEnabledServerGroups",
264
+ required: true,
265
+ input: (props) => /* @__PURE__ */ React.createElement(NumberInput, {
266
+ ...props,
267
+ min: 0
268
+ })
269
+ }), /* @__PURE__ */ React.createElement(FormikFormField, {
270
+ name: "preferLargerOverNewer",
271
+ required: true,
272
+ input: (props) => /* @__PURE__ */ React.createElement(SelectInput, {
273
+ options: [
274
+ { label: "largest", value: "true" },
275
+ { label: "newest", value: "false" }
276
+ ],
277
+ ...props
278
+ })
279
+ }), pluralize("server group", stage.remainingFullSizeServerGroups), " at current size.", /* @__PURE__ */ React.createElement("p", null, "The remaining server groups will be scaled down to zero instances."))), /* @__PURE__ */ React.createElement("div", {
280
+ className: "form-group"
281
+ }, /* @__PURE__ */ React.createElement(FormikFormField, {
282
+ name: "allowScaleDownActive",
283
+ input: (props) => /* @__PURE__ */ React.createElement(CheckboxInput, {
284
+ ...props,
285
+ text: "Allow scale down of active server groups"
286
+ })
287
+ })));
288
+ }
289
+
290
+ function ScaleDownClusterConfig({ application, pipeline, stage, updateStage }) {
291
+ const stageWithDefaults = React.useMemo(() => {
292
+ return {
293
+ cloudProvider: "tencentcloud",
294
+ regions: stage.regions || [],
295
+ ...cloneDeep(stage)
296
+ };
297
+ }, []);
298
+ return /* @__PURE__ */ React.createElement(FormikStageConfig, {
299
+ application,
300
+ onChange: updateStage,
301
+ pipeline,
302
+ stage: stageWithDefaults,
303
+ render: (props) => /* @__PURE__ */ React.createElement(ScaleDownClusterStageForm, {
304
+ ...props
305
+ })
306
+ });
307
+ }
308
+
309
+ const validate$1 = (stage) => {
310
+ const formValidator = new FormValidator(stage);
311
+ formValidator.field("credentials", "Account").required();
312
+ formValidator.field("regions", "Regions").required();
313
+ formValidator.field("cluster", "Cluster").required();
314
+ return formValidator.validateForm();
315
+ };
316
+
317
+ Registry.pipeline.registerStage({
318
+ provides: "scaleDownCluster",
319
+ key: "scaleDownCluster",
320
+ cloudProvider: "tencentcloud",
321
+ component: ScaleDownClusterConfig,
322
+ validateFn: validate$1
323
+ });
324
+
325
+ const { useEffect, useState } = React;
326
+ const { AccountRegionClusterSelector } = NgReact;
327
+ function ShrinkClusterStageForm({ application, formik, pipeline }) {
328
+ const stage = formik.values;
329
+ const { setFieldValue } = formik;
330
+ const [accounts, setAccounts] = useState([]);
331
+ useEffect(() => {
332
+ var _a, _b, _c, _d, _e, _f, _g;
333
+ AccountService.listAccounts("tencentcloud").then((accounts2) => {
334
+ setAccounts(accounts2);
335
+ });
336
+ if (stage.isNew && ((_a = application == null ? void 0 : application.attributes) == null ? void 0 : _a.platformHealthOnlyShowOverride) && ((_b = application == null ? void 0 : application.attributes) == null ? void 0 : _b.platformHealthOnly)) {
337
+ setFieldValue("interestingHealthProviderNames", ["Tencentcloud"]);
338
+ }
339
+ if (!stage.credentials && ((_c = application == null ? void 0 : application.defaultCredentials) == null ? void 0 : _c.tencentcloud)) {
340
+ setFieldValue("credentials", (_d = application == null ? void 0 : application.defaultCredentials) == null ? void 0 : _d.tencentcloud);
341
+ }
342
+ if (!((_e = stage == null ? void 0 : stage.regions) == null ? void 0 : _e.length) && ((_f = application == null ? void 0 : application.defaultRegions) == null ? void 0 : _f.tencentcloud)) {
343
+ setFieldValue("regions", [...stage.regions, (_g = application == null ? void 0 : application.defaultRegions) == null ? void 0 : _g.tencentcloud]);
344
+ }
345
+ if (stage.remainingEnabledServerGroups === void 0) {
346
+ setFieldValue("remainingEnabledServerGroups", 1);
347
+ }
348
+ if (stage.preferLargerOverNewer === void 0) {
349
+ setFieldValue("preferLargerOverNewer", "false");
350
+ }
351
+ }, []);
352
+ const pluralize = function(str, val) {
353
+ if (val === 1) {
354
+ return str;
355
+ }
356
+ return str + "s";
357
+ };
358
+ return /* @__PURE__ */ React.createElement("div", {
359
+ className: "form-horizontal"
360
+ }, !pipeline.strategy && /* @__PURE__ */ React.createElement(AccountRegionClusterSelector, {
361
+ application,
362
+ clusterField: "cluster",
363
+ component: stage,
364
+ accounts
365
+ }), /* @__PURE__ */ React.createElement(StageConfigField, {
366
+ label: "Shrink Options"
367
+ }, /* @__PURE__ */ React.createElement("div", {
368
+ className: "form-inline"
369
+ }, "Shrink to", /* @__PURE__ */ React.createElement(FormikFormField, {
370
+ name: "remainingEnabledServerGroups",
371
+ required: true,
372
+ input: (props) => /* @__PURE__ */ React.createElement(NumberInput, {
373
+ ...props,
374
+ min: 0
375
+ })
376
+ }), pluralize("server group", stage.shrinkToSize), ", keeping the", /* @__PURE__ */ React.createElement(FormikFormField, {
377
+ name: "retainLargerOverNewer",
378
+ required: true,
379
+ input: (props) => /* @__PURE__ */ React.createElement(SelectInput, {
380
+ options: [
381
+ { label: "largest", value: "true" },
382
+ { label: "newest", value: "false" }
383
+ ],
384
+ ...props
385
+ })
386
+ }), pluralize("server group", stage.remainingEnabledServerGroups), " enabled.")), /* @__PURE__ */ React.createElement("div", {
387
+ className: "form-group"
388
+ }, /* @__PURE__ */ React.createElement("div", {
389
+ className: "col-md-offset-3 col-md-6 checkbox"
390
+ }, /* @__PURE__ */ React.createElement(FormikFormField, {
391
+ name: "allowDeleteActive",
392
+ input: (props) => /* @__PURE__ */ React.createElement(CheckboxInput, {
393
+ ...props,
394
+ text: "Allow deletion of active server groups"
395
+ })
396
+ }))));
397
+ }
398
+
399
+ function ShrinkClusterConfig({ application, pipeline, stage, updateStage }) {
400
+ const stageWithDefaults = React.useMemo(() => {
401
+ return {
402
+ cloudProvider: "tencentcloud",
403
+ regions: stage.regions || [],
404
+ ...cloneDeep(stage)
405
+ };
406
+ }, []);
407
+ return /* @__PURE__ */ React.createElement(FormikStageConfig, {
408
+ application,
409
+ onChange: updateStage,
410
+ pipeline,
411
+ stage: stageWithDefaults,
412
+ render: (props) => /* @__PURE__ */ React.createElement(ShrinkClusterStageForm, {
413
+ ...props
414
+ })
415
+ });
416
+ }
417
+
418
+ const validate = (stage) => {
419
+ const formValidator = new FormValidator(stage);
420
+ formValidator.field("credentials", "Account").required();
421
+ formValidator.field("regions", "Regions").required();
422
+ formValidator.field("cluster", "Cluster").required();
423
+ return formValidator.validateForm();
424
+ };
425
+
426
+ Registry.pipeline.registerStage({
427
+ provides: "shrinkCluster",
428
+ key: "shrinkCluster",
429
+ cloudProvider: "tencentcloud",
430
+ component: ShrinkClusterConfig,
431
+ validateFn: validate
432
+ });
433
+
434
+ class TencentcloudNgReactInjector extends ReactInject {
435
+ constructor() {
436
+ super(...arguments);
437
+ this.$injectorProxy = {};
438
+ }
439
+ initialize($injector) {
440
+ const realInjector = $injector;
441
+ const proxyInjector = this.$injectorProxy;
442
+ Object.keys($injector).filter((key) => typeof realInjector[key] === "function").forEach((key) => proxyInjector[key] = realInjector[key].bind(realInjector));
443
+ }
444
+ }
445
+ const TencentcloudNgReact = new TencentcloudNgReactInjector();
446
+
447
+ class TencentcloudReactInject extends ReactInject {
448
+ initialize($injector) {
449
+ this.$injector = $injector;
450
+ }
451
+ }
452
+ const TencentcloudReactInjector = new TencentcloudReactInject();
453
+
454
+ const TENCENTCLOUD_REACT_MODULE = "spinnaker.tencentcloud.react";
455
+ module(TENCENTCLOUD_REACT_MODULE, []).run([
456
+ "$injector",
457
+ function($injector) {
458
+ TencentcloudReactInjector.initialize($injector);
459
+ TencentcloudNgReact.initialize($injector);
460
+ }
461
+ ]);
462
+
463
+ const TENCENTCLOUD_SEARCH_SEARCHRESULTFORMATTER = "spinnaker.tencentcloud.search.searchResultFormatter";
464
+ module(TENCENTCLOUD_SEARCH_SEARCHRESULTFORMATTER, []).factory("tencentcloudSearchResultFormatter", function() {
465
+ return {
466
+ securityGroups: function(entry) {
467
+ }
468
+ };
469
+ });
470
+
471
+ class TencentcloudApplicationNameValidator {
472
+ validateSpecialCharacters(name, errors) {
473
+ const pattern = /^[a-zA-Z_0-9.]*$/g;
474
+ if (!pattern.test(name)) {
475
+ errors.push("Only dot(.) and underscore(_) special characters are allowed.");
476
+ }
477
+ }
478
+ validateLoadBalancerCharacters(name, warnings) {
479
+ if (name.includes(".") || name.includes("_")) {
480
+ warnings.push(`If the application's name contains an underscore(_) or dot(.),
481
+ you will not be able to create a load balancer,
482
+ preventing it from being used as a front end service.`);
483
+ }
484
+ }
485
+ validateLength(name, warnings, errors) {
486
+ if (name.length > 250) {
487
+ errors.push("The maximum length for an application in Tencentcloud is 250 characters.");
488
+ return;
489
+ }
490
+ if (name.length > 240) {
491
+ if (name.length >= 248) {
492
+ warnings.push(`You will not be able to include a stack or detail field for clusters or ${FirewallLabels.get("firewalls")}.`);
493
+ } else {
494
+ const remaining = 248 - name.length;
495
+ warnings.push(`If you plan to include a stack or detail field for clusters, you will only
496
+ have ~${remaining} characters to do so.`);
497
+ }
498
+ }
499
+ if (name.length > 20) {
500
+ if (name.length > 32) {
501
+ warnings.push(`You will not be able to create an Tencentcloud load balancer for this application if the
502
+ application's name is longer than 32 characters (currently: ${name.length} characters)`);
503
+ } else {
504
+ if (name.length >= 30) {
505
+ warnings.push(`If you plan to create load balancers for this application, be aware that the character limit
506
+ for load balancer names is 32 (currently: ${name.length} characters). With separators ("-"), you will not
507
+ be able to add a stack and detail field to any load balancer.`);
508
+ } else {
509
+ const remaining = 30 - name.length;
510
+ warnings.push(`If you plan to create load balancers for this application, be aware that the character limit
511
+ for load balancer names is 32. You will only have ~${remaining} characters to add a stack or detail
512
+ field to any load balancer.`);
513
+ }
514
+ }
515
+ }
516
+ }
517
+ validate(name = "") {
518
+ const warnings = [];
519
+ const errors = [];
520
+ if (name.length) {
521
+ this.validateSpecialCharacters(name, errors);
522
+ this.validateLoadBalancerCharacters(name, warnings);
523
+ this.validateLength(name, warnings, errors);
524
+ }
525
+ return {
526
+ warnings,
527
+ errors
528
+ };
529
+ }
530
+ }
531
+ ApplicationNameValidator.registerValidator("tencentcloud", new TencentcloudApplicationNameValidator());
532
+
533
+ const TENCENTCLOUD_MODULE = "spinnaker.tencentcloud";
534
+ module(TENCENTCLOUD_MODULE, [TENCENTCLOUD_REACT_MODULE, TENCENTCLOUD_SEARCH_SEARCHRESULTFORMATTER]).config(() => {
535
+ CloudProviderRegistry.registerProvider("tencentcloud", {
536
+ name: "tencentcloud",
537
+ logo: {
538
+ path: logo
539
+ },
540
+ image: {
541
+ reader: TencentcloudImageReader
542
+ }
543
+ });
544
+ });
545
+ DeploymentStrategyRegistry.registerProvider("tencentcloud", ["custom", "redblack", "rollingpush", "rollingredblack"]);
546
+
547
+ const TencentcloudProviderSettings = SETTINGS.providers.tencentcloud || { defaults: {} };
548
+ if (TencentcloudProviderSettings) {
549
+ TencentcloudProviderSettings.resetToOriginal = SETTINGS.resetProvider("tencentcloud");
550
+ }
551
+
552
+ export { TENCENTCLOUD_MODULE, TencentcloudProviderSettings };
553
+ //# sourceMappingURL=index.js.map