namirasoft-cost 1.4.10 → 1.4.12

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 (91) hide show
  1. package/dist/NamirasoftCostServer.d.ts +8 -2
  2. package/dist/NamirasoftCostServer.js +9 -3
  3. package/dist/NamirasoftCostServer.js.map +1 -1
  4. package/dist/NamirasoftCostServerBillWatchAWS.d.ts +2 -2
  5. package/dist/NamirasoftCostServerBillWatchAWS.js.map +1 -1
  6. package/dist/NamirasoftCostServerBillWatchAzure.d.ts +2 -2
  7. package/dist/NamirasoftCostServerBillWatchAzure.js.map +1 -1
  8. package/dist/NamirasoftCostServerBillWatchGCP.d.ts +2 -2
  9. package/dist/NamirasoftCostServerBillWatchGCP.js.map +1 -1
  10. package/dist/NamirasoftCostServerFieldCategory.d.ts +20 -0
  11. package/dist/NamirasoftCostServerFieldCategory.js +37 -0
  12. package/dist/NamirasoftCostServerFieldCategory.js.map +1 -0
  13. package/dist/NamirasoftCostServerFieldField.d.ts +20 -0
  14. package/dist/NamirasoftCostServerFieldField.js +37 -0
  15. package/dist/NamirasoftCostServerFieldField.js.map +1 -0
  16. package/dist/NamirasoftCostServerMetrics.d.ts +6 -0
  17. package/dist/NamirasoftCostServerMetrics.js +28 -0
  18. package/dist/NamirasoftCostServerMetrics.js.map +1 -0
  19. package/dist/TimeUtil.d.ts +1 -1
  20. package/dist/TimeUtil.js +19 -16
  21. package/dist/TimeUtil.js.map +1 -1
  22. package/dist/command/BillWatchAWSEstimationCommand.js +5 -5
  23. package/dist/command/BillWatchAWSEstimationCommand.js.map +1 -1
  24. package/dist/command/BillWatchAWS_CreateForCommand.js +5 -5
  25. package/dist/command/BillWatchAWS_CreateForCommand.js.map +1 -1
  26. package/dist/command/BillWatchAzureEstimationCommand.js +4 -4
  27. package/dist/command/BillWatchAzureEstimationCommand.js.map +1 -1
  28. package/dist/command/BillWatchAzure_CreateForCommand.js +4 -4
  29. package/dist/command/BillWatchAzure_CreateForCommand.js.map +1 -1
  30. package/dist/command/BillWatchGCPEstimationCommand.js +5 -5
  31. package/dist/command/BillWatchGCPEstimationCommand.js.map +1 -1
  32. package/dist/command/BillWatchGCP_CreateForCommand.js +5 -5
  33. package/dist/command/BillWatchGCP_CreateForCommand.js.map +1 -1
  34. package/dist/command/FieldCategoryCommand.d.ts +4 -0
  35. package/dist/command/FieldCategoryCommand.js +17 -0
  36. package/dist/command/FieldCategoryCommand.js.map +1 -0
  37. package/dist/command/FieldCategoryEstimationCommand.d.ts +5 -0
  38. package/dist/command/FieldCategoryEstimationCommand.js +67 -0
  39. package/dist/command/FieldCategoryEstimationCommand.js.map +1 -0
  40. package/dist/command/FieldCategory_CreateForCommand.d.ts +5 -0
  41. package/dist/command/FieldCategory_CreateForCommand.js +85 -0
  42. package/dist/command/FieldCategory_CreateForCommand.js.map +1 -0
  43. package/dist/command/FieldFieldCommand.d.ts +4 -0
  44. package/dist/command/FieldFieldCommand.js +17 -0
  45. package/dist/command/FieldFieldCommand.js.map +1 -0
  46. package/dist/command/FieldFieldEstimationCommand.d.ts +5 -0
  47. package/dist/command/FieldFieldEstimationCommand.js +67 -0
  48. package/dist/command/FieldFieldEstimationCommand.js.map +1 -0
  49. package/dist/command/FieldField_CreateForCommand.d.ts +5 -0
  50. package/dist/command/FieldField_CreateForCommand.js +85 -0
  51. package/dist/command/FieldField_CreateForCommand.js.map +1 -0
  52. package/dist/command/MetricsCommand.d.ts +4 -0
  53. package/dist/command/MetricsCommand.js +15 -0
  54. package/dist/command/MetricsCommand.js.map +1 -0
  55. package/dist/command/MetricsGetCommand.d.ts +5 -0
  56. package/dist/command/MetricsGetCommand.js +38 -0
  57. package/dist/command/MetricsGetCommand.js.map +1 -0
  58. package/dist/command/cli.js +6 -0
  59. package/dist/command/cli.js.map +1 -1
  60. package/dist/index.d.ts +11 -0
  61. package/dist/index.js +11 -0
  62. package/dist/index.js.map +1 -1
  63. package/dist/meta/NamirasoftCostMetaDatabase.js +1 -1
  64. package/dist/meta/NamirasoftCostMetaDatabase.js.map +1 -1
  65. package/logo.png +0 -0
  66. package/package.json +4 -4
  67. package/src/NamirasoftCostServer.ts +14 -5
  68. package/src/NamirasoftCostServerBillWatchAWS.ts +2 -2
  69. package/src/NamirasoftCostServerBillWatchAzure.ts +2 -2
  70. package/src/NamirasoftCostServerBillWatchGCP.ts +2 -2
  71. package/src/NamirasoftCostServerFieldCategory.ts +47 -0
  72. package/src/NamirasoftCostServerFieldField.ts +47 -0
  73. package/src/NamirasoftCostServerMetrics.ts +36 -0
  74. package/src/TimeUtil.ts +22 -19
  75. package/src/command/BillWatchAWSEstimationCommand.ts +5 -5
  76. package/src/command/BillWatchAWS_CreateForCommand.ts +5 -5
  77. package/src/command/BillWatchAzureEstimationCommand.ts +4 -4
  78. package/src/command/BillWatchAzure_CreateForCommand.ts +4 -4
  79. package/src/command/BillWatchGCPEstimationCommand.ts +5 -5
  80. package/src/command/BillWatchGCP_CreateForCommand.ts +5 -5
  81. package/src/command/FieldCategoryCommand.ts +34 -0
  82. package/src/command/FieldCategoryEstimationCommand.ts +74 -0
  83. package/src/command/FieldCategory_CreateForCommand.ts +92 -0
  84. package/src/command/FieldFieldCommand.ts +34 -0
  85. package/src/command/FieldFieldEstimationCommand.ts +74 -0
  86. package/src/command/FieldField_CreateForCommand.ts +92 -0
  87. package/src/command/MetricsCommand.ts +32 -0
  88. package/src/command/MetricsGetCommand.ts +45 -0
  89. package/src/command/cli.ts +6 -0
  90. package/src/index.ts +11 -0
  91. package/src/meta/NamirasoftCostMetaDatabase.ts +1 -1
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "framework": "npm",
9
9
  "application": "package",
