namirasoft-cost 1.4.20 → 1.4.22

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 (237) hide show
  1. package/.ns-sdkg-dir-deep +3 -2
  2. package/.ns-sdkg-file-keep +21 -5
  3. package/dist/NamirasoftCostServer.d.ts +2 -0
  4. package/dist/NamirasoftCostServer.js +3 -1
  5. package/dist/NamirasoftCostServer.js.map +1 -1
  6. package/dist/NamirasoftCostServerBillWatchAWS.d.ts +4 -4
  7. package/dist/NamirasoftCostServerBillWatchAWS.js +6 -6
  8. package/dist/NamirasoftCostServerBillWatchAWS.js.map +1 -1
  9. package/dist/NamirasoftCostServerBillWatchAzure.d.ts +4 -4
  10. package/dist/NamirasoftCostServerBillWatchAzure.js +6 -6
  11. package/dist/NamirasoftCostServerBillWatchAzure.js.map +1 -1
  12. package/dist/NamirasoftCostServerBillWatchGCP.d.ts +4 -4
  13. package/dist/NamirasoftCostServerBillWatchGCP.js +6 -6
  14. package/dist/NamirasoftCostServerBillWatchGCP.js.map +1 -1
  15. package/dist/NamirasoftCostServerFieldCategory.d.ts +4 -4
  16. package/dist/NamirasoftCostServerFieldCategory.js +6 -6
  17. package/dist/NamirasoftCostServerFieldCategory.js.map +1 -1
  18. package/dist/NamirasoftCostServerFieldField.d.ts +4 -4
  19. package/dist/NamirasoftCostServerFieldField.js +6 -6
  20. package/dist/NamirasoftCostServerFieldField.js.map +1 -1
  21. package/dist/NamirasoftCostServerSecretSecret.d.ts +36 -0
  22. package/dist/NamirasoftCostServerSecretSecret.js +53 -0
  23. package/dist/NamirasoftCostServerSecretSecret.js.map +1 -0
  24. package/dist/bonus/BaseBonus.d.ts +13 -0
  25. package/dist/bonus/BaseBonus.js +11 -0
  26. package/dist/bonus/BaseBonus.js.map +1 -0
  27. package/dist/bonus/DeactiveBonus.d.ts +10 -0
  28. package/dist/bonus/DeactiveBonus.js +27 -0
  29. package/dist/bonus/DeactiveBonus.js.map +1 -0
  30. package/dist/bonus/FreeCountBonus.d.ts +10 -0
  31. package/dist/bonus/FreeCountBonus.js +27 -0
  32. package/dist/bonus/FreeCountBonus.js.map +1 -0
  33. package/dist/bonus/FreeTotalValueBonus.d.ts +33 -0
  34. package/dist/bonus/FreeTotalValueBonus.js +39 -0
  35. package/dist/bonus/FreeTotalValueBonus.js.map +1 -0
  36. package/dist/bonus/LowAmountBonus.d.ts +10 -0
  37. package/dist/bonus/LowAmountBonus.js +27 -0
  38. package/dist/bonus/LowAmountBonus.js.map +1 -0
  39. package/dist/bonus/LowSecondsBonus.d.ts +10 -0
  40. package/dist/bonus/LowSecondsBonus.js +27 -0
  41. package/dist/bonus/LowSecondsBonus.js.map +1 -0
  42. package/dist/bonus/LowTotalCountBonus.d.ts +10 -0
  43. package/dist/bonus/LowTotalCountBonus.js +27 -0
  44. package/dist/bonus/LowTotalCountBonus.js.map +1 -0
  45. package/dist/bonus/LowTotalValueBonus.d.ts +10 -0
  46. package/dist/bonus/LowTotalValueBonus.js +27 -0
  47. package/dist/bonus/LowTotalValueBonus.js.map +1 -0
  48. package/dist/bonus/TrialBonus.d.ts +12 -0
  49. package/dist/bonus/TrialBonus.js +32 -0
  50. package/dist/bonus/TrialBonus.js.map +1 -0
  51. package/dist/command/BillWatchAWSCommand.js +4 -4
  52. package/dist/command/BillWatchAWSCommand.js.map +1 -1
  53. package/dist/command/{BillWatchAWS_CreateForCommand.d.ts → BillWatchAWSEstimateHourlyCommand.d.ts} +1 -1
  54. package/dist/command/{BillWatchGCPEstimationCommand.js → BillWatchAWSEstimateHourlyCommand.js} +15 -15
  55. package/dist/command/BillWatchAWSEstimateHourlyCommand.js.map +1 -0
  56. package/dist/command/BillWatchAWS_CreateForHourlyCommand.d.ts +5 -0
  57. package/dist/command/{BillWatchAWS_CreateForCommand.js → BillWatchAWS_CreateForHourlyCommand.js} +14 -14
  58. package/dist/command/BillWatchAWS_CreateForHourlyCommand.js.map +1 -0
  59. package/dist/command/BillWatchAzureCommand.js +4 -4
  60. package/dist/command/BillWatchAzureCommand.js.map +1 -1
  61. package/dist/command/BillWatchAzureEstimateHourlyCommand.d.ts +5 -0
  62. package/dist/command/BillWatchAzureEstimateHourlyCommand.js +76 -0
  63. package/dist/command/BillWatchAzureEstimateHourlyCommand.js.map +1 -0
  64. package/dist/command/BillWatchAzure_CreateForHourlyCommand.d.ts +5 -0
  65. package/dist/command/BillWatchAzure_CreateForHourlyCommand.js +94 -0
  66. package/dist/command/BillWatchAzure_CreateForHourlyCommand.js.map +1 -0
  67. package/dist/command/BillWatchGCPCommand.js +4 -4
  68. package/dist/command/BillWatchGCPCommand.js.map +1 -1
  69. package/dist/command/{BillWatchAWSEstimationCommand.d.ts → BillWatchGCPEstimateHourlyCommand.d.ts} +1 -1
  70. package/dist/command/{FieldCategoryEstimationCommand.js → BillWatchGCPEstimateHourlyCommand.js} +15 -15
  71. package/dist/command/BillWatchGCPEstimateHourlyCommand.js.map +1 -0
  72. package/dist/command/BillWatchGCP_CreateForHourlyCommand.d.ts +5 -0
  73. package/dist/command/{FieldCategory_CreateForCommand.js → BillWatchGCP_CreateForHourlyCommand.js} +14 -14
  74. package/dist/command/BillWatchGCP_CreateForHourlyCommand.js.map +1 -0
  75. package/dist/command/FieldCategoryCommand.js +4 -4
  76. package/dist/command/FieldCategoryCommand.js.map +1 -1
  77. package/dist/command/FieldCategoryEstimateHourlyCommand.d.ts +5 -0
  78. package/dist/command/FieldCategoryEstimateHourlyCommand.js +76 -0
  79. package/dist/command/FieldCategoryEstimateHourlyCommand.js.map +1 -0
  80. package/dist/command/FieldCategory_CreateForHourlyCommand.d.ts +5 -0
  81. package/dist/command/FieldCategory_CreateForHourlyCommand.js +94 -0
  82. package/dist/command/FieldCategory_CreateForHourlyCommand.js.map +1 -0
  83. package/dist/command/FieldFieldCommand.js +4 -4
  84. package/dist/command/FieldFieldCommand.js.map +1 -1
  85. package/dist/command/{BillWatchAzure_CreateForCommand.d.ts → FieldFieldEstimateHourlyCommand.d.ts} +1 -1
  86. package/dist/command/{BillWatchAzureEstimationCommand.js → FieldFieldEstimateHourlyCommand.js} +15 -15
  87. package/dist/command/{BillWatchAzureEstimationCommand.js.map → FieldFieldEstimateHourlyCommand.js.map} +1 -1
  88. package/dist/command/FieldField_CreateForHourlyCommand.d.ts +5 -0
  89. package/dist/command/{BillWatchGCP_CreateForCommand.js → FieldField_CreateForHourlyCommand.js} +14 -14
  90. package/dist/command/FieldField_CreateForHourlyCommand.js.map +1 -0
  91. package/dist/command/SecretSecretCommand.d.ts +4 -0
  92. package/dist/command/SecretSecretCommand.js +21 -0
  93. package/dist/command/SecretSecretCommand.js.map +1 -0
  94. package/dist/command/SecretSecretEstimateHourlyCommand.d.ts +5 -0
  95. package/dist/command/{BillWatchAWSEstimationCommand.js → SecretSecretEstimateHourlyCommand.js} +15 -15
  96. package/dist/command/SecretSecretEstimateHourlyCommand.js.map +1 -0
  97. package/dist/command/{BillWatchAzureEstimationCommand.d.ts → SecretSecretEstimateReadCommand.d.ts} +1 -1
  98. package/dist/command/{FieldFieldEstimationCommand.js → SecretSecretEstimateReadCommand.js} +17 -17
  99. package/dist/command/SecretSecretEstimateReadCommand.js.map +1 -0
  100. package/dist/command/SecretSecret_CreateForHourlyCommand.d.ts +5 -0
  101. package/dist/command/{BillWatchAzure_CreateForCommand.js → SecretSecret_CreateForHourlyCommand.js} +14 -14
  102. package/dist/command/SecretSecret_CreateForHourlyCommand.js.map +1 -0
  103. package/dist/command/SecretSecret_CreateForReadCommand.d.ts +5 -0
  104. package/dist/command/{FieldField_CreateForCommand.js → SecretSecret_CreateForReadCommand.js} +16 -16
  105. package/dist/command/SecretSecret_CreateForReadCommand.js.map +1 -0
  106. package/dist/command/cli.js +2 -0
  107. package/dist/command/cli.js.map +1 -1
  108. package/dist/estimator/BaseEstimator.d.ts +15 -0
  109. package/dist/estimator/BaseEstimator.js +58 -0
  110. package/dist/estimator/BaseEstimator.js.map +1 -0
  111. package/dist/estimator/BillWatchAWSHourlyEstimator.d.ts +3 -0
  112. package/dist/estimator/BillWatchAWSHourlyEstimator.js +8 -0
  113. package/dist/estimator/BillWatchAWSHourlyEstimator.js.map +1 -0
  114. package/dist/estimator/BillWatchAzureHourlyEstimator.d.ts +3 -0
  115. package/dist/estimator/BillWatchAzureHourlyEstimator.js +8 -0
  116. package/dist/estimator/BillWatchAzureHourlyEstimator.js.map +1 -0
  117. package/dist/estimator/BillWatchBaseHourlyEstimator.d.ts +14 -0
  118. package/dist/estimator/BillWatchBaseHourlyEstimator.js +26 -0
  119. package/dist/estimator/BillWatchBaseHourlyEstimator.js.map +1 -0
  120. package/dist/estimator/BillWatchGCPHourlyEstimator.d.ts +3 -0
  121. package/dist/estimator/BillWatchGCPHourlyEstimator.js +8 -0
  122. package/dist/estimator/BillWatchGCPHourlyEstimator.js.map +1 -0
  123. package/dist/estimator/FieldBaseHourlyEstimator.d.ts +9 -0
  124. package/dist/estimator/FieldBaseHourlyEstimator.js +22 -0
  125. package/dist/estimator/FieldBaseHourlyEstimator.js.map +1 -0
  126. package/dist/estimator/FieldCategoryHourlyEstimator.d.ts +8 -0
  127. package/dist/estimator/FieldCategoryHourlyEstimator.js +12 -0
  128. package/dist/estimator/FieldCategoryHourlyEstimator.js.map +1 -0
  129. package/dist/estimator/FieldFieldHourlyEstimator.d.ts +8 -0
  130. package/dist/estimator/FieldFieldHourlyEstimator.js +12 -0
  131. package/dist/estimator/FieldFieldHourlyEstimator.js.map +1 -0
  132. package/dist/estimator/SecretSecretHourlyEstimator.d.ts +14 -0
  133. package/dist/estimator/SecretSecretHourlyEstimator.js +25 -0
  134. package/dist/estimator/SecretSecretHourlyEstimator.js.map +1 -0
  135. package/dist/estimator/SecretSecretReadEstimator.d.ts +14 -0
  136. package/dist/estimator/SecretSecretReadEstimator.js +25 -0
  137. package/dist/estimator/SecretSecretReadEstimator.js.map +1 -0
  138. package/dist/index.d.ts +16 -15
  139. package/dist/index.js +16 -15
  140. package/dist/index.js.map +1 -1
  141. package/dist/type/Estimation.d.ts +10 -3
  142. package/dist/type/EstimationOption.d.ts +10 -0
  143. package/dist/type/{EstimationRow.js → EstimationOption.js} +2 -1
  144. package/dist/type/EstimationOption.js.map +1 -0
  145. package/dist/type/Period.d.ts +20 -2
  146. package/dist/type/Period.js +61 -0
  147. package/dist/type/Period.js.map +1 -1
  148. package/dist/type/Usage.d.ts +24 -0
  149. package/dist/type/Usage.js +30 -0
  150. package/dist/type/Usage.js.map +1 -0
  151. package/package.json +2 -2
  152. package/src/NamirasoftCostServer.ts +4 -1
  153. package/src/NamirasoftCostServerBillWatchAWS.ts +6 -6
  154. package/src/NamirasoftCostServerBillWatchAzure.ts +6 -6
  155. package/src/NamirasoftCostServerBillWatchGCP.ts +6 -6
  156. package/src/NamirasoftCostServerFieldCategory.ts +6 -6
  157. package/src/NamirasoftCostServerFieldField.ts +6 -6
  158. package/src/NamirasoftCostServerSecretSecret.ts +61 -0
  159. package/src/bonus/BaseBonus.ts +14 -0
  160. package/src/bonus/DeactiveBonus.ts +15 -0
  161. package/src/bonus/FreeCountBonus.ts +15 -0
  162. package/src/bonus/FreeTotalValueBonus.ts +29 -0
  163. package/src/bonus/LowAmountBonus.ts +15 -0
  164. package/src/bonus/LowSecondsBonus.ts +15 -0
  165. package/src/bonus/LowTotalCountBonus.ts +15 -0
  166. package/src/bonus/LowTotalValueBonus.ts +15 -0
  167. package/src/bonus/TrialBonus.ts +19 -0
  168. package/src/command/BillWatchAWSCommand.ts +4 -4
  169. package/src/command/{FieldCategoryEstimationCommand.ts → BillWatchAWSEstimateHourlyCommand.ts} +12 -12
  170. package/src/command/{BillWatchAzure_CreateForCommand.ts → BillWatchAWS_CreateForHourlyCommand.ts} +11 -11
  171. package/src/command/BillWatchAzureCommand.ts +4 -4
  172. package/src/command/BillWatchAzureEstimateHourlyCommand.ts +83 -0
  173. package/src/command/BillWatchAzure_CreateForHourlyCommand.ts +101 -0
  174. package/src/command/BillWatchGCPCommand.ts +4 -4
  175. package/src/command/{BillWatchGCPEstimationCommand.ts → BillWatchGCPEstimateHourlyCommand.ts} +12 -12
  176. package/src/command/{FieldCategory_CreateForCommand.ts → BillWatchGCP_CreateForHourlyCommand.ts} +11 -11
  177. package/src/command/FieldCategoryCommand.ts +4 -4
  178. package/src/command/FieldCategoryEstimateHourlyCommand.ts +83 -0
  179. package/src/command/FieldCategory_CreateForHourlyCommand.ts +101 -0
  180. package/src/command/FieldFieldCommand.ts +4 -4
  181. package/src/command/{BillWatchAzureEstimationCommand.ts → FieldFieldEstimateHourlyCommand.ts} +12 -12
  182. package/src/command/{BillWatchGCP_CreateForCommand.ts → FieldField_CreateForHourlyCommand.ts} +11 -11
  183. package/src/command/SecretSecretCommand.ts +38 -0
  184. package/src/command/{BillWatchAWSEstimationCommand.ts → SecretSecretEstimateHourlyCommand.ts} +12 -12
  185. package/src/command/{FieldFieldEstimationCommand.ts → SecretSecretEstimateReadCommand.ts} +14 -14
  186. package/src/command/{BillWatchAWS_CreateForCommand.ts → SecretSecret_CreateForHourlyCommand.ts} +11 -11
  187. package/src/command/{FieldField_CreateForCommand.ts → SecretSecret_CreateForReadCommand.ts} +13 -13
  188. package/src/command/cli.ts +2 -0
  189. package/src/estimator/BaseEstimator.ts +63 -0
  190. package/src/estimator/BillWatchAWSHourlyEstimator.ts +5 -0
  191. package/src/estimator/BillWatchAzureHourlyEstimator.ts +5 -0
  192. package/src/estimator/BillWatchBaseHourlyEstimator.ts +26 -0
  193. package/src/estimator/BillWatchGCPHourlyEstimator.ts +5 -0
  194. package/src/estimator/FieldBaseHourlyEstimator.ts +21 -0
  195. package/src/estimator/FieldCategoryHourlyEstimator.ts +10 -0
  196. package/src/estimator/FieldFieldHourlyEstimator.ts +10 -0
  197. package/src/estimator/SecretSecretHourlyEstimator.ts +25 -0
  198. package/src/estimator/SecretSecretReadEstimator.ts +26 -0
  199. package/src/index.ts +17 -16
  200. package/src/type/Estimation.ts +10 -3
  201. package/src/type/EstimationOption.ts +12 -0
  202. package/src/type/Period.ts +72 -3
  203. package/src/type/Usage.ts +25 -0
  204. package/dist/TimeUtil.d.ts +0 -7
  205. package/dist/TimeUtil.js +0 -66
  206. package/dist/TimeUtil.js.map +0 -1
  207. package/dist/command/BillWatchAWSEstimationCommand.js.map +0 -1
  208. package/dist/command/BillWatchAWS_CreateForCommand.js.map +0 -1
  209. package/dist/command/BillWatchAzure_CreateForCommand.js.map +0 -1
  210. package/dist/command/BillWatchGCPEstimationCommand.d.ts +0 -5
  211. package/dist/command/BillWatchGCPEstimationCommand.js.map +0 -1
  212. package/dist/command/BillWatchGCP_CreateForCommand.d.ts +0 -5
  213. package/dist/command/BillWatchGCP_CreateForCommand.js.map +0 -1
  214. package/dist/command/FieldCategoryEstimationCommand.d.ts +0 -5
  215. package/dist/command/FieldCategoryEstimationCommand.js.map +0 -1
  216. package/dist/command/FieldCategory_CreateForCommand.d.ts +0 -5
  217. package/dist/command/FieldCategory_CreateForCommand.js.map +0 -1
  218. package/dist/command/FieldFieldEstimationCommand.d.ts +0 -5
  219. package/dist/command/FieldFieldEstimationCommand.js.map +0 -1
  220. package/dist/command/FieldField_CreateForCommand.d.ts +0 -5
  221. package/dist/command/FieldField_CreateForCommand.js.map +0 -1
  222. package/dist/enum/TrialUnit.d.ts +0 -5
  223. package/dist/enum/TrialUnit.js +0 -10
  224. package/dist/enum/TrialUnit.js.map +0 -1
  225. package/dist/type/EstimationRow.d.ts +0 -9
  226. package/dist/type/EstimationRow.js.map +0 -1
  227. package/dist/type/Trial.d.ts +0 -5
  228. package/dist/type/Trial.js +0 -3
  229. package/dist/type/Trial.js.map +0 -1
  230. package/dist/type/TrialDuration.d.ts +0 -5
  231. package/dist/type/TrialDuration.js +0 -3
  232. package/dist/type/TrialDuration.js.map +0 -1
  233. package/src/TimeUtil.ts +0 -67
  234. package/src/enum/TrialUnit.ts +0 -6
  235. package/src/type/EstimationRow.ts +0 -10
  236. package/src/type/Trial.ts +0 -7
  237. package/src/type/TrialDuration.ts +0 -7
