namirasoft-cost 1.4.3 → 1.4.5
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 +3 -0
- package/.ns-sdkg-dir-keep +0 -0
- package/.ns-sdkg-file-keep +7 -0
- package/dist/NamirasoftCostServer.d.ts +4 -0
- package/dist/NamirasoftCostServer.js +5 -1
- package/dist/NamirasoftCostServer.js.map +1 -1
- package/dist/NamirasoftCostServerBillWatchAWS.d.ts +4 -4
- package/dist/NamirasoftCostServerBillWatchAWS.js.map +1 -1
- package/dist/NamirasoftCostServerBillWatchAzure.d.ts +11 -0
- package/dist/NamirasoftCostServerBillWatchAzure.js +29 -0
- package/dist/NamirasoftCostServerBillWatchAzure.js.map +1 -0
- package/dist/NamirasoftCostServerBillWatchGCP.d.ts +11 -0
- package/dist/NamirasoftCostServerBillWatchGCP.js +29 -0
- package/dist/NamirasoftCostServerBillWatchGCP.js.map +1 -0
- package/dist/NamirasoftCostServerCost.d.ts +1 -1
- package/dist/NamirasoftCostServerCost.js +3 -3
- package/dist/NamirasoftCostServerCost.js.map +1 -1
- package/dist/TimeUtil.d.ts +7 -0
- package/dist/TimeUtil.js +44 -0
- package/dist/TimeUtil.js.map +1 -0
- package/dist/command/BillWatchAzureCommand.d.ts +4 -0
- package/dist/command/BillWatchAzureCommand.js +15 -0
- package/dist/command/BillWatchAzureCommand.js.map +1 -0
- package/dist/command/BillWatchAzureEstimationCommand.d.ts +5 -0
- package/dist/command/BillWatchAzureEstimationCommand.js +58 -0
- package/dist/command/BillWatchAzureEstimationCommand.js.map +1 -0
- package/dist/command/BillWatchGCPCommand.d.ts +4 -0
- package/dist/command/BillWatchGCPCommand.js +15 -0
- package/dist/command/BillWatchGCPCommand.js.map +1 -0
- package/dist/command/BillWatchGCPEstimationCommand.d.ts +5 -0
- package/dist/command/BillWatchGCPEstimationCommand.js +58 -0
- package/dist/command/BillWatchGCPEstimationCommand.js.map +1 -0
- package/dist/command/CostCommand.js +2 -2
- package/dist/command/CostCommand.js.map +1 -1
- package/dist/command/{Cost_CreateCommand.d.ts → Cost_CreateForCommand.d.ts} +1 -1
- package/dist/command/{Cost_CreateCommand.js → Cost_CreateForCommand.js} +6 -15
- package/dist/command/Cost_CreateForCommand.js.map +1 -0
- package/dist/command/cli.js +4 -0
- package/dist/command/cli.js.map +1 -1
- package/dist/enum/TrialUnit.d.ts +5 -0
- package/dist/enum/TrialUnit.js +10 -0
- package/dist/enum/TrialUnit.js.map +1 -0
- package/dist/index.d.ts +14 -4
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/dist/row/CostCreateRow.d.ts +0 -1
- package/dist/type/Estimation.d.ts +5 -0
- package/dist/{row/EstimationRowRow.js → type/Estimation.js} +1 -1
- package/dist/type/Estimation.js.map +1 -0
- package/dist/type/EstimationRow.d.ts +5 -0
- package/dist/{row → type}/EstimationRow.js.map +1 -1
- package/dist/type/Period.d.ts +4 -0
- package/dist/{row/PeriodRow.js → type/Period.js} +1 -1
- package/dist/type/Period.js.map +1 -0
- package/dist/type/Trial.d.ts +5 -0
- package/dist/type/Trial.js +3 -0
- package/dist/type/Trial.js.map +1 -0
- package/dist/type/TrialDuration.d.ts +5 -0
- package/dist/type/TrialDuration.js +3 -0
- package/dist/type/TrialDuration.js.map +1 -0
- package/package.json +1 -1
- package/src/NamirasoftCostServer.ts +7 -1
- package/src/NamirasoftCostServerBillWatchAWS.ts +4 -4
- package/src/NamirasoftCostServerBillWatchAzure.ts +39 -0
- package/src/{row/PeriodRow.ts → NamirasoftCostServerBillWatchGCP.ts} +18 -4
- package/src/NamirasoftCostServerCost.ts +3 -3
- package/src/TimeUtil.ts +53 -0
- package/src/{row/EstimationRowRow.ts → command/BillWatchAzureCommand.ts} +10 -5
- package/src/command/BillWatchAzureEstimationCommand.ts +65 -0
- package/src/{row/EstimationRow.ts → command/BillWatchGCPCommand.ts} +10 -5
- package/src/command/BillWatchGCPEstimationCommand.ts +65 -0
- package/src/command/CostCommand.ts +2 -2
- package/src/command/{Cost_CreateCommand.ts → Cost_CreateForCommand.ts} +3 -12
- package/src/command/cli.ts +4 -0
- package/src/enum/TrialUnit.ts +6 -0
- package/src/index.ts +14 -4
- package/src/row/CostCreateRow.ts +0 -1
- package/src/type/Estimation.ts +7 -0
- package/src/type/EstimationRow.ts +7 -0
- package/src/type/Period.ts +5 -0
- package/src/type/Trial.ts +7 -0
- package/src/type/TrialDuration.ts +7 -0
- package/dist/command/Cost_CreateCommand.js.map +0 -1
- package/dist/row/EstimationRow.d.ts +0 -5
- package/dist/row/EstimationRowRow.d.ts +0 -5
- package/dist/row/EstimationRowRow.js.map +0 -1
- package/dist/row/PeriodRow.d.ts +0 -4
- package/dist/row/PeriodRow.js.map +0 -1
- /package/dist/{row → type}/EstimationRow.js +0 -0
package/dist/index.d.ts
CHANGED
@@ -1,14 +1,20 @@
|
|
1
1
|
export * from "./NamirasoftCostServer";
|
2
2
|
export * from "./NamirasoftCostServerBase";
|
3
3
|
export * from "./NamirasoftCostServerBillWatchAWS";
|
4
|
+
export * from "./NamirasoftCostServerBillWatchAzure";
|
5
|
+
export * from "./NamirasoftCostServerBillWatchGCP";
|
4
6
|
export * from "./NamirasoftCostServerCost";
|
5
7
|
export * from "./NamirasoftCostServerHealthz";
|
6
8
|
export * from "./NamirasoftCostServerValue";
|
7
9
|
export * from "./command/BillWatchAWSCommand";
|
8
10
|
export * from "./command/BillWatchAWSEstimationCommand";
|
11
|
+
export * from "./command/BillWatchAzureCommand";
|
12
|
+
export * from "./command/BillWatchAzureEstimationCommand";
|
13
|
+
export * from "./command/BillWatchGCPCommand";
|
14
|
+
export * from "./command/BillWatchGCPEstimationCommand";
|
9
15
|
export * from "./command/CostCommand";
|
10
16
|
export * from "./command/CostListCommand";
|
11
|
-
export * from "./command/
|
17
|
+
export * from "./command/Cost_CreateForCommand";
|
12
18
|
export * from "./command/HealthzCommand";
|
13
19
|
export * from "./command/HealthzGetCommand";
|
14
20
|
export * from "./command/ValueCommand";
|
@@ -17,6 +23,10 @@ export * from "./meta/CostMetaTable";
|
|
17
23
|
export * from "./meta/NamirasoftCostMetaDatabase";
|
18
24
|
export * from "./row/CostCreateRow";
|
19
25
|
export * from "./row/CostRow";
|
20
|
-
export * from "./
|
21
|
-
export * from "./
|
22
|
-
export * from "./
|
26
|
+
export * from "./enum/TrialUnit";
|
27
|
+
export * from "./type/Estimation";
|
28
|
+
export * from "./type/EstimationRow";
|
29
|
+
export * from "./type/Period";
|
30
|
+
export * from "./type/Trial";
|
31
|
+
export * from "./type/TrialDuration";
|
32
|
+
export * from "./TimeUtil";
|
package/dist/index.js
CHANGED
@@ -17,14 +17,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./NamirasoftCostServer"), exports);
|
18
18
|
__exportStar(require("./NamirasoftCostServerBase"), exports);
|
19
19
|
__exportStar(require("./NamirasoftCostServerBillWatchAWS"), exports);
|
20
|
+
__exportStar(require("./NamirasoftCostServerBillWatchAzure"), exports);
|
21
|
+
__exportStar(require("./NamirasoftCostServerBillWatchGCP"), exports);
|
20
22
|
__exportStar(require("./NamirasoftCostServerCost"), exports);
|
21
23
|
__exportStar(require("./NamirasoftCostServerHealthz"), exports);
|
22
24
|
__exportStar(require("./NamirasoftCostServerValue"), exports);
|
23
25
|
__exportStar(require("./command/BillWatchAWSCommand"), exports);
|
24
26
|
__exportStar(require("./command/BillWatchAWSEstimationCommand"), exports);
|
27
|
+
__exportStar(require("./command/BillWatchAzureCommand"), exports);
|
28
|
+
__exportStar(require("./command/BillWatchAzureEstimationCommand"), exports);
|
29
|
+
__exportStar(require("./command/BillWatchGCPCommand"), exports);
|
30
|
+
__exportStar(require("./command/BillWatchGCPEstimationCommand"), exports);
|
25
31
|
__exportStar(require("./command/CostCommand"), exports);
|
26
32
|
__exportStar(require("./command/CostListCommand"), exports);
|
27
|
-
__exportStar(require("./command/
|
33
|
+
__exportStar(require("./command/Cost_CreateForCommand"), exports);
|
28
34
|
__exportStar(require("./command/HealthzCommand"), exports);
|
29
35
|
__exportStar(require("./command/HealthzGetCommand"), exports);
|
30
36
|
__exportStar(require("./command/ValueCommand"), exports);
|
@@ -33,7 +39,11 @@ __exportStar(require("./meta/CostMetaTable"), exports);
|
|
33
39
|
__exportStar(require("./meta/NamirasoftCostMetaDatabase"), exports);
|
34
40
|
__exportStar(require("./row/CostCreateRow"), exports);
|
35
41
|
__exportStar(require("./row/CostRow"), exports);
|
36
|
-
__exportStar(require("./
|
37
|
-
__exportStar(require("./
|
38
|
-
__exportStar(require("./
|
42
|
+
__exportStar(require("./enum/TrialUnit"), exports);
|
43
|
+
__exportStar(require("./type/Estimation"), exports);
|
44
|
+
__exportStar(require("./type/EstimationRow"), exports);
|
45
|
+
__exportStar(require("./type/Period"), exports);
|
46
|
+
__exportStar(require("./type/Trial"), exports);
|
47
|
+
__exportStar(require("./type/TrialDuration"), exports);
|
48
|
+
__exportStar(require("./TimeUtil"), exports);
|
39
49
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAoBA,yDAAuC;AACvC,6DAA2C;AAC3C,qEAAmD;AACnD,6DAA2C;AAC3C,gEAA8C;AAC9C,8DAA4C;AAC5C,gEAA8C;AAC9C,0EAAwD;AACxD,wDAAsC;AACtC,4DAA0C;AAC1C
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAoBA,yDAAuC;AACvC,6DAA2C;AAC3C,qEAAmD;AACnD,uEAAqD;AACrD,qEAAmD;AACnD,6DAA2C;AAC3C,gEAA8C;AAC9C,8DAA4C;AAC5C,gEAA8C;AAC9C,0EAAwD;AACxD,kEAAgD;AAChD,4EAA0D;AAC1D,gEAA8C;AAC9C,0EAAwD;AACxD,wDAAsC;AACtC,4DAA0C;AAC1C,kEAAgD;AAChD,2DAAyC;AACzC,8DAA4C;AAC5C,yDAAuC;AACvC,6DAA2C;AAC3C,uDAAqC;AACrC,oEAAkD;AAClD,sDAAoC;AACpC,gDAA8B;AAC9B,mDAAiC;AACjC,oDAAkC;AAClC,uDAAqC;AACrC,gDAA8B;AAC9B,+CAA6B;AAC7B,uDAAqC;AACrC,6CAA2B"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Estimation.js","sourceRoot":"","sources":["../../src/type/Estimation.ts"],"names":[],"mappings":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"EstimationRow.js","sourceRoot":"","sources":["../../src/
|
1
|
+
{"version":3,"file":"EstimationRow.js","sourceRoot":"","sources":["../../src/type/EstimationRow.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Period.js","sourceRoot":"","sources":["../../src/type/Period.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Trial.js","sourceRoot":"","sources":["../../src/type/Trial.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"TrialDuration.js","sourceRoot":"","sources":["../../src/type/TrialDuration.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
@@ -20,6 +20,8 @@
|
|
20
20
|
|
21
21
|
import { NSABaseServer } from "namirasoft-account";
|
22
22
|
import { NamirasoftCostServerBillWatchAWS } from "./NamirasoftCostServerBillWatchAWS";
|
23
|
+
import { NamirasoftCostServerBillWatchAzure } from "./NamirasoftCostServerBillWatchAzure";
|
24
|
+
import { NamirasoftCostServerBillWatchGCP } from "./NamirasoftCostServerBillWatchGCP";
|
23
25
|
import { NamirasoftCostServerCost } from "./NamirasoftCostServerCost";
|
24
26
|
import { NamirasoftCostServerHealthz } from "./NamirasoftCostServerHealthz";
|
25
27
|
import { NamirasoftCostServerValue } from "./NamirasoftCostServerValue";
|
@@ -30,13 +32,17 @@ export class NamirasoftCostServer extends NSABaseServer
|
|
30
32
|
healthz: NamirasoftCostServerHealthz;
|
31
33
|
value: NamirasoftCostServerValue;
|
32
34
|
bill_watch_a_w_s: NamirasoftCostServerBillWatchAWS;
|
35
|
+
bill_watch_azure: NamirasoftCostServerBillWatchAzure;
|
36
|
+
bill_watch_g_c_p: NamirasoftCostServerBillWatchGCP;
|
33
37
|
cost: NamirasoftCostServerCost;
|
34
38
|
constructor(base_url: string, manager: TokenManager, onError: (error: Error) => void)
|
35
39
|
{
|
36
|
-
super(base_url, `1.4.
|
40
|
+
super(base_url, `1.4.4`, manager, onError);
|
37
41
|
this.healthz = new NamirasoftCostServerHealthz(this);
|
38
42
|
this.value = new NamirasoftCostServerValue(this);
|
39
43
|
this.bill_watch_a_w_s = new NamirasoftCostServerBillWatchAWS(this);
|
44
|
+
this.bill_watch_azure = new NamirasoftCostServerBillWatchAzure(this);
|
45
|
+
this.bill_watch_g_c_p = new NamirasoftCostServerBillWatchGCP(this);
|
40
46
|
this.cost = new NamirasoftCostServerCost(this);
|
41
47
|
}
|
42
48
|
};
|
@@ -18,10 +18,10 @@
|
|
18
18
|
/* */
|
19
19
|
/****************************************************************/
|
20
20
|
|
21
|
-
import {
|
21
|
+
import { Estimation } from "./type/Estimation";
|
22
22
|
import { NamirasoftCostServer } from "./NamirasoftCostServer";
|
23
23
|
import { NamirasoftCostServerBase } from "./NamirasoftCostServerBase";
|
24
|
-
import {
|
24
|
+
import { Period } from "./type/Period";
|
25
25
|
|
26
26
|
export class NamirasoftCostServerBillWatchAWS extends NamirasoftCostServerBase
|
27
27
|
{
|
@@ -30,10 +30,10 @@ export class NamirasoftCostServerBillWatchAWS extends NamirasoftCostServerBase
|
|
30
30
|
super(server);
|
31
31
|
this.Estimation = this.Estimation.bind(this);
|
32
32
|
}
|
33
|
-
async Estimation(body: { period:
|
33
|
+
async Estimation(body: { period: Period, active: boolean }): Promise<Estimation>
|
34
34
|
{
|
35
35
|
let path = `/estimation/bill-watch/watch/aws`;
|
36
|
-
let { data } = await this.server._post<
|
36
|
+
let { data } = await this.server._post<Estimation>(path, {}, body);
|
37
37
|
return data;
|
38
38
|
}
|
39
39
|
};
|
@@ -0,0 +1,39 @@
|
|
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 { Estimation } from "./type/Estimation";
|
22
|
+
import { NamirasoftCostServer } from "./NamirasoftCostServer";
|
23
|
+
import { NamirasoftCostServerBase } from "./NamirasoftCostServerBase";
|
24
|
+
import { Period } from "./type/Period";
|
25
|
+
|
26
|
+
export class NamirasoftCostServerBillWatchAzure extends NamirasoftCostServerBase
|
27
|
+
{
|
28
|
+
constructor(server: NamirasoftCostServer)
|
29
|
+
{
|
30
|
+
super(server);
|
31
|
+
this.Estimation = this.Estimation.bind(this);
|
32
|
+
}
|
33
|
+
async Estimation(body: { period: Period, active: boolean }): Promise<Estimation>
|
34
|
+
{
|
35
|
+
let path = `/estimation/bill-watch/watch/azure`;
|
36
|
+
let { data } = await this.server._post<Estimation>(path, {}, body);
|
37
|
+
return data;
|
38
|
+
}
|
39
|
+
};
|
@@ -18,8 +18,22 @@
|
|
18
18
|
/* */
|
19
19
|
/****************************************************************/
|
20
20
|
|
21
|
-
|
21
|
+
import { Estimation } from "./type/Estimation";
|
22
|
+
import { NamirasoftCostServer } from "./NamirasoftCostServer";
|
23
|
+
import { NamirasoftCostServerBase } from "./NamirasoftCostServerBase";
|
24
|
+
import { Period } from "./type/Period";
|
25
|
+
|
26
|
+
export class NamirasoftCostServerBillWatchGCP extends NamirasoftCostServerBase
|
27
|
+
{
|
28
|
+
constructor(server: NamirasoftCostServer)
|
29
|
+
{
|
30
|
+
super(server);
|
31
|
+
this.Estimation = this.Estimation.bind(this);
|
32
|
+
}
|
33
|
+
async Estimation(body: { period: Period, active: boolean }): Promise<Estimation>
|
22
34
|
{
|
23
|
-
|
24
|
-
|
25
|
-
|
35
|
+
let path = `/estimation/bill-watch/watch/gcp`;
|
36
|
+
let { data } = await this.server._post<Estimation>(path, {}, body);
|
37
|
+
return data;
|
38
|
+
}
|
39
|
+
};
|
@@ -31,7 +31,7 @@ export class NamirasoftCostServerCost extends NamirasoftCostServerBase
|
|
31
31
|
{
|
32
32
|
super(server);
|
33
33
|
this.List = this.List.bind(this);
|
34
|
-
this.
|
34
|
+
this._CreateFor = this._CreateFor.bind(this);
|
35
35
|
}
|
36
36
|
async List(filters: FilterItem[] | null, page: (number | null), size: (number | null), sorts: SortItem[]): Promise<{ rows: CostRow[], count: number }>
|
37
37
|
{
|
@@ -41,9 +41,9 @@ export class NamirasoftCostServerCost extends NamirasoftCostServerBase
|
|
41
41
|
let { data } = await this.server._get<{ rows: CostRow[], count: number }>(path, { filters: filters_string_value, page, size, sorts: sorts_string_value });
|
42
42
|
return data;
|
43
43
|
}
|
44
|
-
async
|
44
|
+
async _CreateFor(user_id: string, body: CostCreateRow): Promise<CostRow>
|
45
45
|
{
|
46
|
-
let path = `/application/cost`;
|
46
|
+
let path = `/application/user/${user_id}/cost`;
|
47
47
|
let { data } = await this.server._post<CostRow>(path, {}, body);
|
48
48
|
return data;
|
49
49
|
}
|
package/src/TimeUtil.ts
ADDED
@@ -0,0 +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 loopHourly(trial: Trial | null, period: Period, estimate_hour: (period: Period) => 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
|
+
estimate_hour({ start, end });
|
49
|
+
start = end;
|
50
|
+
}
|
51
|
+
while (end < period.end)
|
52
|
+
}
|
53
|
+
}
|
@@ -18,10 +18,15 @@
|
|
18
18
|
/* */
|
19
19
|
/****************************************************************/
|
20
20
|
|
21
|
-
import {
|
21
|
+
import { BaseNavigatorCommand } from "namirasoft-node-cli";
|
22
|
+
import { BillWatchAzureEstimationCommand } from "./BillWatchAzureEstimationCommand";
|
22
23
|
|
23
|
-
export
|
24
|
+
export class BillWatchAzureCommand extends BaseNavigatorCommand
|
25
|
+
{
|
26
|
+
constructor(argv: string[])
|
24
27
|
{
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
+
super(argv, {
|
29
|
+
"estimation": BillWatchAzureEstimationCommand,
|
30
|
+
});
|
31
|
+
}
|
32
|
+
};
|
@@ -0,0 +1,65 @@
|
|
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 BillWatchAzureEstimationCommand extends BaseFinalCommand
|
27
|
+
{
|
28
|
+
constructor(argv: string[])
|
29
|
+
{
|
30
|
+
super(argv, [], [
|
31
|
+
{
|
32
|
+
name: "period",
|
33
|
+
short: "",
|
34
|
+
description: "Provides the value of 'period' in body",
|
35
|
+
optional: false,
|
36
|
+
args: ["period"],
|
37
|
+
defaults: [""]
|
38
|
+
},
|
39
|
+
{
|
40
|
+
name: "active",
|
41
|
+
short: "",
|
42
|
+
description: "Provides the value of 'active' in body",
|
43
|
+
optional: false,
|
44
|
+
args: ["active"],
|
45
|
+
defaults: [""]
|
46
|
+
}
|
47
|
+
]);
|
48
|
+
}
|
49
|
+
override async exec()
|
50
|
+
{
|
51
|
+
let token = this.app.storage.getNSAToken();
|
52
|
+
if (token == null)
|
53
|
+
throw new Error("Token is not available. Please login first using:\nns-cost account config \nor \nns-cost account login.");
|
54
|
+
let storage = new IStorageMemoryDedicated();
|
55
|
+
let manager = new TokenManager(storage, () => { });
|
56
|
+
manager.setValue(token, false);
|
57
|
+
let url = this.app.storage.getItem("ns-cost-server-url");
|
58
|
+
let server = new NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
|
59
|
+
let ans = await server.bill_watch_azure.Estimation({
|
60
|
+
period: this.option_values.period,
|
61
|
+
active: this.option_values.active
|
62
|
+
});
|
63
|
+
this.app.logger.success(JSON.stringify(ans));
|
64
|
+
}
|
65
|
+
};
|
@@ -18,10 +18,15 @@
|
|
18
18
|
/* */
|
19
19
|
/****************************************************************/
|
20
20
|
|
21
|
-
import {
|
21
|
+
import { BaseNavigatorCommand } from "namirasoft-node-cli";
|
22
|
+
import { BillWatchGCPEstimationCommand } from "./BillWatchGCPEstimationCommand";
|
22
23
|
|
23
|
-
export
|
24
|
+
export class BillWatchGCPCommand extends BaseNavigatorCommand
|
25
|
+
{
|
26
|
+
constructor(argv: string[])
|
24
27
|
{
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
+
super(argv, {
|
29
|
+
"estimation": BillWatchGCPEstimationCommand,
|
30
|
+
});
|
31
|
+
}
|
32
|
+
};
|
@@ -0,0 +1,65 @@
|
|
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 BillWatchGCPEstimationCommand extends BaseFinalCommand
|
27
|
+
{
|
28
|
+
constructor(argv: string[])
|
29
|
+
{
|
30
|
+
super(argv, [], [
|
31
|
+
{
|
32
|
+
name: "period",
|
33
|
+
short: "",
|
34
|
+
description: "Provides the value of 'period' in body",
|
35
|
+
optional: false,
|
36
|
+
args: ["period"],
|
37
|
+
defaults: [""]
|
38
|
+
},
|
39
|
+
{
|
40
|
+
name: "active",
|
41
|
+
short: "",
|
42
|
+
description: "Provides the value of 'active' in body",
|
43
|
+
optional: false,
|
44
|
+
args: ["active"],
|
45
|
+
defaults: [""]
|
46
|
+
}
|
47
|
+
]);
|
48
|
+
}
|
49
|
+
override async exec()
|
50
|
+
{
|
51
|
+
let token = this.app.storage.getNSAToken();
|
52
|
+
if (token == null)
|
53
|
+
throw new Error("Token is not available. Please login first using:\nns-cost account config \nor \nns-cost account login.");
|
54
|
+
let storage = new IStorageMemoryDedicated();
|
55
|
+
let manager = new TokenManager(storage, () => { });
|
56
|
+
manager.setValue(token, false);
|
57
|
+
let url = this.app.storage.getItem("ns-cost-server-url");
|
58
|
+
let server = new NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
|
59
|
+
let ans = await server.bill_watch_g_c_p.Estimation({
|
60
|
+
period: this.option_values.period,
|
61
|
+
active: this.option_values.active
|
62
|
+
});
|
63
|
+
this.app.logger.success(JSON.stringify(ans));
|
64
|
+
}
|
65
|
+
};
|
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
import { BaseNavigatorCommand } from "namirasoft-node-cli";
|
22
22
|
import { CostListCommand } from "./CostListCommand";
|
23
|
-
import {
|
23
|
+
import { Cost_CreateForCommand } from "./Cost_CreateForCommand";
|
24
24
|
|
25
25
|
export class CostCommand extends BaseNavigatorCommand
|
26
26
|
{
|
@@ -28,7 +28,7 @@ export class CostCommand extends BaseNavigatorCommand
|
|
28
28
|
{
|
29
29
|
super(argv, {
|
30
30
|
"list": CostListCommand,
|
31
|
-
"
|
31
|
+
"_createfor": Cost_CreateForCommand,
|
32
32
|
});
|
33
33
|
}
|
34
34
|
};
|
@@ -23,19 +23,11 @@ import { IStorageMemoryDedicated } from "namirasoft-core";
|
|
23
23
|
import { NamirasoftCostServer } from "../NamirasoftCostServer";
|
24
24
|
import { TokenManager } from "namirasoft-account";
|
25
25
|
|
26
|
-
export class
|
26
|
+
export class Cost_CreateForCommand extends BaseFinalCommand
|
27
27
|
{
|
28
28
|
constructor(argv: string[])
|
29
29
|
{
|
30
|
-
super(argv, [], [
|
31
|
-
{
|
32
|
-
name: "user_id",
|
33
|
-
short: "",
|
34
|
-
description: "Provides the value of 'user_id' in body",
|
35
|
-
optional: false,
|
36
|
-
args: ["user_id"],
|
37
|
-
defaults: [""]
|
38
|
-
},
|
30
|
+
super(argv, ["user_id"], [
|
39
31
|
{
|
40
32
|
name: "sales_item_id",
|
41
33
|
short: "",
|
@@ -160,8 +152,7 @@ export class Cost_CreateCommand extends BaseFinalCommand
|
|
160
152
|
manager.setValue(token, false);
|
161
153
|
let url = this.app.storage.getItem("ns-cost-server-url");
|
162
154
|
let server = new NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
|
163
|
-
let ans = await server.cost.
|
164
|
-
user_id: this.option_values.user_id,
|
155
|
+
let ans = await server.cost._CreateFor(this.arg_values[0], {
|
165
156
|
sales_item_id: this.option_values.sales_item_id,
|
166
157
|
offer_id: this.option_values.offer_id,
|
167
158
|
offer_item_id: this.option_values.offer_item_id,
|
package/src/command/cli.ts
CHANGED
@@ -22,6 +22,8 @@
|
|
22
22
|
import { AccountCommand } from "namirasoft-account";
|
23
23
|
import { Application, BaseStorage } from "namirasoft-node-cli";
|
24
24
|
import { BillWatchAWSCommand } from "./BillWatchAWSCommand";
|
25
|
+
import { BillWatchAzureCommand } from "./BillWatchAzureCommand";
|
26
|
+
import { BillWatchGCPCommand } from "./BillWatchGCPCommand";
|
25
27
|
import { ConfigCommand } from "namirasoft-node-cli";
|
26
28
|
import { CostCommand } from "./CostCommand";
|
27
29
|
import { HealthzCommand } from "./HealthzCommand";
|
@@ -32,6 +34,8 @@ let app = new Application("ns-cost", new BaseStorage(),
|
|
32
34
|
"healthz": HealthzCommand,
|
33
35
|
"value": ValueCommand,
|
34
36
|
"billwatchaws": BillWatchAWSCommand,
|
37
|
+
"billwatchazure": BillWatchAzureCommand,
|
38
|
+
"billwatchgcp": BillWatchGCPCommand,
|
35
39
|
"cost": CostCommand,
|
36
40
|
"account": AccountCommand,
|
37
41
|
"config": (argv: string[]) => new ConfigCommand(argv, ["ns-cost-server-url"])
|