10
10
  "private": false,
11
- "version": "1.4.10",
11
+ "version": "1.4.12",
12
12
  "author": "Amir Abolhasani",
13
13
  "license": "MIT",
14
14
  "main": "./dist/index.js",
@@ -17,10 +17,10 @@
17
17
  "build": ""
18
18
  },
19
19
  "dependencies": {
20
- "namirasoft-core": "^1.4.71",
21
- "namirasoft-site": "^1.4.37",
20
+ "namirasoft-core": "^1.4.79",
21
+ "namirasoft-site": "^1.4.39",
22
22
  "namirasoft-node-cli": "^1.4.7",
23
- "namirasoft-account": "^1.4.72"
23
+ "namirasoft-account": "^1.4.84"
24
24
  },
25
25
  "bin": {
26
26
  "ns-cost": "./dist/command/cli.js"
@@ -23,26 +23,35 @@ import { NamirasoftCostServerBillWatchAWS } from "./NamirasoftCostServerBillWatc
23
23
  import { NamirasoftCostServerBillWatchAzure } from "./NamirasoftCostServerBillWatchAzure";
24
24
  import { NamirasoftCostServerBillWatchGCP } from "./NamirasoftCostServerBillWatchGCP";
25
25
  import { NamirasoftCostServerCost } from "./NamirasoftCostServerCost";
26
+ import { NamirasoftCostServerFieldCategory } from "./NamirasoftCostServerFieldCategory";
27
+ import { NamirasoftCostServerFieldField } from "./NamirasoftCostServerFieldField";
26
28
  import { NamirasoftCostServerHealthz } from "./NamirasoftCostServerHealthz";
29
+ import { NamirasoftCostServerMetrics } from "./NamirasoftCostServerMetrics";
27
30
  import { NamirasoftCostServerValue } from "./NamirasoftCostServerValue";
28
31
  import { TokenManager } from "namirasoft-account";
29
32
 
30
33
  export class NamirasoftCostServer extends NSABaseServer
31
34
  {
32
35
  healthz: NamirasoftCostServerHealthz;
36
+ metrics: NamirasoftCostServerMetrics;
33
37
  value: NamirasoftCostServerValue;
34
- bill_watch_a_w_s: NamirasoftCostServerBillWatchAWS;
38
+ bill_watch_aws: NamirasoftCostServerBillWatchAWS;
35
39
  bill_watch_azure: NamirasoftCostServerBillWatchAzure;
36
- bill_watch_g_c_p: NamirasoftCostServerBillWatchGCP;
40
+ bill_watch_gcp: NamirasoftCostServerBillWatchGCP;
41
+ field_category: NamirasoftCostServerFieldCategory;
42
+ field_field: NamirasoftCostServerFieldField;
37
43
  cost: NamirasoftCostServerCost;
38
44
  constructor(base_url: string, manager: TokenManager, onError: (error: Error) => void)
39
45
  {
40
- super(base_url, `1.4.10`, manager, onError);
46
+ super(base_url, `1.4.11`, manager, onError);
41
47
  this.healthz = new NamirasoftCostServerHealthz(this);
48
+ this.metrics = new NamirasoftCostServerMetrics(this);
42
49
  this.value = new NamirasoftCostServerValue(this);
43
- this.bill_watch_a_w_s = new NamirasoftCostServerBillWatchAWS(this);
50
+ this.bill_watch_aws = new NamirasoftCostServerBillWatchAWS(this);
44
51
  this.bill_watch_azure = new NamirasoftCostServerBillWatchAzure(this);
45
- this.bill_watch_g_c_p = new NamirasoftCostServerBillWatchGCP(this);
52
+ this.bill_watch_gcp = new NamirasoftCostServerBillWatchGCP(this);
53
+ this.field_category = new NamirasoftCostServerFieldCategory(this);
54
+ this.field_field = new NamirasoftCostServerFieldField(this);
46
55
  this.cost = new NamirasoftCostServerCost(this);
47
56
  }
48
57
  };
@@ -32,13 +32,13 @@ export class NamirasoftCostServerBillWatchAWS extends NamirasoftCostServerBase
32
32
  this.Estimation = this.Estimation.bind(this);
33
33
  this._CreateFor = this._CreateFor.bind(this);
34
34
  }