@@ -29,18 +29,18 @@ export class NamirasoftCostServerBillWatchAzure extends NamirasoftCostServerBase
29
29
  constructor(server: NamirasoftCostServer)
30
30
  {
31
31
  super(server);
32
- this.Estimation = this.Estimation.bind(this);
33
- this._CreateFor = this._CreateFor.bind(this);
32
+ this.EstimateHourly = this.EstimateHourly.bind(this);
33
+ this._CreateForHourly = this._CreateForHourly.bind(this);
34
34
  }
35
- async Estimation(body: { first_entity_created_at: (Date | null), row_number: number, active: boolean, period: Period }): Promise<Estimation>
35
+ async EstimateHourly(body: { first_entity_created_at: (Date | null), period: Period, row_number: number, active: boolean }): Promise<Estimation>
36
36
  {
37
- let path = `/estimation/bill-watch/azure`;
37
+ let path = `/estimation/bill-watch/azure/hourly`;
38
38
  let { data } = await this.server._post<Estimation>(path, {}, body);
39
39
  return data;
40
40
  }
41
- async _CreateFor(user_id: string, body: { first_entity_created_at: (Date | null), row_number: number, active: boolean, period: Period, workspace_id: string, resource_id: string }): Promise<CostRow>
41
+ async _CreateForHourly(user_id: string, body: { first_entity_created_at: (Date | null), period: Period, row_number: number, active: boolean, workspace_id: string, resource_id: string }): Promise<CostRow>
42
42
  {
43
- let path = `/application/user/${user_id}/cost/bill-watch/azure`;
43
+ let path = `/application/user/${user_id}/cost/bill-watch/azure/hourly`;
44
44
  let { data } = await this.server._post<CostRow>(path, {}, body);
45
45
  return data;
46
46
  }
