namirasoft-cost 1.4.16 → 1.4.18
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 +7 -6
- package/dist/NamirasoftCostServer.js +1 -1
- package/dist/NamirasoftCostServerBillWatchAWS.d.ts +4 -2
- package/dist/NamirasoftCostServerBillWatchAWS.js.map +1 -1
- package/dist/NamirasoftCostServerBillWatchAzure.d.ts +4 -2
- package/dist/NamirasoftCostServerBillWatchAzure.js.map +1 -1
- package/dist/NamirasoftCostServerBillWatchGCP.d.ts +4 -2
- package/dist/NamirasoftCostServerBillWatchGCP.js.map +1 -1
- package/dist/NamirasoftCostServerFieldCategory.d.ts +4 -2
- package/dist/NamirasoftCostServerFieldCategory.js.map +1 -1
- package/dist/NamirasoftCostServerFieldField.d.ts +4 -2
- package/dist/NamirasoftCostServerFieldField.js.map +1 -1
- package/dist/command/BillWatchAWSEstimationCommand.js +14 -5
- package/dist/command/BillWatchAWSEstimationCommand.js.map +1 -1
- package/dist/command/BillWatchAWS_CreateForCommand.js +13 -4
- package/dist/command/BillWatchAWS_CreateForCommand.js.map +1 -1
- package/dist/command/BillWatchAzureEstimationCommand.js +14 -5
- package/dist/command/BillWatchAzureEstimationCommand.js.map +1 -1
- package/dist/command/BillWatchAzure_CreateForCommand.js +13 -4
- package/dist/command/BillWatchAzure_CreateForCommand.js.map +1 -1
- package/dist/command/BillWatchGCPEstimationCommand.js +14 -5
- package/dist/command/BillWatchGCPEstimationCommand.js.map +1 -1
- package/dist/command/BillWatchGCP_CreateForCommand.js +13 -4
- package/dist/command/BillWatchGCP_CreateForCommand.js.map +1 -1
- package/dist/command/Cost_CreateForCommand.js +10 -1
- package/dist/command/Cost_CreateForCommand.js.map +1 -1
- package/dist/command/FieldCategoryEstimationCommand.js +14 -5
- package/dist/command/FieldCategoryEstimationCommand.js.map +1 -1
- package/dist/command/FieldCategory_CreateForCommand.js +13 -4
- package/dist/command/FieldCategory_CreateForCommand.js.map +1 -1
- package/dist/command/FieldFieldEstimationCommand.js +14 -5
- package/dist/command/FieldFieldEstimationCommand.js.map +1 -1
- package/dist/command/FieldField_CreateForCommand.js +13 -4
- package/dist/command/FieldField_CreateForCommand.js.map +1 -1
- package/dist/meta/CostMetaTable.d.ts +1 -0
- package/dist/meta/CostMetaTable.js +1 -0
- package/dist/meta/CostMetaTable.js.map +1 -1
- package/dist/row/CostCreateRow.d.ts +1 -0
- package/dist/row/CostRow.d.ts +1 -0
- package/package.json +27 -27
- package/src/NamirasoftCostServer.ts +56 -56
- package/src/NamirasoftCostServerBase.ts +29 -29
- package/src/NamirasoftCostServerBillWatchAWS.ts +46 -46
- package/src/NamirasoftCostServerBillWatchAzure.ts +46 -46
- package/src/NamirasoftCostServerBillWatchGCP.ts +46 -46
- package/src/NamirasoftCostServerCost.ts +49 -49
- package/src/NamirasoftCostServerFieldCategory.ts +46 -46
- package/src/NamirasoftCostServerFieldField.ts +46 -46
- package/src/NamirasoftCostServerHealthz.ts +35 -35
- package/src/NamirasoftCostServerMetrics.ts +35 -35
- package/src/NamirasoftCostServerValue.ts +36 -36
- package/src/TimeUtil.ts +56 -56
- package/src/command/BillWatchAWSCommand.ts +33 -33
- package/src/command/BillWatchAWSEstimationCommand.ts +82 -73
- package/src/command/BillWatchAWS_CreateForCommand.ts +100 -91
- package/src/command/BillWatchAzureCommand.ts +33 -33
- package/src/command/BillWatchAzureEstimationCommand.ts +82 -73
- package/src/command/BillWatchAzure_CreateForCommand.ts +100 -91
- package/src/command/BillWatchGCPCommand.ts +33 -33
- package/src/command/BillWatchGCPEstimationCommand.ts +82 -73
- package/src/command/BillWatchGCP_CreateForCommand.ts +100 -91
- package/src/command/CostCommand.ts +33 -33
- package/src/command/CostListCommand.ts +44 -44
- package/src/command/Cost_CreateForCommand.ts +181 -172
- package/src/command/FieldCategoryCommand.ts +33 -33
- package/src/command/FieldCategoryEstimationCommand.ts +82 -73
- package/src/command/FieldCategory_CreateForCommand.ts +100 -91
- package/src/command/FieldFieldCommand.ts +33 -33
- package/src/command/FieldFieldEstimationCommand.ts +82 -73
- package/src/command/FieldField_CreateForCommand.ts +100 -91
- package/src/command/HealthzCommand.ts +31 -31
- package/src/command/HealthzGetCommand.ts +44 -44
- package/src/command/MetricsCommand.ts +31 -31
- package/src/command/MetricsGetCommand.ts +44 -44
- package/src/command/ValueCommand.ts +31 -31
- package/src/command/ValueListCommand.ts +44 -44
- package/src/command/cli.ts +48 -48
- package/src/enum/TrialUnit.ts +5 -5
- package/src/index.ts +66 -66
- package/src/meta/CostMetaTable.ts +81 -79
- package/src/meta/NamirasoftCostMetaDatabase.ts +50 -50
- package/src/row/CostCreateRow.ts +37 -36
- package/src/row/CostRow.ts +40 -39
- package/src/type/Estimation.ts +6 -6
- package/src/type/EstimationRow.ts +9 -9
- package/src/type/EstimationUsage.ts +5 -5
- package/src/type/Period.ts +4 -4
- package/src/type/Trial.ts +6 -6
- package/src/type/TrialDuration.ts +6 -6
@@ -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,57 +1,57 @@
|
|
1
|
-
import { TimeOperation, TimeUnitOperation } from "namirasoft-core";
|
2
|
-
import { Trial } from "./type/Trial";
|
3
|
-
import { Period } from "./type/Period";
|
4
|
-
|
5
|
-
export class TimeUtil
|
6
|
-
{
|
7
|
-
static trialEndsAt(trial: Trial)
|
8
|
-
{
|
9
|
-
return TimeUnitOperation.later(trial.duration.value, trial.duration.unit as any, trial.started_at);
|
10
|
-
}
|
11
|
-
static isTrial(trial: Trial, date: Date)
|
12
|
-
{
|
13
|
-
return date <= TimeUtil.trialEndsAt(trial);
|
14
|
-
}
|
15
|
-
static async loopHourly(trial: Trial | null, period: Period, estimate_hour: (period: Period, trial: boolean) => Promise<void>): Promise<void>
|
16
|
-
{
|
17
|
-
if (period.end <= period.start)
|
18
|
-
return;
|
19
|
-
|
20
|
-
let trial_ends_at: Date | null = null;
|
21
|
-
if (trial)
|
22
|
-
trial_ends_at = TimeUtil.trialEndsAt(trial);
|
23
|
-
|
24
|
-
let start = period.start;
|
25
|
-
let end = null;
|
26
|
-
|
27
|
-
do
|
28
|
-
{
|
29
|
-
let next_start = TimeOperation.hoursLater(1, start);
|
30
|
-
next_start.setMilliseconds(0);
|
31
|
-
next_start.setSeconds(0);
|
32
|
-
next_start.setMinutes(0);
|
33
|
-
if (period.end < next_start)
|
34
|
-
next_start = period.end;
|
35
|
-
end = TimeOperation.secondsAgo(1, next_start);
|
36
|
-
if (trial_ends_at)
|
37
|
-
{
|
38
|
-
if (trial_ends_at < period.start)
|
39
|
-
await estimate_hour({ start, end }, false);
|
40
|
-
else if (trial_ends_at <= period.end)
|
41
|
-
{
|
42
|
-
let trial_ends_at_e = TimeOperation.secondsAgo(1, trial_ends_at);
|
43
|
-
let trial_ends_at_s = trial_ends_at;
|
44
|
-
if (start < trial_ends_at_e)
|
45
|
-
await estimate_hour({ start, end: trial_ends_at_e }, true);
|
46
|
-
await estimate_hour({ start: trial_ends_at_s, end }, false);
|
47
|
-
}
|
48
|
-
else if (period.end < trial_ends_at)
|
49
|
-
await estimate_hour({ start: period.start, end: trial_ends_at }, true);
|
50
|
-
}
|
51
|
-
else
|
52
|
-
await estimate_hour({ start, end }, false);
|
53
|
-
start = next_start;
|
54
|
-
}
|
55
|
-
while (end < period.end)
|
56
|
-
}
|
1
|
+
import { TimeOperation, TimeUnitOperation } from "namirasoft-core";
|
2
|
+
import { Trial } from "./type/Trial";
|
3
|
+
import { Period } from "./type/Period";
|
4
|
+
|
5
|
+
export class TimeUtil
|
6
|
+
{
|
7
|
+
static trialEndsAt(trial: Trial)
|
8
|
+
{
|
9
|
+
return TimeUnitOperation.later(trial.duration.value, trial.duration.unit as any, trial.started_at);
|
10
|
+
}
|
11
|
+
static isTrial(trial: Trial, date: Date)
|
12
|
+
{
|
13
|
+
return date <= TimeUtil.trialEndsAt(trial);
|
14
|
+
}
|
15
|
+
static async loopHourly(trial: Trial | null, period: Period, estimate_hour: (period: Period, trial: boolean) => Promise<void>): Promise<void>
|
16
|
+
{
|
17
|
+
if (period.end <= period.start)
|
18
|
+
return;
|
19
|
+
|
20
|
+
let trial_ends_at: Date | null = null;
|
21
|
+
if (trial)
|
22
|
+
trial_ends_at = TimeUtil.trialEndsAt(trial);
|
23
|
+
|
24
|
+
let start = period.start;
|
25
|
+
let end = null;
|
26
|
+
|
27
|
+
do
|
28
|
+
{
|
29
|
+
let next_start = TimeOperation.hoursLater(1, start);
|
30
|
+
next_start.setMilliseconds(0);
|
31
|
+
next_start.setSeconds(0);
|
32
|
+
next_start.setMinutes(0);
|
33
|
+
if (period.end < next_start)
|
34
|
+
next_start = period.end;
|
35
|
+
end = TimeOperation.secondsAgo(1, next_start);
|
36
|
+
if (trial_ends_at)
|
37
|
+
{
|
38
|
+
if (trial_ends_at < period.start)
|
39
|
+
await estimate_hour({ start, end }, false);
|
40
|
+
else if (trial_ends_at <= period.end)
|
41
|
+
{
|
42
|
+
let trial_ends_at_e = TimeOperation.secondsAgo(1, trial_ends_at);
|
43
|
+
let trial_ends_at_s = trial_ends_at;
|
44
|
+
if (start < trial_ends_at_e)
|
45
|
+
await estimate_hour({ start, end: trial_ends_at_e }, true);
|
46
|
+
await estimate_hour({ start: trial_ends_at_s, end }, false);
|
47
|
+
}
|
48
|
+
else if (period.end < trial_ends_at)
|
49
|
+
await estimate_hour({ start: period.start, end: trial_ends_at }, true);
|
50
|
+
}
|
51
|
+
else
|
52
|
+
await estimate_hour({ start, end }, false);
|
53
|
+
start = next_start;
|
54
|
+
}
|
55
|
+
while (end < period.end)
|
56
|
+
}
|
57
57
|
}
|
@@ -1,34 +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
|
-
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
|
-
}
|
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
|
+
}
|
34
34
|
};
|
@@ -1,74 +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 BillWatchAWSEstimationCommand 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: "
|
41
|
-
short: "",
|
42
|
-
description: "Provides the value of '
|
43
|
-
optional: false,
|
44
|
-
args: ["
|
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
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
let
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
});
|
72
|
-
|
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_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: "number",
|
41
|
+
short: "",
|
42
|
+
description: "Provides the value of 'number' in body",
|
43
|
+
optional: false,
|
44
|
+
args: ["number"],
|
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
|
+
name: "period",
|
57
|
+
short: "",
|
58
|
+
description: "Provides the value of 'period' in body",
|
59
|
+
optional: false,
|
60
|
+
args: ["period"],
|
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_aws.Estimation({
|
76
|
+
first_entity_created_at: this.option_values.first_entity_created_at,
|
77
|
+
number: this.option_values.number,
|
78
|
+
active: this.option_values.active,
|
79
|
+
period: this.option_values.period
|
80
|
+
});
|
81
|
+
this.app.logger.success(JSON.stringify(ans));
|
82
|
+
}
|
74
83
|
};
|
@@ -1,92 +1,101 @@
|
|
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 BillWatchAWS_CreateForCommand extends BaseFinalCommand
|
27
|
-
{
|
28
|
-
constructor(argv: string[])
|
29
|
-
{
|
30
|
-
super(argv, ["user_id"], [
|
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: "
|
41
|
-
short: "",
|
42
|
-
description: "Provides the value of '
|
43
|
-
optional: false,
|
44
|
-
args: ["
|
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
|
-
name: "
|
57
|
-
short: "",
|
58
|
-
description: "Provides the value of '
|
59
|
-
optional: false,
|
60
|
-
args: ["
|
61
|
-
defaults: [""]
|
62
|
-
},
|
63
|
-
{
|
64
|
-
name: "
|
65
|
-
short: "",
|
66
|
-
description: "Provides the value of '
|
67
|
-
optional: false,
|
68
|
-
args: ["
|
69
|
-
defaults: [""]
|
70
|
-
}
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
let
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
this.app.logger.
|
91
|
-
|
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 BillWatchAWS_CreateForCommand extends BaseFinalCommand
|
27
|
+
{
|
28
|
+
constructor(argv: string[])
|
29
|
+
{
|
30
|
+
super(argv, ["user_id"], [
|
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: "number",
|
41
|
+
short: "",
|
42
|
+
description: "Provides the value of 'number' in body",
|
43
|
+
optional: false,
|
44
|
+
args: ["number"],
|
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
|
+
name: "period",
|
57
|
+
short: "",
|
58
|
+
description: "Provides the value of 'period' in body",
|
59
|
+
optional: false,
|
60
|
+
args: ["period"],
|
61
|
+
defaults: [""]
|
62
|
+
},
|
63
|
+
{
|
64
|
+
name: "workspace_id",
|
65
|
+
short: "",
|
66
|
+
description: "Provides the value of 'workspace_id' in body",
|
67
|
+
optional: false,
|
68
|
+
args: ["workspace_id"],
|
69
|
+
defaults: [""]
|
70
|
+
},
|
71
|
+
{
|
72
|
+
name: "resource_id",
|
73
|
+
short: "",
|
74
|
+
description: "Provides the value of 'resource_id' in body",
|
75
|
+
optional: false,
|
76
|
+
args: ["resource_id"],
|
77
|
+
defaults: [""]
|
78
|
+
}
|
79
|
+
]);
|
80
|
+
}
|
81
|
+
override async exec()
|
82
|
+
{
|
83
|
+
let token = this.app.storage.getNSAToken();
|
84
|
+
if (token == null)
|
85
|
+
throw new Error("Token is not available. Please login first using:\nns-cost account config \nor \nns-cost account login.");
|
86
|
+
let storage = new IStorageMemoryDedicated();
|
87
|
+
let manager = new TokenManager(storage, () => { });
|
88
|
+
manager.setValue(token, false);
|
89
|
+
let url = this.app.storage.getItem("ns-cost-server-url");
|
90
|
+
let server = new NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
|
91
|
+
let ans = await server.bill_watch_aws._CreateFor(this.arg_values[0], {
|
92
|
+
first_entity_created_at: this.option_values.first_entity_created_at,
|
93
|
+
number: this.option_values.number,
|
94
|
+
active: this.option_values.active,
|
95
|
+
period: this.option_values.period,
|
96
|
+
workspace_id: this.option_values.workspace_id,
|
97
|
+
resource_id: this.option_values.resource_id
|
98
|
+
});
|
99
|
+
this.app.logger.success(JSON.stringify(ans));
|
100
|
+
}
|
92
101
|
};
|