35
- async Estimation(body: { first_watch_created_at: (Date | null), period: Period, active: boolean }): Promise<Estimation>
35
+ async Estimation(body: { first_entity_created_at: (Date | null), period: Period, active: boolean }): Promise<Estimation>
36
36
  {
37
37
  let path = `/estimation/bill-watch/aws`;
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_watch_created_at: (Date | null), period: Period, active: boolean, workspace_id: string, resource_id: string }): Promise<CostRow>
41
+ async _CreateFor(user_id: string, body: { first_entity_created_at: (Date | null), period: Period, active: boolean, workspace_id: string, resource_id: string }): Promise<CostRow>
42
42
  {
43
43
  let path = `/application/user/${user_id}/cost/bill-watch/aws`;
44
44
  let { data } = await this.server._post<CostRow>(path, {}, body);
@@ -32,13 +32,13 @@ export class NamirasoftCostServerBillWatchAzure extends NamirasoftCostServerBase
32
32
  this.Estimation = this.Estimation.bind(this);
33
33
  this._CreateFor = this._CreateFor.bind(this);
34
34
  }
35
- async Estimation(body: { first_watch_created_at: (Date | null), period: Period, active: boolean }): Promise<Estimation>
35
+ async Estimation(body: { first_entity_created_at: (Date | null), period: Period, active: boolean }): Promise<Estimation>
36
36
  {
37
37
  let path = `/estimation/bill-watch/azure`;
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_watch_created_at: (Date | null), period: Period, active: boolean, workspace_id: string, resource_id: string }): Promise<CostRow>
41
+ async _CreateFor(user_id: string, body: { first_entity_created_at: (Date | null), period: Period, active: boolean, workspace_id: string, resource_id: string }): Promise<CostRow>
42
42
  {
43
43
  let path = `/application/user/${user_id}/cost/bill-watch/azure`;
44
44
  let { data } = await this.server._post<CostRow>(path, {}, body);
@@ -32,13 +32,13 @@ export class NamirasoftCostServerBillWatchGCP extends NamirasoftCostServerBase
32
32
  this.Estimation = this.Estimation.bind(this);
33
33
  this._CreateFor = this._CreateFor.bind(this);
34
34
  }