@@ -29,18 +29,18 @@ export class NamirasoftCostServerBillWatchGCP extends NamirasoftCostServerBase
29
29
  constructor(server: NamirasoftCostServer)
30
30
  {
31
31
  super(server);
32
- this.Estimation = this.Estimation.bind(this);
33
- this._CreateFor = this._CreateFor.bind(this);
32
+ this.EstimateHourly = this.EstimateHourly.bind(this);
33
+ this._CreateForHourly = this._CreateForHourly.bind(this);
34
34
  }
35
- async Estimation(body: { first_entity_created_at: (Date | null), row_number: number, active: boolean, period: Period }): Promise<Estimation>
35
+ async EstimateHourly(body: { first_entity_created_at: (Date | null), period: Period, row_number: number, active: boolean }): Promise<Estimation>
36
36
  {
37
- let path = `/estimation/bill-watch/gcp`;
37
+ let path = `/estimation/bill-watch/gcp/hourly`;
38
38
  let { data } = await this.server._post<Estimation>(path, {}, body);
39
39
  return data;
40
40
  }
41
- async _CreateFor(user_id: string, body: { first_entity_created_at: (Date | null), row_number: number, active: boolean, period: Period, workspace_id: string, resource_id: string }): Promise<CostRow>
41
+ async _CreateForHourly(user_id: string, body: { first_entity_created_at: (Date | null), period: Period, row_number: number, active: boolean, workspace_id: string, resource_id: string }): Promise<CostRow>
42
42
  {
43
- let path = `/application/user/${user_id}/cost/bill-watch/gcp`;
43
+ let path = `/application/user/${user_id}/cost/bill-watch/gcp/hourly`;
44
44
  let { data } = await this.server._post<CostRow>(path, {}, body);
45
45
  return data;
46
46
  }
