@8ms/helpers 2.4.10 → 2.4.11
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/dist/_class/BaseClass.cjs +31 -21
- package/dist/_class/BaseClass.mjs +31 -21
- package/dist/_class/BaseNamespace.cjs +10 -9
- package/dist/_class/BaseNamespace.mjs +10 -9
- package/dist/api/ApiResponseClass.cjs +96 -96
- package/dist/api/ApiResponseClass.mjs +96 -96
- package/dist/aws/cloudWatchLog/server/AwsCloudWatchLogNamespace.cjs +70 -60
- package/dist/aws/cloudWatchLog/server/AwsCloudWatchLogNamespace.mjs +70 -60
- package/dist/aws/cloudWatchMetric/server/AwsCloudWatchMetricNamespace.cjs +30 -28
- package/dist/aws/cloudWatchMetric/server/AwsCloudWatchMetricNamespace.mjs +30 -28
- package/dist/aws/ec2/server/AwsEc2Namespace.cjs +29 -32
- package/dist/aws/ec2/server/AwsEc2Namespace.mjs +29 -32
- package/dist/aws/ecs/server/AwsEcsNamespace.cjs +92 -78
- package/dist/aws/ecs/server/AwsEcsNamespace.mjs +92 -78
- package/dist/aws/glue/server/AwsGlueNamespace.cjs +17 -17
- package/dist/aws/glue/server/AwsGlueNamespace.mjs +17 -17
- package/dist/aws/lambda/server/AwsLambdaNamespace.cjs +33 -31
- package/dist/aws/lambda/server/AwsLambdaNamespace.mjs +33 -31
- package/dist/aws/s3/server/AwsS3Namespace.cjs +280 -265
- package/dist/aws/s3/server/AwsS3Namespace.mjs +280 -265
- package/dist/aws/ses/server/AwsSesNamespace.cjs +27 -30
- package/dist/aws/ses/server/AwsSesNamespace.mjs +27 -30
- package/dist/aws/ses/server/SimpleEmail.cjs +202 -199
- package/dist/aws/ses/server/SimpleEmail.mjs +202 -199
- package/dist/aws/sqs/server/AwsSqsNamespace.cjs +35 -38
- package/dist/aws/sqs/server/AwsSqsNamespace.mjs +35 -38
- package/dist/aws/ssm/server/AwsSsmNamespace.cjs +24 -23
- package/dist/aws/ssm/server/AwsSsmNamespace.mjs +24 -23
- package/dist/date/index.cjs +1 -1
- package/dist/date/index.mjs +1 -1
- package/dist/drizzle/server/DrizzleNamespace.cjs +39 -42
- package/dist/drizzle/server/DrizzleNamespace.mjs +39 -42
- package/dist/googleAds/server/GoogleAdsNamespace.cjs +21 -24
- package/dist/googleAds/server/GoogleAdsNamespace.mjs +21 -24
- package/dist/googleCloud/bigquery/server/GoogleCloudBigqueryNamespace.cjs +86 -70
- package/dist/googleCloud/bigquery/server/GoogleCloudBigqueryNamespace.mjs +86 -70
- package/dist/googleCloud/sheets/server/GoogleCloudSheetsNamespace.cjs +22 -25
- package/dist/googleCloud/sheets/server/GoogleCloudSheetsNamespace.mjs +22 -25
- package/dist/googleCloud/storage/server/GoogleCloudStorageNamespace.cjs +44 -38
- package/dist/googleCloud/storage/server/GoogleCloudStorageNamespace.mjs +44 -38
- package/dist/googlePageSpeed/server/GooglePageSpeedNamespace.cjs +12 -15
- package/dist/googlePageSpeed/server/GooglePageSpeedNamespace.mjs +12 -15
- package/dist/littleWarden/server/LittleWardenNamespace.cjs +12 -15
- package/dist/littleWarden/server/LittleWardenNamespace.mjs +12 -15
- package/dist/onePassword/server/OnePasswordNamespace.cjs +30 -33
- package/dist/onePassword/server/OnePasswordNamespace.mjs +30 -33
- package/dist/openAi/server/OpenAiNamespace.cjs +20 -20
- package/dist/openAi/server/OpenAiNamespace.mjs +20 -20
- package/dist/prisma/server/PrismaNamespace.cjs +35 -38
- package/dist/prisma/server/PrismaNamespace.mjs +35 -38
- package/dist/snapchat/server/SnapchatNamespace.cjs +12 -12
- package/dist/snapchat/server/SnapchatNamespace.mjs +12 -12
- package/dist/upTimeRobot/server/UpTimeRobotNamespace.cjs +19 -19
- package/dist/upTimeRobot/server/UpTimeRobotNamespace.mjs +19 -19
- package/package.json +1 -1
|
@@ -4,66 +4,76 @@ const require_date_calculation = require("../../../date/calculation.cjs");
|
|
|
4
4
|
require("../../../date/index.cjs");
|
|
5
5
|
//#region src/aws/cloudWatchLog/server/AwsCloudWatchLogNamespace.ts
|
|
6
6
|
var AwsCloudWatchLogNamespace = class extends require__class_BaseNamespace.BaseNamespace {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
this.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
7
|
+
ensureInit = async () => {
|
|
8
|
+
if (!this.client) try {
|
|
9
|
+
const { CloudWatchLogsClient } = await import("@aws-sdk/client-cloudwatch-logs");
|
|
10
|
+
this.client = new CloudWatchLogsClient(this.config);
|
|
11
|
+
} catch (e) {
|
|
12
|
+
throw new Error("AWS CloudWatch Logs Client not installed");
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Create a CloudWatch Log Group.
|
|
17
|
+
* This should typically be the name of the application + environment
|
|
18
|
+
*/
|
|
19
|
+
createLogGroup = async (logGroupName) => {
|
|
20
|
+
await this.ensureInit();
|
|
21
|
+
const { CreateLogGroupCommand } = await import("@aws-sdk/client-cloudwatch-logs");
|
|
22
|
+
return await this.client.send(new CreateLogGroupCommand({ logGroupName }));
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Checks whether a CloudWatch Log Group exists.
|
|
26
|
+
*/
|
|
27
|
+
logGroupExists = async (logGroupName) => {
|
|
28
|
+
await this.ensureInit();
|
|
29
|
+
const { DescribeLogGroupsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
|
|
30
|
+
const response = await this.client.send(new DescribeLogGroupsCommand({
|
|
31
|
+
logGroupNamePrefix: logGroupName,
|
|
32
|
+
limit: 1
|
|
33
|
+
}));
|
|
34
|
+
if (!response?.logGroups || 0 === response.logGroups.length) return false;
|
|
35
|
+
return true;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Creates a stream within a CloudWatch Log Group.
|
|
39
|
+
*/
|
|
40
|
+
createStream = async (logGroupName, logStreamName) => {
|
|
41
|
+
await this.ensureInit();
|
|
42
|
+
const { CreateLogStreamCommand } = await import("@aws-sdk/client-cloudwatch-logs");
|
|
43
|
+
return await this.client.send(new CreateLogStreamCommand({
|
|
44
|
+
logGroupName,
|
|
45
|
+
logStreamName
|
|
46
|
+
}));
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Checks whether a CloudWatch Log Stream exists within a given Log Group.
|
|
50
|
+
*/
|
|
51
|
+
logStreamExists = async (logGroupName, logStreamName) => {
|
|
52
|
+
await this.ensureInit();
|
|
53
|
+
const { DescribeLogStreamsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
|
|
54
|
+
const response = await this.client.send(new DescribeLogStreamsCommand({
|
|
55
|
+
logGroupName,
|
|
56
|
+
logStreamNamePrefix: logStreamName,
|
|
57
|
+
limit: 1
|
|
58
|
+
}));
|
|
59
|
+
if (!response?.logStreams || 0 === response.logStreams.length) return false;
|
|
60
|
+
return true;
|
|
61
|
+
};
|
|
62
|
+
logEvent = async (logGroupName, logStreamName, logEvent) => {
|
|
63
|
+
return await this.logEvents(logGroupName, logStreamName, [logEvent]);
|
|
64
|
+
};
|
|
65
|
+
logEvents = async (logGroupName, logStreamName, logEvents) => {
|
|
66
|
+
await this.ensureInit();
|
|
67
|
+
const { PutLogEventsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
|
|
68
|
+
return await this.client.send(new PutLogEventsCommand({
|
|
69
|
+
logGroupName,
|
|
70
|
+
logStreamName,
|
|
71
|
+
logEvents: logEvents.map((event) => ({
|
|
72
|
+
timestamp: require_date_calculation.getLuxonDate(event.timestamp).toMillis(),
|
|
73
|
+
message: typeof event.data === "string" ? event.data : JSON.stringify(event.data)
|
|
74
|
+
}))
|
|
75
|
+
}));
|
|
76
|
+
};
|
|
67
77
|
};
|
|
68
78
|
//#endregion
|
|
69
79
|
exports.AwsCloudWatchLogNamespace = AwsCloudWatchLogNamespace;
|
|
@@ -3,66 +3,76 @@ import { getLuxonDate } from "../../../date/calculation.mjs";
|
|
|
3
3
|
import "../../../date/index.mjs";
|
|
4
4
|
//#region src/aws/cloudWatchLog/server/AwsCloudWatchLogNamespace.ts
|
|
5
5
|
var AwsCloudWatchLogNamespace = class extends BaseNamespace {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
this.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
6
|
+
ensureInit = async () => {
|
|
7
|
+
if (!this.client) try {
|
|
8
|
+
const { CloudWatchLogsClient } = await import("@aws-sdk/client-cloudwatch-logs");
|
|
9
|
+
this.client = new CloudWatchLogsClient(this.config);
|
|
10
|
+
} catch (e) {
|
|
11
|
+
throw new Error("AWS CloudWatch Logs Client not installed");
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Create a CloudWatch Log Group.
|
|
16
|
+
* This should typically be the name of the application + environment
|
|
17
|
+
*/
|
|
18
|
+
createLogGroup = async (logGroupName) => {
|
|
19
|
+
await this.ensureInit();
|
|
20
|
+
const { CreateLogGroupCommand } = await import("@aws-sdk/client-cloudwatch-logs");
|
|
21
|
+
return await this.client.send(new CreateLogGroupCommand({ logGroupName }));
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Checks whether a CloudWatch Log Group exists.
|
|
25
|
+
*/
|
|
26
|
+
logGroupExists = async (logGroupName) => {
|
|
27
|
+
await this.ensureInit();
|
|
28
|
+
const { DescribeLogGroupsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
|
|
29
|
+
const response = await this.client.send(new DescribeLogGroupsCommand({
|
|
30
|
+
logGroupNamePrefix: logGroupName,
|
|
31
|
+
limit: 1
|
|
32
|
+
}));
|
|
33
|
+
if (!response?.logGroups || 0 === response.logGroups.length) return false;
|
|
34
|
+
return true;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Creates a stream within a CloudWatch Log Group.
|
|
38
|
+
*/
|
|
39
|
+
createStream = async (logGroupName, logStreamName) => {
|
|
40
|
+
await this.ensureInit();
|
|
41
|
+
const { CreateLogStreamCommand } = await import("@aws-sdk/client-cloudwatch-logs");
|
|
42
|
+
return await this.client.send(new CreateLogStreamCommand({
|
|
43
|
+
logGroupName,
|
|
44
|
+
logStreamName
|
|
45
|
+
}));
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Checks whether a CloudWatch Log Stream exists within a given Log Group.
|
|
49
|
+
*/
|
|
50
|
+
logStreamExists = async (logGroupName, logStreamName) => {
|
|
51
|
+
await this.ensureInit();
|
|
52
|
+
const { DescribeLogStreamsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
|
|
53
|
+
const response = await this.client.send(new DescribeLogStreamsCommand({
|
|
54
|
+
logGroupName,
|
|
55
|
+
logStreamNamePrefix: logStreamName,
|
|
56
|
+
limit: 1
|
|
57
|
+
}));
|
|
58
|
+
if (!response?.logStreams || 0 === response.logStreams.length) return false;
|
|
59
|
+
return true;
|
|
60
|
+
};
|
|
61
|
+
logEvent = async (logGroupName, logStreamName, logEvent) => {
|
|
62
|
+
return await this.logEvents(logGroupName, logStreamName, [logEvent]);
|
|
63
|
+
};
|
|
64
|
+
logEvents = async (logGroupName, logStreamName, logEvents) => {
|
|
65
|
+
await this.ensureInit();
|
|
66
|
+
const { PutLogEventsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
|
|
67
|
+
return await this.client.send(new PutLogEventsCommand({
|
|
68
|
+
logGroupName,
|
|
69
|
+
logStreamName,
|
|
70
|
+
logEvents: logEvents.map((event) => ({
|
|
71
|
+
timestamp: getLuxonDate(event.timestamp).toMillis(),
|
|
72
|
+
message: typeof event.data === "string" ? event.data : JSON.stringify(event.data)
|
|
73
|
+
}))
|
|
74
|
+
}));
|
|
75
|
+
};
|
|
66
76
|
};
|
|
67
77
|
//#endregion
|
|
68
78
|
export { AwsCloudWatchLogNamespace };
|
|
@@ -7,35 +7,37 @@ require("../../../date/index.cjs");
|
|
|
7
7
|
let _aws_sdk_client_cloudwatch = require("@aws-sdk/client-cloudwatch");
|
|
8
8
|
//#region src/aws/cloudWatchMetric/server/AwsCloudWatchMetricNamespace.ts
|
|
9
9
|
var AwsCloudWatchMetricNamespace = class extends require__class_BaseNamespace.BaseNamespace {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
10
|
+
ensureInit = async () => {
|
|
11
|
+
if (!this.client) try {
|
|
12
|
+
const { CloudWatchClient } = await import("@aws-sdk/client-cloudwatch");
|
|
13
|
+
this.client = new CloudWatchClient(this.config);
|
|
14
|
+
} catch (e) {
|
|
15
|
+
throw new Error("AWS CloudWatch Client not installed");
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Publishes metric data to CloudWatch.
|
|
20
|
+
* The namespace is created automatically.
|
|
21
|
+
* Dimensions should contain additional info (but top level).
|
|
22
|
+
*/
|
|
23
|
+
logMetric = async (namespace, metricData) => {
|
|
24
|
+
await this.ensureInit();
|
|
25
|
+
const { PutMetricDataCommand } = await import("@aws-sdk/client-cloudwatch");
|
|
26
|
+
const data = require_array_array.getArray(metricData);
|
|
27
|
+
return await this.client.send(new PutMetricDataCommand({
|
|
28
|
+
Namespace: namespace,
|
|
29
|
+
MetricData: data.map((metric) => ({
|
|
30
|
+
MetricName: metric.metricName,
|
|
31
|
+
Value: metric.value,
|
|
32
|
+
Unit: metric?.unit || _aws_sdk_client_cloudwatch.StandardUnit.Count,
|
|
33
|
+
Timestamp: require_date_calculation.getLuxonDate(metric.timestamp).toJSDate(),
|
|
34
|
+
Dimensions: metric.dimensions?.map((dimension) => ({
|
|
35
|
+
Name: dimension.name,
|
|
36
|
+
Value: dimension.value
|
|
35
37
|
}))
|
|
36
|
-
}))
|
|
37
|
-
};
|
|
38
|
-
}
|
|
38
|
+
}))
|
|
39
|
+
}));
|
|
40
|
+
};
|
|
39
41
|
};
|
|
40
42
|
//#endregion
|
|
41
43
|
exports.AwsCloudWatchMetricNamespace = AwsCloudWatchMetricNamespace;
|
|
@@ -5,35 +5,37 @@ import "../../../date/index.mjs";
|
|
|
5
5
|
import { StandardUnit } from "@aws-sdk/client-cloudwatch";
|
|
6
6
|
//#region src/aws/cloudWatchMetric/server/AwsCloudWatchMetricNamespace.ts
|
|
7
7
|
var AwsCloudWatchMetricNamespace = class extends BaseNamespace {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
8
|
+
ensureInit = async () => {
|
|
9
|
+
if (!this.client) try {
|
|
10
|
+
const { CloudWatchClient } = await import("@aws-sdk/client-cloudwatch");
|
|
11
|
+
this.client = new CloudWatchClient(this.config);
|
|
12
|
+
} catch (e) {
|
|
13
|
+
throw new Error("AWS CloudWatch Client not installed");
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Publishes metric data to CloudWatch.
|
|
18
|
+
* The namespace is created automatically.
|
|
19
|
+
* Dimensions should contain additional info (but top level).
|
|
20
|
+
*/
|
|
21
|
+
logMetric = async (namespace, metricData) => {
|
|
22
|
+
await this.ensureInit();
|
|
23
|
+
const { PutMetricDataCommand } = await import("@aws-sdk/client-cloudwatch");
|
|
24
|
+
const data = getArray(metricData);
|
|
25
|
+
return await this.client.send(new PutMetricDataCommand({
|
|
26
|
+
Namespace: namespace,
|
|
27
|
+
MetricData: data.map((metric) => ({
|
|
28
|
+
MetricName: metric.metricName,
|
|
29
|
+
Value: metric.value,
|
|
30
|
+
Unit: metric?.unit || StandardUnit.Count,
|
|
31
|
+
Timestamp: getLuxonDate(metric.timestamp).toJSDate(),
|
|
32
|
+
Dimensions: metric.dimensions?.map((dimension) => ({
|
|
33
|
+
Name: dimension.name,
|
|
34
|
+
Value: dimension.value
|
|
33
35
|
}))
|
|
34
|
-
}))
|
|
35
|
-
};
|
|
36
|
-
}
|
|
36
|
+
}))
|
|
37
|
+
}));
|
|
38
|
+
};
|
|
37
39
|
};
|
|
38
40
|
//#endregion
|
|
39
41
|
export { AwsCloudWatchMetricNamespace };
|
|
@@ -2,38 +2,35 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require__class_BaseNamespace = require("../../../_class/BaseNamespace.cjs");
|
|
3
3
|
//#region src/aws/ec2/server/AwsEc2Namespace.ts
|
|
4
4
|
var AwsEc2Namespace = class extends require__class_BaseNamespace.BaseNamespace {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return await this.client.send(command);
|
|
35
|
-
};
|
|
36
|
-
}
|
|
5
|
+
ensureInit = async () => {
|
|
6
|
+
if (!this.client) try {
|
|
7
|
+
const { EC2Client } = await import("@aws-sdk/client-ec2");
|
|
8
|
+
this.client = new EC2Client(this.config);
|
|
9
|
+
} catch (e) {
|
|
10
|
+
throw new Error("AWS EC2 Client not installed");
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
startInstances = async (instanceIds, additionalInfo, dryRun) => {
|
|
14
|
+
await this.ensureInit();
|
|
15
|
+
const { StartInstancesCommand } = await import("@aws-sdk/client-ec2");
|
|
16
|
+
const command = new StartInstancesCommand({
|
|
17
|
+
InstanceIds: instanceIds,
|
|
18
|
+
AdditionalInfo: additionalInfo,
|
|
19
|
+
DryRun: dryRun
|
|
20
|
+
});
|
|
21
|
+
return await this.client.send(command);
|
|
22
|
+
};
|
|
23
|
+
stopInstances = async (instanceIds, hibernate, force, dryRun) => {
|
|
24
|
+
await this.ensureInit();
|
|
25
|
+
const { StopInstancesCommand } = await import("@aws-sdk/client-ec2");
|
|
26
|
+
const command = new StopInstancesCommand({
|
|
27
|
+
InstanceIds: instanceIds,
|
|
28
|
+
Hibernate: hibernate,
|
|
29
|
+
DryRun: dryRun,
|
|
30
|
+
Force: force
|
|
31
|
+
});
|
|
32
|
+
return await this.client.send(command);
|
|
33
|
+
};
|
|
37
34
|
};
|
|
38
35
|
//#endregion
|
|
39
36
|
exports.AwsEc2Namespace = AwsEc2Namespace;
|
|
@@ -1,38 +1,35 @@
|
|
|
1
1
|
import { BaseNamespace } from "../../../_class/BaseNamespace.mjs";
|
|
2
2
|
//#region src/aws/ec2/server/AwsEc2Namespace.ts
|
|
3
3
|
var AwsEc2Namespace = class extends BaseNamespace {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return await this.client.send(command);
|
|
34
|
-
};
|
|
35
|
-
}
|
|
4
|
+
ensureInit = async () => {
|
|
5
|
+
if (!this.client) try {
|
|
6
|
+
const { EC2Client } = await import("@aws-sdk/client-ec2");
|
|
7
|
+
this.client = new EC2Client(this.config);
|
|
8
|
+
} catch (e) {
|
|
9
|
+
throw new Error("AWS EC2 Client not installed");
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
startInstances = async (instanceIds, additionalInfo, dryRun) => {
|
|
13
|
+
await this.ensureInit();
|
|
14
|
+
const { StartInstancesCommand } = await import("@aws-sdk/client-ec2");
|
|
15
|
+
const command = new StartInstancesCommand({
|
|
16
|
+
InstanceIds: instanceIds,
|
|
17
|
+
AdditionalInfo: additionalInfo,
|
|
18
|
+
DryRun: dryRun
|
|
19
|
+
});
|
|
20
|
+
return await this.client.send(command);
|
|
21
|
+
};
|
|
22
|
+
stopInstances = async (instanceIds, hibernate, force, dryRun) => {
|
|
23
|
+
await this.ensureInit();
|
|
24
|
+
const { StopInstancesCommand } = await import("@aws-sdk/client-ec2");
|
|
25
|
+
const command = new StopInstancesCommand({
|
|
26
|
+
InstanceIds: instanceIds,
|
|
27
|
+
Hibernate: hibernate,
|
|
28
|
+
DryRun: dryRun,
|
|
29
|
+
Force: force
|
|
30
|
+
});
|
|
31
|
+
return await this.client.send(command);
|
|
32
|
+
};
|
|
36
33
|
};
|
|
37
34
|
//#endregion
|
|
38
35
|
export { AwsEc2Namespace };
|