35
- async Estimation(body: { first_watch_created_at: (Date | null), period: Period, active: boolean }): Promise<Estimation>
35
+ async Estimation(body: { first_entity_created_at: (Date | null), period: Period, active: boolean }): Promise<Estimation>
36
36
  {
37
37
  let path = `/estimation/bill-watch/gcp`;
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_watch_created_at: (Date | null), period: Period, active: boolean, workspace_id: string, resource_id: string }): Promise<CostRow>
41
+ async _CreateFor(user_id: string, body: { first_entity_created_at: (Date | null), period: Period, active: boolean, workspace_id: string, resource_id: string }): Promise<CostRow>
42
42
  {
43
43
  let path = `/application/user/${user_id}/cost/bill-watch/gcp`;
44
44
  let { data } = await this.server._post<CostRow>(path, {}, body);
@@ -0,0 +1,47 @@
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 NamirasoftCostServerFieldCategory extends NamirasoftCostServerBase
28
+ {
29
+ constructor(server: NamirasoftCostServer)
30
+ {
31
+ super(server);
32
+ this.Estimation = this.Estimation.bind(this);
33
+ this._CreateFor = this._CreateFor.bind(this);
34
+ }
35
+ async Estimation(body: { first_entity_created_at: (Date | null), period: Period, active: boolean }): Promise<Estimation>
36
+ {
37
+ let path = `/estimation/field/category`;
38
+ let { data } = await this.server._post<Estimation>(path, {}, body);
39
+ return data;
40
+ }
41
+ async _CreateFor(user_id: string, body: { first_entity_created_at: (Date | null), period: Period, active: boolean, workspace_id: string, resource_id: string }): Promise<CostRow>
42
+ {
43
+ let path = `/application/user/${user_id}/cost/field/category`;
44
+ let { data } = await this.server._post<CostRow>(path, {}, body);
45
+ return data;
46
+ }
47
+ };
@@ -0,0 +1,47 @@
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 NamirasoftCostServerFieldField extends NamirasoftCostServerBase
28
+ {
29
+ constructor(server: NamirasoftCostServer)
30
+ {
31
+ super(server);
32
+ this.Estimation = this.Estimation.bind(this);
33
+ this._CreateFor = this._CreateFor.bind(this);
34
+ }
35
+ async Estimation(body: { first_entity_created_at: (Date | null), period: Period, active: boolean }): Promise<Estimation>
36
+ {
37
+ let path = `/estimation/field/field`;
38
+ let { data } = await this.server._post<Estimation>(path, {}, body);
39
+ return data;
40
+ }
41
+ async _CreateFor(user_id: string, body: { first_entity_created_at: (Date | null), period: Period, active: boolean, workspace_id: string, resource_id: string }): Promise<CostRow>
42
+ {
43
+ let path = `/application/user/${user_id}/cost/field/field`;
44
+ let { data } = await this.server._post<CostRow>(path, {}, body);
45
+ return data;
46
+ }
47
+ };
@@ -0,0 +1,36 @@
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 { NamirasoftCostServer } from "./NamirasoftCostServer";
22
+ import { NamirasoftCostServerBase } from "./NamirasoftCostServerBase";
23
+
24
+ export class NamirasoftCostServerMetrics extends NamirasoftCostServerBase
25
+ {
26
+ constructor(server: NamirasoftCostServer)
27
+ {
28
+ super(server);
29
+ this.Get = this.Get.bind(this);
30
+ }
31
+ async Get(): Promise<void>
32
+ {
33
+ let path = `/metrics`;
34
+ await this.server._get<void>(path, {});
35
+ }
36
+ };
package/src/TimeUtil.ts CHANGED
@@ -1,37 +1,25 @@
1
- import { TimeOperation } from "namirasoft-core";
1
+ import { TimeOperation, TimeUnitOperation } from "namirasoft-core";
2
2
  import { Trial } from "./type/Trial";
3
3
  import { Period } from "./type/Period";
4
- import { TrialUnit } from "./enum/TrialUnit";
5
4
 
6
5
  export class TimeUtil
7
6
  {
8
7
  static trialEndsAt(trial: Trial)
9
8
  {
10
- if (trial.duration.unit == TrialUnit.Day)
11
- return TimeOperation.daysLater(trial.duration.value, trial.started_at);
12
- if (trial.duration.unit == TrialUnit.Week)
13
- return TimeOperation.daysLater(trial.duration.value * 7, trial.started_at);
14
- if (trial.duration.unit == TrialUnit.Month)
15
- return TimeOperation.monthsLater(trial.duration.value, trial.started_at);
16
- return trial.started_at;
9
+ return TimeUnitOperation.later(trial.duration.value, trial.duration.unit as any, trial.started_at);
17
10
  }
18
11
  static isTrial(trial: Trial, date: Date)
19
12
  {
20
13
  return date <= TimeUtil.trialEndsAt(trial);
21
14
  }
22
- static async loopHourly(trial: Trial | null, period: Period, estimate_hour: (period: Period) => Promise<void>): Promise<void>
15
+ static async loopHourly(trial: Trial | null, period: Period, estimate_hour: (period: Period, trial: boolean) => Promise<void>): Promise<void>
23
16
  {
24
17
  if (period.end <= period.start)
25
18
  return;
26
19
 
20
+ let trial_ends_at: Date | null = null;
27
21
  if (trial)
28
- {
29
- let ends_at = TimeUtil.trialEndsAt(trial);
30
- if (period.end <= ends_at)
31
- return;
32
- if (period.start <= ends_at)
33
- period.start = ends_at;
34
- }
22
+ trial_ends_at = TimeUtil.trialEndsAt(trial);
35
23
 
36
24
  let start = period.start;
37
25
  let end = null;
@@ -44,8 +32,23 @@ export class TimeUtil
44
32
  end.setMinutes(0);
45
33
  if (period.end < end)
46
34
  end = period.end;
47
-
48
- await estimate_hour({ start, end });
35
+ if (trial_ends_at)
36
+ {
37
+ if (trial_ends_at < period.start)
38
+ await estimate_hour({ start, end }, false);
39
+ else if (trial_ends_at <= period.end)
40
+ {
41
+ let trial_ends_at_e = TimeOperation.secondsAgo(1, trial_ends_at);
42
+ let trial_ends_at_s = trial_ends_at;
43
+ if (start < trial_ends_at_e)
44
+ await estimate_hour({ start, end: trial_ends_at_e }, true);
45
+ await estimate_hour({ start: trial_ends_at_s, end }, false);
46
+ }
47
+ else if (period.end < trial_ends_at)
48
+ await estimate_hour({ start: period.start, end: trial_ends_at }, true);
49
+ }
50
+ else
51
+ await estimate_hour({ start, end }, false);
49
52
  start = end;
50
53
  }
51
54
  while (end < period.end)
@@ -29,11 +29,11 @@ export class BillWatchAWSEstimationCommand extends BaseFinalCommand
29
29
  {
30
30
  super(argv, [], [
31
31
  {
32
- name: "first_watch_created_at",
32
+ name: "first_entity_created_at",
33
33
  short: "",
34
- description: "Provides the value of 'first_watch_created_at' in body",
34
+ description: "Provides the value of 'first_entity_created_at' in body",
35
35
  optional: true,
36
- args: ["first_watch_created_at"],
36
+ args: ["first_entity_created_at"],
37
37
  defaults: [""]
38
38
  },
39
39
  {
@@ -64,8 +64,8 @@ export class BillWatchAWSEstimationCommand extends BaseFinalCommand
64
64
  manager.setValue(token, false);
65
65
  let url = this.app.storage.getItem("ns-cost-server-url");
66
66
  let server = new NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
67
- let ans = await server.bill_watch_a_w_s.Estimation({
68
- first_watch_created_at: this.option_values.first_watch_created_at,
67
+ let ans = await server.bill_watch_aws.Estimation({
68
+ first_entity_created_at: this.option_values.first_entity_created_at,
69
69
  period: this.option_values.period,
70
70
  active: this.option_values.active
71
71
  });
@@ -29,11 +29,11 @@ export class BillWatchAWS_CreateForCommand extends BaseFinalCommand
29
29
  {
30
30
  super(argv, ["user_id"], [
31
31
  {
32
- name: "first_watch_created_at",
32
+ name: "first_entity_created_at",
33
33
  short: "",
34
- description: "Provides the value of 'first_watch_created_at' in body",
34
+ description: "Provides the value of 'first_entity_created_at' in body",
35
35
  optional: true,
36
- args: ["first_watch_created_at"],
36
+ args: ["first_entity_created_at"],
37
37
  defaults: [""]
38
38
  },
39
39
  {
@@ -80,8 +80,8 @@ export class BillWatchAWS_CreateForCommand extends BaseFinalCommand
80
80
  manager.setValue(token, false);
81
81
  let url = this.app.storage.getItem("ns-cost-server-url");
82
82
  let server = new NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
83
- let ans = await server.bill_watch_a_w_s._CreateFor(this.arg_values[0], {
84
- first_watch_created_at: this.option_values.first_watch_created_at,
83
+ let ans = await server.bill_watch_aws._CreateFor(this.arg_values[0], {
84
+ first_entity_created_at: this.option_values.first_entity_created_at,
85
85
  period: this.option_values.period,
86
86
  active: this.option_values.active,
87
87
  workspace_id: this.option_values.workspace_id,
@@ -29,11 +29,11 @@ export class BillWatchAzureEstimationCommand extends BaseFinalCommand
29
29
  {
30
30
  super(argv, [], [
31
31
  {
32
- name: "first_watch_created_at",
32
+ name: "first_entity_created_at",
33
33
  short: "",
34
- description: "Provides the value of 'first_watch_created_at' in body",
34
+ description: "Provides the value of 'first_entity_created_at' in body",
35
35
  optional: true,
36
- args: ["first_watch_created_at"],
36
+ args: ["first_entity_created_at"],
37
37
  defaults: [""]
38
38
  },
39
39
  {
@@ -65,7 +65,7 @@ export class BillWatchAzureEstimationCommand extends BaseFinalCommand
65
65
  let url = this.app.storage.getItem("ns-cost-server-url");
66
66
  let server = new NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
67
67
  let ans = await server.bill_watch_azure.Estimation({
68
- first_watch_created_at: this.option_values.first_watch_created_at,
68
+ first_entity_created_at: this.option_values.first_entity_created_at,
69
69
  period: this.option_values.period,
70
70
  active: this.option_values.active
71
71
  });
@@ -29,11 +29,11 @@ export class BillWatchAzure_CreateForCommand extends BaseFinalCommand
29
29
  {
30
30
  super(argv, ["user_id"], [
31
31
  {
32
- name: "first_watch_created_at",
32
+ name: "first_entity_created_at",
33
33
  short: "",
34
- description: "Provides the value of 'first_watch_created_at' in body",
34
+ description: "Provides the value of 'first_entity_created_at' in body",
35
35
  optional: true,
36
- args: ["first_watch_created_at"],
36
+ args: ["first_entity_created_at"],
37
37
  defaults: [""]
38
38
  },
39
39
  {
@@ -81,7 +81,7 @@ export class BillWatchAzure_CreateForCommand extends BaseFinalCommand
81
81
  let url = this.app.storage.getItem("ns-cost-server-url");
82
82
  let server = new NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
83
83
  let ans = await server.bill_watch_azure._CreateFor(this.arg_values[0], {
84
- first_watch_created_at: this.option_values.first_watch_created_at,
84
+ first_entity_created_at: this.option_values.first_entity_created_at,
85
85
  period: this.option_values.period,
86
86
  active: this.option_values.active,
87
87
  workspace_id: this.option_values.workspace_id,
@@ -29,11 +29,11 @@ export class BillWatchGCPEstimationCommand extends BaseFinalCommand
29
29
  {
30
30
  super(argv, [], [
31
31
  {
32
- name: "first_watch_created_at",
32
+ name: "first_entity_created_at",
33
33
  short: "",
34
- description: "Provides the value of 'first_watch_created_at' in body",
34
+ description: "Provides the value of 'first_entity_created_at' in body",
35
35
  optional: true,
36
- args: ["first_watch_created_at"],
36
+ args: ["first_entity_created_at"],
37
37
  defaults: [""]
38
38
  },
39
39
  {
@@ -64,8 +64,8 @@ export class BillWatchGCPEstimationCommand extends BaseFinalCommand
64
64
  manager.setValue(token, false);
65
65
  let url = this.app.storage.getItem("ns-cost-server-url");
66
66
  let server = new NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
67
- let ans = await server.bill_watch_g_c_p.Estimation({
68
- first_watch_created_at: this.option_values.first_watch_created_at,
67
+ let ans = await server.bill_watch_gcp.Estimation({
68
+ first_entity_created_at: this.option_values.first_entity_created_at,
69
69
  period: this.option_values.period,
70
70
  active: this.option_values.active
71
71
  });
@@ -29,11 +29,11 @@ export class BillWatchGCP_CreateForCommand extends BaseFinalCommand
29
29
  {
30
30
  super(argv, ["user_id"], [
31
31
  {
32
- name: "first_watch_created_at",
32
+ name: "first_entity_created_at",
33
33
  short: "",
34
- description: "Provides the value of 'first_watch_created_at' in body",
34
+ description: "Provides the value of 'first_entity_created_at' in body",
35
35
  optional: true,
36
- args: ["first_watch_created_at"],
36
+ args: ["first_entity_created_at"],
37
37
  defaults: [""]
38
38
  },
39
39
  {
@@ -80,8 +80,8 @@ export class BillWatchGCP_CreateForCommand extends BaseFinalCommand
80
80
  manager.setValue(token, false);
81
81
  let url = this.app.storage.getItem("ns-cost-server-url");
82
82
  let server = new NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
83
- let ans = await server.bill_watch_g_c_p._CreateFor(this.arg_values[0], {
84
- first_watch_created_at: this.option_values.first_watch_created_at,
83
+ let ans = await server.bill_watch_gcp._CreateFor(this.arg_values[0], {
84
+ first_entity_created_at: this.option_values.first_entity_created_at,
85
85
  period: this.option_values.period,
86
86
  active: this.option_values.active,
87
87
  workspace_id: this.option_values.workspace_id,
@@ -0,0 +1,34 @@
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 { BaseNavigatorCommand } from "namirasoft-node-cli";
22
+ import { FieldCategoryEstimationCommand } from "./FieldCategoryEstimationCommand";
23
+ import { FieldCategory_CreateForCommand } from "./FieldCategory_CreateForCommand";
24
+
25
+ export class FieldCategoryCommand extends BaseNavigatorCommand
26
+ {
27
+ constructor(argv: string[])
28
+ {
29
+ super(argv, {
30
+ "estimation": FieldCategoryEstimationCommand,
31
+ "_createfor": FieldCategory_CreateForCommand,
32
+ });
33
+ }
34
+ };
@@ -0,0 +1,74 @@
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 FieldCategoryEstimationCommand 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: "active",
49
+ short: "",
50
+ description: "Provides the value of 'active' in body",
51
+ optional: false,
52
+ args: ["active"],
53
+ defaults: [""]
54
+ }
55
+ ]);
56
+ }
57
+ override async exec()
58
+ {
59
+ let token = this.app.storage.getNSAToken();
60
+ if (token == null)
61
+ throw new Error("Token is not available. Please login first using:\nns-cost account config \nor \nns-cost account login.");
62
+ let storage = new IStorageMemoryDedicated();
63
+ let manager = new TokenManager(storage, () => { });
64
+ manager.setValue(token, false);
65
+ let url = this.app.storage.getItem("ns-cost-server-url");
66
+ let server = new NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
67
+ let ans = await server.field_category.Estimation({
68
+ first_entity_created_at: this.option_values.first_entity_created_at,
69
+ period: this.option_values.period,
70
+ active: this.option_values.active
71
+ });
72
+ this.app.logger.success(JSON.stringify(ans));
73
+ }
74
+ };