@@ -29,18 +29,18 @@ export class NamirasoftCostServerFieldCategory extends NamirasoftCostServerBase
29
29
  constructor(server: NamirasoftCostServer)
30
30
  {
31
31
  super(server);
32
- this.Estimation = this.Estimation.bind(this);
33
- this._CreateFor = this._CreateFor.bind(this);
32
+ this.EstimateHourly = this.EstimateHourly.bind(this);
33
+ this._CreateForHourly = this._CreateForHourly.bind(this);
34
34
  }
35
- async Estimation(body: { first_entity_created_at: (Date | null), row_number: number, active: boolean, period: Period }): Promise<Estimation>
35
+ async EstimateHourly(body: { first_entity_created_at: (Date | null), period: Period, row_number: number, active: boolean }): Promise<Estimation>
36
36
  {
37
- let path = `/estimation/field/category`;
37
+ let path = `/estimation/field/category/hourly`;
38
38
  let { data } = await this.server._post<Estimation>(path, {}, body);
39
39
  return data;
40
40
  }
41
- async _CreateFor(user_id: string, body: { first_entity_created_at: (Date | null), row_number: number, active: boolean, period: Period, workspace_id: string, resource_id: string }): Promise<CostRow>
41
+ async _CreateForHourly(user_id: string, body: { first_entity_created_at: (Date | null), period: Period, row_number: number, active: boolean, workspace_id: string, resource_id: string }): Promise<CostRow>
42
42
  {
43
- let path = `/application/user/${user_id}/cost/field/category`;
43
+ let path = `/application/user/${user_id}/cost/field/category/hourly`;
44
44
  let { data } = await this.server._post<CostRow>(path, {}, body);
45
45
  return data;
46
46
  }
