namirasoft-cost 1.4.7 → 1.4.9
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.
- package/.ns-sdkg-dir-deep +2 -2
- package/.ns-sdkg-file-keep +6 -6
- package/dist/NamirasoftCostServer.js +1 -1
- package/dist/NamirasoftCostServerBillWatchAWS.d.ts +8 -0
- package/dist/NamirasoftCostServerBillWatchAWS.js +9 -1
- package/dist/NamirasoftCostServerBillWatchAWS.js.map +1 -1
- package/dist/NamirasoftCostServerBillWatchAzure.d.ts +8 -0
- package/dist/NamirasoftCostServerBillWatchAzure.js +9 -1
- package/dist/NamirasoftCostServerBillWatchAzure.js.map +1 -1
- package/dist/NamirasoftCostServerBillWatchGCP.d.ts +8 -0
- package/dist/NamirasoftCostServerBillWatchGCP.js +9 -1
- package/dist/NamirasoftCostServerBillWatchGCP.js.map +1 -1
- package/dist/command/BillWatchAWSCommand.js +2 -0
- package/dist/command/BillWatchAWSCommand.js.map +1 -1
- package/dist/command/BillWatchAWS_CreateForCommand.d.ts +5 -0
- package/dist/command/BillWatchAWS_CreateForCommand.js +85 -0
- package/dist/command/BillWatchAWS_CreateForCommand.js.map +1 -0
- package/dist/command/BillWatchAzureCommand.js +2 -0
- package/dist/command/BillWatchAzureCommand.js.map +1 -1
- package/dist/command/BillWatchAzure_CreateForCommand.d.ts +5 -0
- package/dist/command/BillWatchAzure_CreateForCommand.js +85 -0
- package/dist/command/BillWatchAzure_CreateForCommand.js.map +1 -0
- package/dist/command/BillWatchGCPCommand.js +2 -0
- package/dist/command/BillWatchGCPCommand.js.map +1 -1
- package/dist/command/BillWatchGCP_CreateForCommand.d.ts +5 -0
- package/dist/command/BillWatchGCP_CreateForCommand.js +85 -0
- package/dist/command/BillWatchGCP_CreateForCommand.js.map +1 -0
- package/dist/command/Cost_CreateForCommand.js +17 -17
- package/dist/command/Cost_CreateForCommand.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/meta/CostMetaTable.d.ts +2 -2
- package/dist/meta/CostMetaTable.js +2 -2
- package/dist/meta/CostMetaTable.js.map +1 -1
- package/dist/row/CostCreateRow.d.ts +2 -2
- package/dist/row/CostRow.d.ts +2 -2
- package/package.json +27 -27
- package/src/NamirasoftCostServer.ts +47 -47
- package/src/NamirasoftCostServerBase.ts +29 -29
- package/src/NamirasoftCostServerBillWatchAWS.ts +46 -38
- package/src/NamirasoftCostServerBillWatchAzure.ts +46 -38
- package/src/NamirasoftCostServerBillWatchGCP.ts +46 -38
- package/src/NamirasoftCostServerCost.ts +49 -49
- package/src/NamirasoftCostServerHealthz.ts +35 -35
- package/src/NamirasoftCostServerValue.ts +36 -36
- package/src/TimeUtil.ts +52 -52
- package/src/command/BillWatchAWSCommand.ts +33 -31
- package/src/command/BillWatchAWSEstimationCommand.ts +73 -73
- package/src/command/BillWatchAWS_CreateForCommand.ts +92 -0
- package/src/command/BillWatchAzureCommand.ts +33 -31
- package/src/command/BillWatchAzureEstimationCommand.ts +73 -73
- package/src/command/BillWatchAzure_CreateForCommand.ts +92 -0
- package/src/command/BillWatchGCPCommand.ts +33 -31
- package/src/command/BillWatchGCPEstimationCommand.ts +73 -73
- package/src/command/BillWatchGCP_CreateForCommand.ts +92 -0
- package/src/command/CostCommand.ts +33 -33
- package/src/command/CostListCommand.ts +44 -44
- package/src/command/Cost_CreateForCommand.ts +172 -172
- package/src/command/HealthzCommand.ts +31 -31
- package/src/command/HealthzGetCommand.ts +44 -44
- package/src/command/ValueCommand.ts +31 -31
- package/src/command/ValueListCommand.ts +44 -44
- package/src/command/cli.ts +42 -42
- package/src/enum/TrialUnit.ts +5 -5
- package/src/index.ts +54 -51
- package/src/meta/CostMetaTable.ts +79 -79
- package/src/meta/NamirasoftCostMetaDatabase.ts +50 -50
- package/src/row/CostCreateRow.ts +36 -36
- package/src/row/CostRow.ts +39 -39
- package/src/type/Estimation.ts +6 -6
- package/src/type/EstimationRow.ts +6 -6
- package/src/type/Period.ts +4 -4
- package/src/type/Trial.ts +6 -6
- package/src/type/TrialDuration.ts +6 -6
@@ -1,50 +1,50 @@
|
|
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 { CostCreateRow } from "./row/CostCreateRow";
|
22
|
-
import { CostRow } from "./row/CostRow";
|
23
|
-
import { FilterItem } from "namirasoft-core";
|
24
|
-
import { NamirasoftCostServer } from "./NamirasoftCostServer";
|
25
|
-
import { NamirasoftCostServerBase } from "./NamirasoftCostServerBase";
|
26
|
-
import { SortItem } from "namirasoft-core";
|
27
|
-
|
28
|
-
export class NamirasoftCostServerCost extends NamirasoftCostServerBase
|
29
|
-
{
|
30
|
-
constructor(server: NamirasoftCostServer)
|
31
|
-
{
|
32
|
-
super(server);
|
33
|
-
this.List = this.List.bind(this);
|
34
|
-
this._CreateFor = this._CreateFor.bind(this);
|
35
|
-
}
|
36
|
-
async List(filters: FilterItem[] | null, page: (number | null), size: (number | null), sorts: SortItem[]): Promise<{ rows: CostRow[], count: number }>
|
37
|
-
{
|
38
|
-
let filters_string_value: string = FilterItem.stringify(filters);
|
39
|
-
let sorts_string_value: string = SortItem.stringify(sorts);
|
40
|
-
let path = `/cost/list`;
|
41
|
-
let { data } = await this.server._get<{ rows: CostRow[], count: number }>(path, { filters: filters_string_value, page, size, sorts: sorts_string_value });
|
42
|
-
return data;
|
43
|
-
}
|
44
|
-
async _CreateFor(user_id: string, body: CostCreateRow): Promise<CostRow>
|
45
|
-
{
|
46
|
-
let path = `/application/user/${user_id}/cost`;
|
47
|
-
let { data } = await this.server._post<CostRow>(path, {}, body);
|
48
|
-
return data;
|
49
|
-
}
|
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 { CostCreateRow } from "./row/CostCreateRow";
|
22
|
+
import { CostRow } from "./row/CostRow";
|
23
|
+
import { FilterItem } from "namirasoft-core";
|
24
|
+
import { NamirasoftCostServer } from "./NamirasoftCostServer";
|
25
|
+
import { NamirasoftCostServerBase } from "./NamirasoftCostServerBase";
|
26
|
+
import { SortItem } from "namirasoft-core";
|
27
|
+
|
28
|
+
export class NamirasoftCostServerCost extends NamirasoftCostServerBase
|
29
|
+
{
|
30
|
+
constructor(server: NamirasoftCostServer)
|
31
|
+
{
|
32
|
+
super(server);
|
33
|
+
this.List = this.List.bind(this);
|
34
|
+
this._CreateFor = this._CreateFor.bind(this);
|
35
|
+
}
|
36
|
+
async List(filters: FilterItem[] | null, page: (number | null), size: (number | null), sorts: SortItem[]): Promise<{ rows: CostRow[], count: number }>
|
37
|
+
{
|
38
|
+
let filters_string_value: string = FilterItem.stringify(filters);
|
39
|
+
let sorts_string_value: string = SortItem.stringify(sorts);
|
40
|
+
let path = `/cost/list`;
|
41
|
+
let { data } = await this.server._get<{ rows: CostRow[], count: number }>(path, { filters: filters_string_value, page, size, sorts: sorts_string_value });
|
42
|
+
return data;
|
43
|
+
}
|
44
|
+
async _CreateFor(user_id: string, body: CostCreateRow): Promise<CostRow>
|
45
|
+
{
|
46
|
+
let path = `/application/user/${user_id}/cost`;
|
47
|
+
let { data } = await this.server._post<CostRow>(path, {}, body);
|
48
|
+
return data;
|
49
|
+
}
|
50
50
|
};
|
@@ -1,36 +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 NamirasoftCostServerHealthz 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 = `/healthz`;
|
34
|
-
await this.server._get<void>(path, {});
|
35
|
-
}
|
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 NamirasoftCostServerHealthz 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 = `/healthz`;
|
34
|
+
await this.server._get<void>(path, {});
|
35
|
+
}
|
36
36
|
};
|
@@ -1,37 +1,37 @@
|
|
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 NamirasoftCostServerValue extends NamirasoftCostServerBase
|
25
|
-
{
|
26
|
-
constructor(server: NamirasoftCostServer)
|
27
|
-
{
|
28
|
-
super(server);
|
29
|
-
this.List = this.List.bind(this);
|
30
|
-
}
|
31
|
-
async List(table: string, column: string, search: (string | null), field_id: (string | null), limit: (number | null)): Promise<string[]>
|
32
|
-
{
|
33
|
-
let path = `/value/list/${table}/${column}`;
|
34
|
-
let { data } = await this.server._get<string[]>(path, { search, field_id, limit });
|
35
|
-
return data;
|
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 NamirasoftCostServerValue extends NamirasoftCostServerBase
|
25
|
+
{
|
26
|
+
constructor(server: NamirasoftCostServer)
|
27
|
+
{
|
28
|
+
super(server);
|
29
|
+
this.List = this.List.bind(this);
|
30
|
+
}
|
31
|
+
async List(table: string, column: string, search: (string | null), field_id: (string | null), limit: (number | null)): Promise<string[]>
|
32
|
+
{
|
33
|
+
let path = `/value/list/${table}/${column}`;
|
34
|
+
let { data } = await this.server._get<string[]>(path, { search, field_id, limit });
|
35
|
+
return data;
|
36
|
+
}
|
37
37
|
};
|
package/src/TimeUtil.ts
CHANGED
@@ -1,53 +1,53 @@
|
|
1
|
-
import { TimeOperation } from "namirasoft-core";
|
2
|
-
import { Trial } from "./type/Trial";
|
3
|
-
import { Period } from "./type/Period";
|
4
|
-
import { TrialUnit } from "./enum/TrialUnit";
|
5
|
-
|
6
|
-
export class TimeUtil
|
7
|
-
{
|
8
|
-
static trialEndsAt(trial: Trial)
|
9
|
-
{
|
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;
|
17
|
-
}
|
18
|
-
static isTrial(trial: Trial, date: Date)
|
19
|
-
{
|
20
|
-
return date <= TimeUtil.trialEndsAt(trial);
|
21
|
-
}
|
22
|
-
static async loopHourly(trial: Trial | null, period: Period, estimate_hour: (period: Period) => Promise<void>): Promise<void>
|
23
|
-
{
|
24
|
-
if (period.end <= period.start)
|
25
|
-
return;
|
26
|
-
|
27
|
-
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
|
-
}
|
35
|
-
|
36
|
-
let start = period.start;
|
37
|
-
let end = null;
|
38
|
-
|
39
|
-
do
|
40
|
-
{
|
41
|
-
end = TimeOperation.hoursLater(1, start);
|
42
|
-
end.setMilliseconds(0);
|
43
|
-
end.setSeconds(0);
|
44
|
-
end.setMinutes(0);
|
45
|
-
if (period.end < end)
|
46
|
-
end = period.end;
|
47
|
-
|
48
|
-
await estimate_hour({ start, end });
|
49
|
-
start = end;
|
50
|
-
}
|
51
|
-
while (end < period.end)
|
52
|
-
}
|
1
|
+
import { TimeOperation } from "namirasoft-core";
|
2
|
+
import { Trial } from "./type/Trial";
|
3
|
+
import { Period } from "./type/Period";
|
4
|
+
import { TrialUnit } from "./enum/TrialUnit";
|
5
|
+
|
6
|
+
export class TimeUtil
|
7
|
+
{
|
8
|
+
static trialEndsAt(trial: Trial)
|
9
|
+
{
|
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;
|
17
|
+
}
|
18
|
+
static isTrial(trial: Trial, date: Date)
|
19
|
+
{
|
20
|
+
return date <= TimeUtil.trialEndsAt(trial);
|
21
|
+
}
|
22
|
+
static async loopHourly(trial: Trial | null, period: Period, estimate_hour: (period: Period) => Promise<void>): Promise<void>
|
23
|
+
{
|
24
|
+
if (period.end <= period.start)
|
25
|
+
return;
|
26
|
+
|
27
|
+
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
|
+
}
|
35
|
+
|
36
|
+
let start = period.start;
|
37
|
+
let end = null;
|
38
|
+
|
39
|
+
do
|
40
|
+
{
|
41
|
+
end = TimeOperation.hoursLater(1, start);
|
42
|
+
end.setMilliseconds(0);
|
43
|
+
end.setSeconds(0);
|
44
|
+
end.setMinutes(0);
|
45
|
+
if (period.end < end)
|
46
|
+
end = period.end;
|
47
|
+
|
48
|
+
await estimate_hour({ start, end });
|
49
|
+
start = end;
|
50
|
+
}
|
51
|
+
while (end < period.end)
|
52
|
+
}
|
53
53
|
}
|
@@ -1,32 +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 { BillWatchAWSEstimationCommand } from "./BillWatchAWSEstimationCommand";
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
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 { BillWatchAWSEstimationCommand } from "./BillWatchAWSEstimationCommand";
|
23
|
+
import { BillWatchAWS_CreateForCommand } from "./BillWatchAWS_CreateForCommand";
|
24
|
+
|
25
|
+
export class BillWatchAWSCommand extends BaseNavigatorCommand
|
26
|
+
{
|
27
|
+
constructor(argv: string[])
|
28
|
+
{
|
29
|
+
super(argv, {
|
30
|
+
"estimation": BillWatchAWSEstimationCommand,
|
31
|
+
"_createfor": BillWatchAWS_CreateForCommand,
|
32
|
+
});
|
33
|
+
}
|
32
34
|
};
|
@@ -1,74 +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 BillWatchAWSEstimationCommand extends BaseFinalCommand
|
27
|
-
{
|
28
|
-
constructor(argv: string[])
|
29
|
-
{
|
30
|
-
super(argv, [], [
|
31
|
-
{
|
32
|
-
name: "first_watch_created_at",
|
33
|
-
short: "",
|
34
|
-
description: "Provides the value of 'first_watch_created_at' in body",
|
35
|
-
optional: true,
|
36
|
-
args: ["first_watch_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.bill_watch_a_w_s.Estimation({
|
68
|
-
first_watch_created_at: this.option_values.first_watch_created_at,
|
69
|
-
period: this.option_values.period,
|
70
|
-
active: this.option_values.active
|
71
|
-
});
|
72
|
-
this.app.logger.success(JSON.stringify(ans));
|
73
|
-
}
|
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 BillWatchAWSEstimationCommand extends BaseFinalCommand
|
27
|
+
{
|
28
|
+
constructor(argv: string[])
|
29
|
+
{
|
30
|
+
super(argv, [], [
|
31
|
+
{
|
32
|
+
name: "first_watch_created_at",
|
33
|
+
short: "",
|
34
|
+
description: "Provides the value of 'first_watch_created_at' in body",
|
35
|
+
optional: true,
|
36
|
+
args: ["first_watch_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.bill_watch_a_w_s.Estimation({
|
68
|
+
first_watch_created_at: this.option_values.first_watch_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
74
|
};
|