namirasoft-cost 1.4.27 → 1.4.30

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 (190) hide show
  1. package/.ns-sdkg-dir-deep +3 -3
  2. package/.ns-sdkg-file-keep +36 -26
  3. package/dist/NamirasoftCostServer.js +1 -1
  4. package/dist/NamirasoftCostServerBillWatchAWS.d.ts +4 -15
  5. package/dist/NamirasoftCostServerBillWatchAWS.js +2 -2
  6. package/dist/NamirasoftCostServerBillWatchAWS.js.map +1 -1
  7. package/dist/NamirasoftCostServerBillWatchAzure.d.ts +4 -15
  8. package/dist/NamirasoftCostServerBillWatchAzure.js +2 -2
  9. package/dist/NamirasoftCostServerBillWatchAzure.js.map +1 -1
  10. package/dist/NamirasoftCostServerBillWatchGCP.d.ts +4 -15
  11. package/dist/NamirasoftCostServerBillWatchGCP.js +2 -2
  12. package/dist/NamirasoftCostServerBillWatchGCP.js.map +1 -1
  13. package/dist/NamirasoftCostServerCost.d.ts +0 -2
  14. package/dist/NamirasoftCostServerCost.js +0 -8
  15. package/dist/NamirasoftCostServerCost.js.map +1 -1
  16. package/dist/NamirasoftCostServerFieldCategory.d.ts +4 -15
  17. package/dist/NamirasoftCostServerFieldCategory.js +2 -2
  18. package/dist/NamirasoftCostServerFieldCategory.js.map +1 -1
  19. package/dist/NamirasoftCostServerFieldField.d.ts +4 -15
  20. package/dist/NamirasoftCostServerFieldField.js +2 -2
  21. package/dist/NamirasoftCostServerFieldField.js.map +1 -1
  22. package/dist/NamirasoftCostServerSecretSecret.d.ts +6 -29
  23. package/dist/NamirasoftCostServerSecretSecret.js +2 -2
  24. package/dist/NamirasoftCostServerSecretSecret.js.map +1 -1
  25. package/dist/command/BillWatchAWSCommand.d.ts +4 -0
  26. package/dist/command/BillWatchAWSCommand.js +17 -0
  27. package/dist/command/BillWatchAWSCommand.js.map +1 -0
  28. package/dist/command/BillWatchAWSEstimateRecordCommand.d.ts +5 -0
  29. package/dist/command/BillWatchAWSEstimateRecordCommand.js +103 -0
  30. package/dist/command/BillWatchAWSEstimateRecordCommand.js.map +1 -0
  31. package/dist/command/BillWatchAWS_CreateForRecordCommand.d.ts +5 -0
  32. package/dist/command/BillWatchAWS_CreateForRecordCommand.js +112 -0
  33. package/dist/command/BillWatchAWS_CreateForRecordCommand.js.map +1 -0
  34. package/dist/command/BillWatchAzureCommand.d.ts +4 -0
  35. package/dist/command/BillWatchAzureCommand.js +17 -0
  36. package/dist/command/BillWatchAzureCommand.js.map +1 -0
  37. package/dist/command/BillWatchAzureEstimateRecordCommand.d.ts +5 -0
  38. package/dist/command/BillWatchAzureEstimateRecordCommand.js +103 -0
  39. package/dist/command/BillWatchAzureEstimateRecordCommand.js.map +1 -0
  40. package/dist/command/BillWatchAzure_CreateForRecordCommand.d.ts +5 -0
  41. package/dist/command/BillWatchAzure_CreateForRecordCommand.js +112 -0
  42. package/dist/command/BillWatchAzure_CreateForRecordCommand.js.map +1 -0
  43. package/dist/command/BillWatchGCPCommand.d.ts +4 -0
  44. package/dist/command/BillWatchGCPCommand.js +17 -0
  45. package/dist/command/BillWatchGCPCommand.js.map +1 -0
  46. package/dist/command/BillWatchGCPEstimateRecordCommand.d.ts +5 -0
  47. package/dist/command/BillWatchGCPEstimateRecordCommand.js +103 -0
  48. package/dist/command/BillWatchGCPEstimateRecordCommand.js.map +1 -0
  49. package/dist/command/BillWatchGCP_CreateForRecordCommand.d.ts +5 -0
  50. package/dist/command/BillWatchGCP_CreateForRecordCommand.js +112 -0
  51. package/dist/command/BillWatchGCP_CreateForRecordCommand.js.map +1 -0
  52. package/dist/command/CostCommand.d.ts +4 -0
  53. package/dist/command/CostCommand.js +15 -0
  54. package/dist/command/CostCommand.js.map +1 -0
  55. package/dist/command/CostListCommand.d.ts +5 -0
  56. package/dist/command/CostListCommand.js +38 -0
  57. package/dist/command/CostListCommand.js.map +1 -0
  58. package/dist/command/FieldCategoryCommand.d.ts +4 -0
  59. package/dist/command/FieldCategoryCommand.js +17 -0
  60. package/dist/command/FieldCategoryCommand.js.map +1 -0
  61. package/dist/command/FieldCategoryEstimateRecordCommand.d.ts +5 -0
  62. package/dist/command/FieldCategoryEstimateRecordCommand.js +103 -0
  63. package/dist/command/FieldCategoryEstimateRecordCommand.js.map +1 -0
  64. package/dist/command/FieldCategory_CreateForRecordCommand.d.ts +5 -0
  65. package/dist/command/FieldCategory_CreateForRecordCommand.js +112 -0
  66. package/dist/command/FieldCategory_CreateForRecordCommand.js.map +1 -0
  67. package/dist/command/FieldFieldCommand.d.ts +4 -0
  68. package/dist/command/FieldFieldCommand.js +17 -0
  69. package/dist/command/FieldFieldCommand.js.map +1 -0
  70. package/dist/command/FieldFieldEstimateRecordCommand.d.ts +5 -0
  71. package/dist/command/FieldFieldEstimateRecordCommand.js +103 -0
  72. package/dist/command/FieldFieldEstimateRecordCommand.js.map +1 -0
  73. package/dist/command/FieldField_CreateForRecordCommand.d.ts +5 -0
  74. package/dist/command/FieldField_CreateForRecordCommand.js +112 -0
  75. package/dist/command/FieldField_CreateForRecordCommand.js.map +1 -0
  76. package/dist/command/HealthzCommand.d.ts +4 -0
  77. package/dist/command/HealthzCommand.js +15 -0
  78. package/dist/command/HealthzCommand.js.map +1 -0
  79. package/dist/command/HealthzGetCommand.d.ts +5 -0
  80. package/dist/command/HealthzGetCommand.js +38 -0
  81. package/dist/command/HealthzGetCommand.js.map +1 -0
  82. package/dist/command/MetricsCommand.d.ts +4 -0
  83. package/dist/command/MetricsCommand.js +15 -0
  84. package/dist/command/MetricsCommand.js.map +1 -0
  85. package/dist/command/MetricsGetCommand.d.ts +5 -0
  86. package/dist/command/MetricsGetCommand.js +38 -0
  87. package/dist/command/MetricsGetCommand.js.map +1 -0
  88. package/dist/command/SecretSecretCommand.d.ts +4 -0
  89. package/dist/command/SecretSecretCommand.js +21 -0
  90. package/dist/command/SecretSecretCommand.js.map +1 -0
  91. package/dist/command/SecretSecretEstimateReadCommand.d.ts +5 -0
  92. package/dist/command/SecretSecretEstimateReadCommand.js +103 -0
  93. package/dist/command/SecretSecretEstimateReadCommand.js.map +1 -0
  94. package/dist/command/SecretSecretEstimateRecordCommand.d.ts +5 -0
  95. package/dist/command/SecretSecretEstimateRecordCommand.js +103 -0
  96. package/dist/command/SecretSecretEstimateRecordCommand.js.map +1 -0
  97. package/dist/command/SecretSecret_CreateForReadCommand.d.ts +5 -0
  98. package/dist/command/SecretSecret_CreateForReadCommand.js +112 -0
  99. package/dist/command/SecretSecret_CreateForReadCommand.js.map +1 -0
  100. package/dist/command/SecretSecret_CreateForRecordCommand.d.ts +5 -0
  101. package/dist/command/SecretSecret_CreateForRecordCommand.js +112 -0
  102. package/dist/command/SecretSecret_CreateForRecordCommand.js.map +1 -0
  103. package/dist/command/ValueCommand.d.ts +4 -0
  104. package/dist/command/ValueCommand.js +15 -0
  105. package/dist/command/ValueCommand.js.map +1 -0
  106. package/dist/command/ValueListCommand.d.ts +5 -0
  107. package/dist/command/ValueListCommand.js +38 -0
  108. package/dist/command/ValueListCommand.js.map +1 -0
  109. package/dist/command/cli.d.ts +2 -0
  110. package/dist/command/cli.js +32 -0
  111. package/dist/command/cli.js.map +1 -0
  112. package/dist/index.d.ts +47 -12
  113. package/dist/index.js +47 -12
  114. package/dist/index.js.map +1 -1
  115. package/package.json +28 -28
  116. package/src/NamirasoftCostServer.ts +59 -59
  117. package/src/NamirasoftCostServerBase.ts +29 -29
  118. package/src/NamirasoftCostServerBillWatchAWS.ts +47 -46
  119. package/src/NamirasoftCostServerBillWatchAzure.ts +47 -46
  120. package/src/NamirasoftCostServerBillWatchGCP.ts +47 -46
  121. package/src/NamirasoftCostServerCost.ts +41 -49
  122. package/src/NamirasoftCostServerFieldCategory.ts +47 -46
  123. package/src/NamirasoftCostServerFieldField.ts +47 -46
  124. package/src/NamirasoftCostServerHealthz.ts +35 -35
  125. package/src/NamirasoftCostServerMetrics.ts +35 -35
  126. package/src/NamirasoftCostServerSecretSecret.ts +61 -60
  127. package/src/NamirasoftCostServerValue.ts +36 -36
  128. package/src/bonus/BaseBonus.ts +13 -13
  129. package/src/bonus/DeactiveBonus.ts +14 -14
  130. package/src/bonus/FreeCountBonus.ts +14 -14
  131. package/src/bonus/FreeTotalValueBonus.ts +28 -28
  132. package/src/bonus/LowAmountBonus.ts +14 -14
  133. package/src/bonus/LowSecondsBonus.ts +14 -14
  134. package/src/bonus/LowTotalCountBonus.ts +14 -14
  135. package/src/bonus/LowTotalValueBonus.ts +14 -14
  136. package/src/bonus/TrialBonus.ts +18 -18
  137. package/src/command/BillWatchAWSCommand.ts +34 -0
  138. package/src/command/BillWatchAWSEstimateRecordCommand.ts +110 -0
  139. package/src/command/BillWatchAWS_CreateForRecordCommand.ts +119 -0
  140. package/src/command/BillWatchAzureCommand.ts +34 -0
  141. package/src/command/BillWatchAzureEstimateRecordCommand.ts +110 -0
  142. package/src/command/BillWatchAzure_CreateForRecordCommand.ts +119 -0
  143. package/src/command/BillWatchGCPCommand.ts +34 -0
  144. package/src/command/BillWatchGCPEstimateRecordCommand.ts +110 -0
  145. package/src/command/BillWatchGCP_CreateForRecordCommand.ts +119 -0
  146. package/src/{row/CostCreateRow.ts → command/CostCommand.ts} +32 -38
  147. package/src/command/CostListCommand.ts +45 -0
  148. package/src/command/FieldCategoryCommand.ts +34 -0
  149. package/src/command/FieldCategoryEstimateRecordCommand.ts +110 -0
  150. package/src/command/FieldCategory_CreateForRecordCommand.ts +119 -0
  151. package/src/command/FieldFieldCommand.ts +34 -0
  152. package/src/command/FieldFieldEstimateRecordCommand.ts +110 -0
  153. package/src/command/FieldField_CreateForRecordCommand.ts +119 -0
  154. package/src/command/HealthzCommand.ts +32 -0
  155. package/src/command/HealthzGetCommand.ts +45 -0
  156. package/src/command/MetricsCommand.ts +32 -0
  157. package/src/command/MetricsGetCommand.ts +45 -0
  158. package/src/command/SecretSecretCommand.ts +38 -0
  159. package/src/command/SecretSecretEstimateReadCommand.ts +110 -0
  160. package/src/command/SecretSecretEstimateRecordCommand.ts +110 -0
  161. package/src/command/SecretSecret_CreateForReadCommand.ts +119 -0
  162. package/src/command/SecretSecret_CreateForRecordCommand.ts +119 -0
  163. package/src/command/ValueCommand.ts +32 -0
  164. package/src/command/ValueListCommand.ts +45 -0
  165. package/src/command/cli.ts +51 -0
  166. package/src/estimator/BaseEstimator.ts +62 -62
  167. package/src/estimator/BillWatchAWSRecordEstimator.ts +4 -4
  168. package/src/estimator/BillWatchAzureRecordEstimator.ts +4 -4
  169. package/src/estimator/BillWatchBaseRecordEstimator.ts +25 -25
  170. package/src/estimator/BillWatchGCPRecordEstimator.ts +4 -4
  171. package/src/estimator/FieldBaseRecordEstimator.ts +20 -20
  172. package/src/estimator/FieldCategoryRecordEstimator.ts +9 -9
  173. package/src/estimator/FieldFieldRecordEstimator.ts +9 -9
  174. package/src/estimator/SecretSecretReadEstimator.ts +25 -25
  175. package/src/estimator/SecretSecretRecordEstimator.ts +24 -24
  176. package/src/index.ts +89 -54
  177. package/src/meta/CostMetaTable.ts +81 -81
  178. package/src/meta/NamirasoftCostMetaDatabase.ts +50 -50
  179. package/src/row/CostRow.ts +40 -40
  180. package/src/type/Bonus.ts +20 -20
  181. package/src/type/CalculationOption.ts +34 -34
  182. package/src/type/Estimation.ts +35 -35
  183. package/src/type/EstimationOption.ts +31 -31
  184. package/src/type/EstimationUsage.ts +22 -22
  185. package/src/type/Period.ts +101 -101
  186. package/src/type/SimulationOption.ts +29 -29
  187. package/src/type/Usage.ts +24 -24
  188. package/dist/row/CostCreateRow.d.ts +0 -17
  189. package/dist/row/CostCreateRow.js +0 -3
  190. package/dist/row/CostCreateRow.js.map +0 -1
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.BillWatchAWS_CreateForRecordCommand = void 0;
13
+ const namirasoft_node_cli_1 = require("namirasoft-node-cli");
14
+ const namirasoft_core_1 = require("namirasoft-core");
15
+ const NamirasoftCostServer_1 = require("../NamirasoftCostServer");
16
+ const namirasoft_account_1 = require("namirasoft-account");
17
+ class BillWatchAWS_CreateForRecordCommand extends namirasoft_node_cli_1.BaseFinalCommand {
18
+ constructor(argv) {
19
+ super(argv, ["user_id"], [
20
+ {
21
+ name: "period",
22
+ short: "",
23
+ description: "Provides the value of 'period' in body",
24
+ optional: false,
25
+ args: ["period"],
26
+ defaults: [""]
27
+ },
28
+ {
29
+ name: "total_count",
30
+ short: "",
31
+ description: "Provides the value of 'total_count' in body",
32
+ optional: false,
33
+ args: ["total_count"],
34
+ defaults: [""]
35
+ },
36
+ {
37
+ name: "number",
38
+ short: "",
39
+ description: "Provides the value of 'number' in body",
40
+ optional: false,
41
+ args: ["number"],
42
+ defaults: [""]
43
+ },
44
+ {
45
+ name: "total_value",
46
+ short: "",
47
+ description: "Provides the value of 'total_value' in body",
48
+ optional: false,
49
+ args: ["total_value"],
50
+ defaults: [""]
51
+ },
52
+ {
53
+ name: "value",
54
+ short: "",
55
+ description: "Provides the value of 'value' in body",
56
+ optional: false,
57
+ args: ["value"],
58
+ defaults: [""]
59
+ },
60
+ {
61
+ name: "active",
62
+ short: "",
63
+ description: "Provides the value of 'active' in body",
64
+ optional: false,
65
+ args: ["active"],
66
+ defaults: [""]
67
+ },
68
+ {
69
+ name: "workspace_id",
70
+ short: "",
71
+ description: "Provides the value of 'workspace_id' in body",
72
+ optional: true,
73
+ args: ["workspace_id"],
74
+ defaults: [""]
75
+ },
76
+ {
77
+ name: "resource_id",
78
+ short: "",
79
+ description: "Provides the value of 'resource_id' in body",
80
+ optional: true,
81
+ args: ["resource_id"],
82
+ defaults: [""]
83
+ }
84
+ ]);
85
+ }
86
+ exec() {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ let token = this.app.storage.getNSAToken();
89
+ if (token == null)
90
+ throw new Error("Token is not available. Please login first using:\nns-cost account config \nor \nns-cost account login.");
91
+ let storage = new namirasoft_core_1.IStorageMemoryDedicated();
92
+ let manager = new namirasoft_account_1.TokenManager(storage, () => { });
93
+ manager.setValue(token, false);
94
+ let url = this.app.storage.getItem("ns-cost-server-url");
95
+ let server = new NamirasoftCostServer_1.NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
96
+ let ans = yield server.bill_watch_aws._CreateForRecord(this.arg_values[0], {
97
+ period: this.option_values.period,
98
+ total_count: this.option_values.total_count,
99
+ number: this.option_values.number,
100
+ total_value: this.option_values.total_value,
101
+ value: this.option_values.value,
102
+ active: this.option_values.active,
103
+ workspace_id: this.option_values.workspace_id,
104
+ resource_id: this.option_values.resource_id
105
+ });
106
+ this.app.logger.success(JSON.stringify(ans));
107
+ });
108
+ }
109
+ }
110
+ exports.BillWatchAWS_CreateForRecordCommand = BillWatchAWS_CreateForRecordCommand;
111
+ ;
112
+ //# sourceMappingURL=BillWatchAWS_CreateForRecordCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BillWatchAWS_CreateForRecordCommand.js","sourceRoot":"","sources":["../../src/command/BillWatchAWS_CreateForRecordCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;AAoBA,6DAAuD;AACvD,qDAA0D;AAC1D,kEAA+D;AAC/D,2DAAkD;AAElD,MAAa,mCAAoC,SAAQ,sCAAgB;IAErE,YAAY,IAAc;QAEtB,KAAK,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE;YACrB;gBACI,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,wCAAwC;gBACrD,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,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM;gBACjC,YAAY,EAAE,IAAI,CAAC,aAAa,CAAC,YAAY;gBAC7C,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,WAAW;aAC9C,CAAC,CAAC;YACH,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QACjD,CAAC;KAAA;CACJ;AA7FD,kFA6FC;AAAA,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { BaseNavigatorCommand } from "namirasoft-node-cli";
2
+ export declare class BillWatchAzureCommand extends BaseNavigatorCommand {
3
+ constructor(argv: string[]);
4
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BillWatchAzureCommand = void 0;
4
+ const namirasoft_node_cli_1 = require("namirasoft-node-cli");
5
+ const BillWatchAzureEstimateRecordCommand_1 = require("./BillWatchAzureEstimateRecordCommand");
6
+ const BillWatchAzure_CreateForRecordCommand_1 = require("./BillWatchAzure_CreateForRecordCommand");
7
+ class BillWatchAzureCommand extends namirasoft_node_cli_1.BaseNavigatorCommand {
8
+ constructor(argv) {
9
+ super(argv, {
10
+ "estimaterecord": BillWatchAzureEstimateRecordCommand_1.BillWatchAzureEstimateRecordCommand,
11
+ "_createforrecord": BillWatchAzure_CreateForRecordCommand_1.BillWatchAzure_CreateForRecordCommand,
12
+ });
13
+ }
14
+ }
15
+ exports.BillWatchAzureCommand = BillWatchAzureCommand;
16
+ ;
17
+ //# sourceMappingURL=BillWatchAzureCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BillWatchAzureCommand.js","sourceRoot":"","sources":["../../src/command/BillWatchAzureCommand.ts"],"names":[],"mappings":";;;AAoBA,6DAA2D;AAC3D,+FAA4F;AAC5F,mGAAgG;AAEhG,MAAa,qBAAsB,SAAQ,0CAAoB;IAE3D,YAAY,IAAc;QAEtB,KAAK,CAAC,IAAI,EAAE;YACR,gBAAgB,EAAE,yEAAmC;YACrD,kBAAkB,EAAE,6EAAqC;SAC5D,CAAC,CAAC;IACP,CAAC;CACJ;AATD,sDASC;AAAA,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { BaseFinalCommand } from "namirasoft-node-cli";
2
+ export declare class BillWatchAzureEstimateRecordCommand extends BaseFinalCommand {
3
+ constructor(argv: string[]);
4
+ exec(): Promise<void>;
5
+ }
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.BillWatchAzureEstimateRecordCommand = void 0;
13
+ const namirasoft_node_cli_1 = require("namirasoft-node-cli");
14
+ const namirasoft_core_1 = require("namirasoft-core");
15
+ const NamirasoftCostServer_1 = require("../NamirasoftCostServer");
16
+ const namirasoft_account_1 = require("namirasoft-account");
17
+ class BillWatchAzureEstimateRecordCommand extends namirasoft_node_cli_1.BaseFinalCommand {
18
+ constructor(argv) {
19
+ super(argv, [], [
20
+ {
21
+ name: "period",
22
+ short: "",
23
+ description: "Provides the value of 'period' in body",
24
+ optional: false,
25
+ args: ["period"],
26
+ defaults: [""]
27
+ },
28
+ {
29
+ name: "total_count",
30
+ short: "",
31
+ description: "Provides the value of 'total_count' in body",
32
+ optional: false,
33
+ args: ["total_count"],
34
+ defaults: [""]
35
+ },
36
+ {
37
+ name: "number",
38
+ short: "",
39
+ description: "Provides the value of 'number' in body",
40
+ optional: false,
41
+ args: ["number"],
42
+ defaults: [""]
43
+ },
44
+ {
45
+ name: "total_value",
46
+ short: "",
47
+ description: "Provides the value of 'total_value' in body",
48
+ optional: false,
49
+ args: ["total_value"],
50
+ defaults: [""]
51
+ },
52
+ {
53
+ name: "value",
54
+ short: "",
55
+ description: "Provides the value of 'value' in body",
56
+ optional: false,
57
+ args: ["value"],
58
+ defaults: [""]
59
+ },
60
+ {
61
+ name: "active",
62
+ short: "",
63
+ description: "Provides the value of 'active' in body",
64
+ optional: false,
65
+ args: ["active"],
66
+ defaults: [""]
67
+ },
68
+ {
69
+ name: "trial_started_at",
70
+ short: "",
71
+ description: "Provides the value of 'trial_started_at' in body",
72
+ optional: true,
73
+ args: ["trial_started_at"],
74
+ defaults: [""]
75
+ }
76
+ ]);
77
+ }
78
+ exec() {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ let token = this.app.storage.getNSAToken();
81
+ if (token == null)
82
+ throw new Error("Token is not available. Please login first using:\nns-cost account config \nor \nns-cost account login.");
83
+ let storage = new namirasoft_core_1.IStorageMemoryDedicated();
84
+ let manager = new namirasoft_account_1.TokenManager(storage, () => { });
85
+ manager.setValue(token, false);
86
+ let url = this.app.storage.getItem("ns-cost-server-url");
87
+ let server = new NamirasoftCostServer_1.NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
88
+ let ans = yield server.bill_watch_azure.EstimateRecord({
89
+ period: this.option_values.period,
90
+ total_count: this.option_values.total_count,
91
+ number: this.option_values.number,
92
+ total_value: this.option_values.total_value,
93
+ value: this.option_values.value,
94
+ active: this.option_values.active,
95
+ trial_started_at: this.option_values.trial_started_at
96
+ });
97
+ this.app.logger.success(JSON.stringify(ans));
98
+ });
99
+ }
100
+ }
101
+ exports.BillWatchAzureEstimateRecordCommand = BillWatchAzureEstimateRecordCommand;
102
+ ;
103
+ //# sourceMappingURL=BillWatchAzureEstimateRecordCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BillWatchAzureEstimateRecordCommand.js","sourceRoot":"","sources":["../../src/command/BillWatchAzureEstimateRecordCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;AAoBA,6DAAuD;AACvD,qDAA0D;AAC1D,kEAA+D;AAC/D,2DAAkD;AAElD,MAAa,mCAAoC,SAAQ,sCAAgB;IAErE,YAAY,IAAc;QAEtB,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE;YACZ;gBACI,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,wCAAwC;gBACrD,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,CAAC,QAAQ,CAAC;gBAChB,QAAQ,EAAE,CAAC,EAAE,CAAC;aACjB;YACD;gBACI,IAAI,EAAE,aAAa;gBACnB,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,6CAA6C;gBAC1D,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,CAAC,aAAa,CAAC;gBACrB,QAAQ,EAAE,CAAC,EAAE,CAAC;aACjB;YACD;gBACI,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,wCAAwC;gBACrD,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,CAAC,QAAQ,CAAC;gBAChB,QAAQ,EAAE,CAAC,EAAE,CAAC;aACjB;YACD;gBACI,IAAI,EAAE,aAAa;gBACnB,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,6CAA6C;gBAC1D,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,CAAC,aAAa,CAAC;gBACrB,QAAQ,EAAE,CAAC,EAAE,CAAC;aACjB;YACD;gBACI,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,uCAAuC;gBACpD,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,CAAC,OAAO,CAAC;gBACf,QAAQ,EAAE,CAAC,EAAE,CAAC;aACjB;YACD;gBACI,IAAI,EAAE,QAAQ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aAAa,CAAC,MAAM;gBACjC,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,WAAW;gBAC3C,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK;gBAC/B,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM;gBACjC,gBAAgB,EAAE,IAAI,CAAC,aAAa,CAAC,gBAAgB;aACxD,CAAC,CAAC;YACH,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QACjD,CAAC;KAAA;CACJ;AApFD,kFAoFC;AAAA,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { BaseFinalCommand } from "namirasoft-node-cli";
2
+ export declare class BillWatchAzure_CreateForRecordCommand extends BaseFinalCommand {
3
+ constructor(argv: string[]);
4
+ exec(): Promise<void>;
5
+ }
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.BillWatchAzure_CreateForRecordCommand = void 0;
13
+ const namirasoft_node_cli_1 = require("namirasoft-node-cli");
14
+ const namirasoft_core_1 = require("namirasoft-core");
15
+ const NamirasoftCostServer_1 = require("../NamirasoftCostServer");
16
+ const namirasoft_account_1 = require("namirasoft-account");
17
+ class BillWatchAzure_CreateForRecordCommand extends namirasoft_node_cli_1.BaseFinalCommand {
18
+ constructor(argv) {
19
+ super(argv, ["user_id"], [
20
+ {
21
+ name: "period",
22
+ short: "",
23
+ description: "Provides the value of 'period' in body",
24
+ optional: false,
25
+ args: ["period"],
26
+ defaults: [""]
27
+ },
28
+ {
29
+ name: "total_count",
30
+ short: "",
31
+ description: "Provides the value of 'total_count' in body",
32
+ optional: false,
33
+ args: ["total_count"],
34
+ defaults: [""]
35
+ },
36
+ {
37
+ name: "number",
38
+ short: "",
39
+ description: "Provides the value of 'number' in body",
40
+ optional: false,
41
+ args: ["number"],
42
+ defaults: [""]
43
+ },
44
+ {
45
+ name: "total_value",
46
+ short: "",
47
+ description: "Provides the value of 'total_value' in body",
48
+ optional: false,
49
+ args: ["total_value"],
50
+ defaults: [""]
51
+ },
52
+ {
53
+ name: "value",
54
+ short: "",
55
+ description: "Provides the value of 'value' in body",
56
+ optional: false,
57
+ args: ["value"],
58
+ defaults: [""]
59
+ },
60
+ {
61
+ name: "active",
62
+ short: "",
63
+ description: "Provides the value of 'active' in body",
64
+ optional: false,
65
+ args: ["active"],
66
+ defaults: [""]
67
+ },
68
+ {
69
+ name: "workspace_id",
70
+ short: "",
71
+ description: "Provides the value of 'workspace_id' in body",
72
+ optional: true,
73
+ args: ["workspace_id"],
74
+ defaults: [""]
75
+ },
76
+ {
77
+ name: "resource_id",
78
+ short: "",
79
+ description: "Provides the value of 'resource_id' in body",
80
+ optional: true,
81
+ args: ["resource_id"],
82
+ defaults: [""]
83
+ }
84
+ ]);
85
+ }
86
+ exec() {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ let token = this.app.storage.getNSAToken();
89
+ if (token == null)
90
+ throw new Error("Token is not available. Please login first using:\nns-cost account config \nor \nns-cost account login.");
91
+ let storage = new namirasoft_core_1.IStorageMemoryDedicated();
92
+ let manager = new namirasoft_account_1.TokenManager(storage, () => { });
93
+ manager.setValue(token, false);
94
+ let url = this.app.storage.getItem("ns-cost-server-url");
95
+ let server = new NamirasoftCostServer_1.NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
96
+ let ans = yield server.bill_watch_azure._CreateForRecord(this.arg_values[0], {
97
+ period: this.option_values.period,
98
+ total_count: this.option_values.total_count,
99
+ number: this.option_values.number,
100
+ total_value: this.option_values.total_value,
101
+ value: this.option_values.value,
102
+ active: this.option_values.active,
103
+ workspace_id: this.option_values.workspace_id,
104
+ resource_id: this.option_values.resource_id
105
+ });
106
+ this.app.logger.success(JSON.stringify(ans));
107
+ });
108
+ }
109
+ }
110
+ exports.BillWatchAzure_CreateForRecordCommand = BillWatchAzure_CreateForRecordCommand;
111
+ ;
112
+ //# sourceMappingURL=BillWatchAzure_CreateForRecordCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BillWatchAzure_CreateForRecordCommand.js","sourceRoot":"","sources":["../../src/command/BillWatchAzure_CreateForRecordCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;AAoBA,6DAAuD;AACvD,qDAA0D;AAC1D,kEAA+D;AAC/D,2DAAkD;AAElD,MAAa,qCAAsC,SAAQ,sCAAgB;IAEvE,YAAY,IAAc;QAEtB,KAAK,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE;YACrB;gBACI,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,wCAAwC;gBACrD,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,CAAC,QAAQ,CAAC;gBAChB,QAAQ,EAAE,CAAC,EAAE,CAAC;aACjB;YACD;gBACI,IAAI,EAAE,aAAa;gBACnB,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,6CAA6C;gBAC1D,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,CAAC,aAAa,CAAC;gBACrB,QAAQ,EAAE,CAAC,EAAE,CAAC;aACjB;YACD;gBACI,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,wCAAwC;gBACrD,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,CAAC,QAAQ,CAAC;gBAChB,QAAQ,EAAE,CAA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17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BillWatchGCPCommand = void 0;
4
+ const namirasoft_node_cli_1 = require("namirasoft-node-cli");
5
+ const BillWatchGCPEstimateRecordCommand_1 = require("./BillWatchGCPEstimateRecordCommand");
6
+ const BillWatchGCP_CreateForRecordCommand_1 = require("./BillWatchGCP_CreateForRecordCommand");
7
+ class BillWatchGCPCommand extends namirasoft_node_cli_1.BaseNavigatorCommand {
8
+ constructor(argv) {
9
+ super(argv, {
10
+ "estimaterecord": BillWatchGCPEstimateRecordCommand_1.BillWatchGCPEstimateRecordCommand,
11
+ "_createforrecord": BillWatchGCP_CreateForRecordCommand_1.BillWatchGCP_CreateForRecordCommand,
12
+ });
13
+ }
14
+ }
15
+ exports.BillWatchGCPCommand = BillWatchGCPCommand;
16
+ ;
17
+ //# sourceMappingURL=BillWatchGCPCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BillWatchGCPCommand.js","sourceRoot":"","sources":["../../src/command/BillWatchGCPCommand.ts"],"names":[],"mappings":";;;AAoBA,6DAA2D;AAC3D,2FAAwF;AACxF,+FAA4F;AAE5F,MAAa,mBAAoB,SAAQ,0CAAoB;IAEzD,YAAY,IAAc;QAEtB,KAAK,CAAC,IAAI,EAAE;YACR,gBAAgB,EAAE,qEAAiC;YACnD,kBAAkB,EAAE,yEAAmC;SAC1D,CAAC,CAAC;IACP,CAAC;CACJ;AATD,kDASC;AAAA,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { BaseFinalCommand } from "namirasoft-node-cli";
2
+ export declare class BillWatchGCPEstimateRecordCommand extends BaseFinalCommand {
3
+ constructor(argv: string[]);
4
+ exec(): Promise<void>;
5
+ }
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.BillWatchGCPEstimateRecordCommand = void 0;
13
+ const namirasoft_node_cli_1 = require("namirasoft-node-cli");
14
+ const namirasoft_core_1 = require("namirasoft-core");
15
+ const NamirasoftCostServer_1 = require("../NamirasoftCostServer");
16
+ const namirasoft_account_1 = require("namirasoft-account");
17
+ class BillWatchGCPEstimateRecordCommand extends namirasoft_node_cli_1.BaseFinalCommand {
18
+ constructor(argv) {
19
+ super(argv, [], [
20
+ {
21
+ name: "period",
22
+ short: "",
23
+ description: "Provides the value of 'period' in body",
24
+ optional: false,
25
+ args: ["period"],
26
+ defaults: [""]
27
+ },
28
+ {
29
+ name: "total_count",
30
+ short: "",
31
+ description: "Provides the value of 'total_count' in body",
32
+ optional: false,
33
+ args: ["total_count"],
34
+ defaults: [""]
35
+ },
36
+ {
37
+ name: "number",
38
+ short: "",
39
+ description: "Provides the value of 'number' in body",
40
+ optional: false,
41
+ args: ["number"],
42
+ defaults: [""]
43
+ },
44
+ {
45
+ name: "total_value",
46
+ short: "",
47
+ description: "Provides the value of 'total_value' in body",
48
+ optional: false,
49
+ args: ["total_value"],
50
+ defaults: [""]
51
+ },
52
+ {
53
+ name: "value",
54
+ short: "",
55
+ description: "Provides the value of 'value' in body",
56
+ optional: false,
57
+ args: ["value"],
58
+ defaults: [""]
59
+ },
60
+ {
61
+ name: "active",
62
+ short: "",
63
+ description: "Provides the value of 'active' in body",
64
+ optional: false,
65
+ args: ["active"],
66
+ defaults: [""]
67
+ },
68
+ {
69
+ name: "trial_started_at",
70
+ short: "",
71
+ description: "Provides the value of 'trial_started_at' in body",
72
+ optional: true,
73
+ args: ["trial_started_at"],
74
+ defaults: [""]
75
+ }
76
+ ]);
77
+ }
78
+ exec() {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ let token = this.app.storage.getNSAToken();
81
+ if (token == null)
82
+ throw new Error("Token is not available. Please login first using:\nns-cost account config \nor \nns-cost account login.");
83
+ let storage = new namirasoft_core_1.IStorageMemoryDedicated();
84
+ let manager = new namirasoft_account_1.TokenManager(storage, () => { });
85
+ manager.setValue(token, false);
86
+ let url = this.app.storage.getItem("ns-cost-server-url");
87
+ let server = new NamirasoftCostServer_1.NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
88
+ let ans = yield server.bill_watch_gcp.EstimateRecord({
89
+ period: this.option_values.period,
90
+ total_count: this.option_values.total_count,
91
+ number: this.option_values.number,
92
+ total_value: this.option_values.total_value,
93
+ value: this.option_values.value,
94
+ active: this.option_values.active,
95
+ trial_started_at: this.option_values.trial_started_at
96
+ });
97
+ this.app.logger.success(JSON.stringify(ans));
98
+ });
99
+ }
100
+ }
101
+ exports.BillWatchGCPEstimateRecordCommand = BillWatchGCPEstimateRecordCommand;
102
+ ;
103
+ //# sourceMappingURL=BillWatchGCPEstimateRecordCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BillWatchGCPEstimateRecordCommand.js","sourceRoot":"","sources":["../../src/command/BillWatchGCPEstimateRecordCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;AAoBA,6DAAuD;AACvD,qDAA0D;AAC1D,kEAA+D;AAC/D,2DAAkD;AAElD,MAAa,iCAAkC,SAAQ,sCAAgB;IAEnE,YAAY,IAAc;QAEtB,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE;YACZ;gBACI,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,wCAAwC;gBACrD,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,CAAC,QAAQ,CAAC;gBAChB,QAAQ,EAAE,CAAC,EAAE,CAAC;aACjB;YACD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are class BillWatchGCP_CreateForRecordCommand extends BaseFinalCommand {
3
+ constructor(argv: string[]);
4
+ exec(): Promise<void>;
5
+ }