@@ -29,18 +29,18 @@ export class NamirasoftCostServerFieldField extends NamirasoftCostServerBase
29
29
  constructor(server: NamirasoftCostServer)
30
30
  {
31
31
  super(server);
32
- this.Estimation = this.Estimation.bind(this);
33
- this._CreateFor = this._CreateFor.bind(this);
32
+ this.EstimateHourly = this.EstimateHourly.bind(this);
33
+ this._CreateForHourly = this._CreateForHourly.bind(this);
34
34
  }
35
- async Estimation(body: { first_entity_created_at: (Date | null), row_number: number, active: boolean, period: Period }): Promise<Estimation>
35
+ async EstimateHourly(body: { first_entity_created_at: (Date | null), period: Period, row_number: number, active: boolean }): Promise<Estimation>
36
36
  {
37
- let path = `/estimation/field/field`;
37
+ let path = `/estimation/field/field/hourly`;
38
38
  let { data } = await this.server._post<Estimation>(path, {}, body);
39
39
  return data;
40
40
  }
41
- async _CreateFor(user_id: string, body: { first_entity_created_at: (Date | null), row_number: number, active: boolean, period: Period, workspace_id: string, resource_id: string }): Promise<CostRow>
41
+ async _CreateForHourly(user_id: string, body: { first_entity_created_at: (Date | null), period: Period, row_number: number, active: boolean, workspace_id: string, resource_id: string }): Promise<CostRow>
42
42
  {
43
- let path = `/application/user/${user_id}/cost/field/field`;
43
+ let path = `/application/user/${user_id}/cost/field/field/hourly`;
44
44
  let { data } = await this.server._post<CostRow>(path, {}, body);
45
45
  return data;
46
46
  }
@@ -0,0 +1,61 @@
1
+ /****************************************************************/
2
+ /* */
3
+ /* This is an Auto-Generated File */
4
+ /* Made By */
5
+ /* Namirasoft SDK Generator NPM Package */
6
+ /* */
7
+ /****************************************************************/
8
+ /****************************************************************/
9
+ /* */
10
+ /* Please do not make any change to this file */
11
+ /* If any change is required, ns-sdkg command must be used */
12
+ /* */
13
+ /****************************************************************/
14
+ /****************************************************************/
15
+ /* */
16
+ /* Namira Software Corporation */
17
+ /* https://namirasoft.com */
18
+ /* */
19
+ /****************************************************************/
20
+
21
+ import { CostRow } from "./row/CostRow";
22
+ import { Estimation } from "./type/Estimation";
23
+ import { NamirasoftCostServer } from "./NamirasoftCostServer";
24
+ import { NamirasoftCostServerBase } from "./NamirasoftCostServerBase";
25
+ import { Period } from "./type/Period";
26
+
27
+ export class NamirasoftCostServerSecretSecret extends NamirasoftCostServerBase
28
+ {
29
+ constructor(server: NamirasoftCostServer)
30
+ {
31
+ super(server);
32
+ this.EstimateHourly = this.EstimateHourly.bind(this);
33
+ this._CreateForHourly = this._CreateForHourly.bind(this);
34
+ this.EstimateRead = this.EstimateRead.bind(this);
35
+ this._CreateForRead = this._CreateForRead.bind(this);
36
+ }
37
+ async EstimateHourly(body: { first_entity_created_at: (Date | null), period: Period, row_number: number, active: boolean }): Promise<Estimation>
38
+ {
39
+ let path = `/estimation/secret/secret/hourly`;
40
+ let { data } = await this.server._post<Estimation>(path, {}, body);
41
+ return data;
42
+ }
43
+ async _CreateForHourly(user_id: string, body: { first_entity_created_at: (Date | null), period: Period, row_number: number, active: boolean, workspace_id: string, resource_id: string }): Promise<CostRow>
44
+ {
45
+ let path = `/application/user/${user_id}/cost/secret/secret/hourly`;
46
+ let { data } = await this.server._post<CostRow>(path, {}, body);
47
+ return data;
48
+ }
49
+ async EstimateRead(body: { first_entity_created_at: (Date | null), period: Period, total: number, count: number }): Promise<Estimation>
50
+ {
51
+ let path = `/estimation/secret/secret/read`;
52
+ let { data } = await this.server._post<Estimation>(path, {}, body);
53
+ return data;
54
+ }
55
+ async _CreateForRead(user_id: string, body: { first_entity_created_at: (Date | null), period: Period, total: number, count: number, workspace_id: string, resource_id: string }): Promise<CostRow>
56
+ {
57
+ let path = `/application/user/${user_id}/cost/secret/secret/read`;
58
+ let { data } = await this.server._post<CostRow>(path, {}, body);
59
+ return data;
60
+ }
61
+ };
@@ -0,0 +1,14 @@
1
+ import { Estimation } from "../type/Estimation";
2
+ import { EstimationOption } from "../type/EstimationOption";
3
+
4
+ export abstract class BaseBonus
5
+ {
6
+ constructor(public name: string)
7
+ { }
8
+ abstract isFree(option: EstimationOption, estimation: Estimation): Promise<{
9
+ free: boolean, split?: {
10
+ free: EstimationOption;
11
+ paids: EstimationOption[];
12
+ }
13
+ }>;
14
+ };
@@ -0,0 +1,15 @@
1
+ import { Estimation } from "../type/Estimation";
2
+ import { EstimationOption } from "../type/EstimationOption";
3
+ import { BaseBonus } from "./BaseBonus";
4
+
5
+ export class DeactiveBonus extends BaseBonus
6
+ {
7
+ constructor(public count: number)
8
+ {
9
+ super("Deactive");
10
+ }
11
+ async isFree(option: EstimationOption, _: Estimation)
12
+ {
13
+ return { free: !option.active };
14
+ }
15
+ };
@@ -0,0 +1,15 @@
1
+ import { Estimation } from "../type/Estimation";
2
+ import { EstimationOption } from "../type/EstimationOption";
3
+ import { BaseBonus } from "./BaseBonus";
4
+
5
+ export class FreeCountBonus extends BaseBonus
6
+ {
7
+ constructor(public count: number)
8
+ {
9
+ super("Free Count");
10
+ }
11
+ async isFree(option: EstimationOption, _: Estimation)
12
+ {
13
+ return { free: option.number <= this.count };
14
+ }
15
+ };
@@ -0,0 +1,29 @@
1
+ import { Estimation } from "../type/Estimation";
2
+ import { EstimationOption } from "../type/EstimationOption";
3
+ import { BaseBonus } from "./BaseBonus";
4
+
5
+ export class FreeTotalValueBonus extends BaseBonus
6
+ {
7
+ constructor(public value: number)
8
+ {
9
+ super("Free Total Value");
10
+ }
11
+ async isFree(option: EstimationOption, _: Estimation)
12
+ {
13
+ let exceeded = option.total_value - this.value;
14
+ if (exceeded > 0)
15
+ {
16
+ let value_free = Math.max(option.value - exceeded, 0);
17
+ let value_paid = option.value - value_free;
18
+ if (value_free > 0 && value_paid > 0)
19
+ {
20
+ let free = { ...option, total_value: this.value, value: value_free };
21
+ let paid = { ...option, value: value_paid };
22
+ return { free: true, split: { free, paids: [paid] } };
23
+ }
24
+ else if (value_paid > 0)
25
+ return { free: false };
26
+ }
27
+ return { free: true };
28
+ }
29
+ };
@@ -0,0 +1,15 @@
1
+ import { Estimation } from "../type/Estimation";
2
+ import { EstimationOption } from "../type/EstimationOption";
3
+ import { BaseBonus } from "./BaseBonus";
4
+
5
+ export class LowAmountBonus extends BaseBonus
6
+ {
7
+ constructor(public amount: number)
8
+ {
9
+ super("Low Amount");
10
+ }
11
+ async isFree(_: EstimationOption, estimation: Estimation)
12
+ {
13
+ return { free: estimation.amount <= this.amount };
14
+ }
15
+ };
@@ -0,0 +1,15 @@
1
+ import { Estimation } from "../type/Estimation";
2
+ import { EstimationOption } from "../type/EstimationOption";
3
+ import { BaseBonus } from "./BaseBonus";
4
+
5
+ export class LowSecondsBonus extends BaseBonus
6
+ {
7
+ constructor(public seconds: number)
8
+ {
9
+ super("Low Seconds");
10
+ }
11
+ async isFree(_: EstimationOption, estimation: Estimation)
12
+ {
13
+ return { free: estimation.seconds <= this.seconds };
14
+ }
15
+ };
@@ -0,0 +1,15 @@
1
+ import { Estimation } from "../type/Estimation";
2
+ import { EstimationOption } from "../type/EstimationOption";
3
+ import { BaseBonus } from "./BaseBonus";
4
+
5
+ export class LowTotalCountBonus extends BaseBonus
6
+ {
7
+ constructor(public count: number)
8
+ {
9
+ super("Low Total Count");
10
+ }
11
+ async isFree(option: EstimationOption, _: Estimation)
12
+ {
13
+ return { free: option.total_count <= this.count };
14
+ }
15
+ };
@@ -0,0 +1,15 @@
1
+ import { Estimation } from "../type/Estimation";
2
+ import { EstimationOption } from "../type/EstimationOption";
3
+ import { BaseBonus } from "./BaseBonus";
4
+
5
+ export class LowTotalValueBonus extends BaseBonus
6
+ {
7
+ constructor(public value: number)
8
+ {
9
+ super("Low Total Value");
10
+ }
11
+ async isFree(option: EstimationOption, _: Estimation)
12
+ {
13
+ return { free: option.total_value <= this.value };
14
+ }
15
+ };
@@ -0,0 +1,19 @@
1
+ import { DurationUnit, TimeUnitOperation } from "namirasoft-core";
2
+ import { Estimation } from "../type/Estimation";
3
+ import { EstimationOption } from "../type/EstimationOption";
4
+ import { PeriodUtil } from "../type/Period";
5
+ import { BaseBonus } from "./BaseBonus";
6
+
7
+ export class TrialBonus extends BaseBonus
8
+ {
9
+ constructor(public value: number, public unit: DurationUnit)
10
+ {
11
+ super("Trial");
12
+ }
13
+ async isFree(option: EstimationOption, _: Estimation)
14
+ {
15
+ let { start } = PeriodUtil.toDates(option.period);
16
+ let trial_ends_at = TimeUnitOperation.later(this.value, this.unit, option.trial_started_at)
17
+ return { free: start <= trial_ends_at };
18
+ }
19
+ };
@@ -19,16 +19,16 @@
19
19
  /****************************************************************/
20
20
 
21
21
  import { BaseNavigatorCommand } from "namirasoft-node-cli";
22
- import { BillWatchAWSEstimationCommand } from "./BillWatchAWSEstimationCommand";
23
- import { BillWatchAWS_CreateForCommand } from "./BillWatchAWS_CreateForCommand";
22
+ import { BillWatchAWSEstimateHourlyCommand } from "./BillWatchAWSEstimateHourlyCommand";
23
+ import { BillWatchAWS_CreateForHourlyCommand } from "./BillWatchAWS_CreateForHourlyCommand";
24
24
 
25
25
  export class BillWatchAWSCommand extends BaseNavigatorCommand
26
26
  {
27
27
  constructor(argv: string[])
28
28
  {
29
29
  super(argv, {
30
- "estimation": BillWatchAWSEstimationCommand,
31
- "_createfor": BillWatchAWS_CreateForCommand,
30
+ "estimatehourly": BillWatchAWSEstimateHourlyCommand,
31
+ "_createforhourly": BillWatchAWS_CreateForHourlyCommand,
32
32
  });
33
33
  }
34
34
  };
@@ -23,7 +23,7 @@ import { IStorageMemoryDedicated } from "namirasoft-core";
23
23
  import { NamirasoftCostServer } from "../NamirasoftCostServer";
24
24
  import { TokenManager } from "namirasoft-account";
25
25
 
26
- export class FieldCategoryEstimationCommand extends BaseFinalCommand
26
+ export class BillWatchAWSEstimateHourlyCommand extends BaseFinalCommand
27
27
  {
28
28
  constructor(argv: string[])
29
29
  {
@@ -36,6 +36,14 @@ export class FieldCategoryEstimationCommand extends BaseFinalCommand
36
36
  args: ["first_entity_created_at"],
37
37
  defaults: [""]
38
38
  },
39
+ {
40
+ name: "period",
41
+ short: "",
42
+ description: "Provides the value of 'period' in body",
43
+ optional: false,
44
+ args: ["period"],
45
+ defaults: [""]
46
+ },
39
47
  {
40
48
  name: "row_number",
41
49
  short: "",
@@ -51,14 +59,6 @@ export class FieldCategoryEstimationCommand extends BaseFinalCommand
51
59
  optional: false,
52
60
  args: ["active"],
53
61
  defaults: [""]
54
- },
55
- {
56
- name: "period",
57
- short: "",
58
- description: "Provides the value of 'period' in body",
59
- optional: false,
60
- args: ["period"],
61
- defaults: [""]
62
62
  }
63
63
  ]);
64
64
  }
@@ -72,11 +72,11 @@ export class FieldCategoryEstimationCommand extends BaseFinalCommand
72
72
  manager.setValue(token, false);
73
73
  let url = this.app.storage.getItem("ns-cost-server-url");
74
74
  let server = new NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
75
- let ans = await server.field_category.Estimation({
75
+ let ans = await server.bill_watch_aws.EstimateHourly({
76
76
  first_entity_created_at: this.option_values.first_entity_created_at,
77
+ period: this.option_values.period,
77
78
  row_number: this.option_values.row_number,
78
- active: this.option_values.active,
79
- period: this.option_values.period
79
+ active: this.option_values.active
80
80
  });
81
81
  this.app.logger.success(JSON.stringify(ans));
82
82
  }
@@ -23,7 +23,7 @@ import { IStorageMemoryDedicated } from "namirasoft-core";
23
23
  import { NamirasoftCostServer } from "../NamirasoftCostServer";
24
24
  import { TokenManager } from "namirasoft-account";
25
25
 
26
- export class BillWatchAzure_CreateForCommand extends BaseFinalCommand
26
+ export class BillWatchAWS_CreateForHourlyCommand extends BaseFinalCommand
27
27
  {
28
28
  constructor(argv: string[])
29
29
  {
@@ -36,6 +36,14 @@ export class BillWatchAzure_CreateForCommand extends BaseFinalCommand
36
36
  args: ["first_entity_created_at"],
37
37
  defaults: [""]
38
38
  },
39
+ {
40
+ name: "period",
41
+ short: "",
42
+ description: "Provides the value of 'period' in body",
43
+ optional: false,
44
+ args: ["period"],
45
+ defaults: [""]
46
+ },
39
47
  {
40
48
  name: "row_number",
41
49
  short: "",
@@ -52,14 +60,6 @@ export class BillWatchAzure_CreateForCommand extends BaseFinalCommand
52
60
  args: ["active"],
53
61
  defaults: [""]
54
62
  },
55
- {
56
- name: "period",
57
- short: "",
58
- description: "Provides the value of 'period' in body",
59
- optional: false,
60
- args: ["period"],
61
- defaults: [""]
62
- },
63
63
  {
64
64
  name: "workspace_id",
65
65
  short: "",
@@ -88,11 +88,11 @@ export class BillWatchAzure_CreateForCommand extends BaseFinalCommand
88
88
  manager.setValue(token, false);
89
89
  let url = this.app.storage.getItem("ns-cost-server-url");
90
90
  let server = new NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
91
- let ans = await server.bill_watch_azure._CreateFor(this.arg_values[0], {
91
+ let ans = await server.bill_watch_aws._CreateForHourly(this.arg_values[0], {
92
92
  first_entity_created_at: this.option_values.first_entity_created_at,
93
+ period: this.option_values.period,
93
94
  row_number: this.option_values.row_number,
94
95
  active: this.option_values.active,
95
- period: this.option_values.period,
96
96
  workspace_id: this.option_values.workspace_id,
97
97
  resource_id: this.option_values.resource_id
98
98
  });
@@ -19,16 +19,16 @@
19
19
  /****************************************************************/
20
20
 
21
21
  import { BaseNavigatorCommand } from "namirasoft-node-cli";
22
- import { BillWatchAzureEstimationCommand } from "./BillWatchAzureEstimationCommand";
23
- import { BillWatchAzure_CreateForCommand } from "./BillWatchAzure_CreateForCommand";
22
+ import { BillWatchAzureEstimateHourlyCommand } from "./BillWatchAzureEstimateHourlyCommand";
23
+ import { BillWatchAzure_CreateForHourlyCommand } from "./BillWatchAzure_CreateForHourlyCommand";
24
24
 
25
25
  export class BillWatchAzureCommand extends BaseNavigatorCommand
26
26
  {
27
27
  constructor(argv: string[])
28
28
  {
29
29
  super(argv, {
30
- "estimation": BillWatchAzureEstimationCommand,
31
- "_createfor": BillWatchAzure_CreateForCommand,
30
+ "estimatehourly": BillWatchAzureEstimateHourlyCommand,
31
+ "_createforhourly": BillWatchAzure_CreateForHourlyCommand,
32
32
  });
33
33
  }
34
34
  };
@@ -0,0 +1,83 @@
1
+ /****************************************************************/
2
+ /* */
3
+ /* This is an Auto-Generated File */
4
+ /* Made By */
5
+ /* Namirasoft SDK Generator NPM Package */
6
+ /* */
7
+ /****************************************************************/
8
+ /****************************************************************/
9
+ /* */
10
+ /* Please do not make any change to this file */
11
+ /* If any change is required, ns-sdkg command must be used */
12
+ /* */
13
+ /****************************************************************/
14
+ /****************************************************************/
15
+ /* */
16
+ /* Namira Software Corporation */
17
+ /* https://namirasoft.com */
18
+ /* */
19
+ /****************************************************************/
20
+
21
+ import { BaseFinalCommand } from "namirasoft-node-cli";
22
+ import { IStorageMemoryDedicated } from "namirasoft-core";
23
+ import { NamirasoftCostServer } from "../NamirasoftCostServer";
24
+ import { TokenManager } from "namirasoft-account";
25
+
26
+ export class BillWatchAzureEstimateHourlyCommand extends BaseFinalCommand
27
+ {
28
+ constructor(argv: string[])
29
+ {
30
+ super(argv, [], [
31
+ {
32
+ name: "first_entity_created_at",
33
+ short: "",
34
+ description: "Provides the value of 'first_entity_created_at' in body",
35
+ optional: true,
36
+ args: ["first_entity_created_at"],
37
+ defaults: [""]
38
+ },
39
+ {
40
+ name: "period",
41
+ short: "",
42
+ description: "Provides the value of 'period' in body",
43
+ optional: false,
44
+ args: ["period"],
45
+ defaults: [""]
46
+ },
47
+ {
48
+ name: "row_number",
49
+ short: "",
50
+ description: "Provides the value of 'row_number' in body",
51
+ optional: false,
52
+ args: ["row_number"],
53
+ defaults: [""]
54
+ },
55
+ {
56
+ name: "active",
57
+ short: "",
58
+ description: "Provides the value of 'active' in body",
59
+ optional: false,
60
+ args: ["active"],
61
+ defaults: [""]
62
+ }
63
+ ]);
64
+ }
65
+ override async exec()
66
+ {
67
+ let token = this.app.storage.getNSAToken();
68
+ if (token == null)
69
+ throw new Error("Token is not available. Please login first using:\nns-cost account config \nor \nns-cost account login.");
70
+ let storage = new IStorageMemoryDedicated();
71
+ let manager = new TokenManager(storage, () => { });
72
+ manager.setValue(token, false);
73
+ let url = this.app.storage.getItem("ns-cost-server-url");
74
+ let server = new NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
75
+ let ans = await server.bill_watch_azure.EstimateHourly({
76
+ first_entity_created_at: this.option_values.first_entity_created_at,
77
+ period: this.option_values.period,
78
+ row_number: this.option_values.row_number,
79
+ active: this.option_values.active
80
+ });
81
+ this.app.logger.success(JSON.stringify(ans));
82
+ }
83
+ };