@aws-sdk/ec2-metadata-service 3.1045.0 → 3.1047.0
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-cjs/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var config = require('@smithy/core/config');
|
|
4
|
+
var protocols = require('@smithy/core/protocols');
|
|
5
|
+
var serde = require('@smithy/core/serde');
|
|
4
6
|
var nodeHttpHandler = require('@smithy/node-http-handler');
|
|
5
|
-
var protocolHttp = require('@smithy/protocol-http');
|
|
6
|
-
var utilStream = require('@smithy/util-stream');
|
|
7
7
|
|
|
8
8
|
var Endpoint;
|
|
9
9
|
(function (Endpoint) {
|
|
@@ -48,11 +48,11 @@ class MetadataService {
|
|
|
48
48
|
this.config = (async () => {
|
|
49
49
|
const profile = options?.profile || process.env.AWS_PROFILE;
|
|
50
50
|
return {
|
|
51
|
-
endpoint: options.endpoint ?? (await
|
|
51
|
+
endpoint: options.endpoint ?? (await config.loadConfig(ENDPOINT_SELECTORS, { profile })()),
|
|
52
52
|
httpOptions: {
|
|
53
53
|
timeout: options?.httpOptions?.timeout || 0,
|
|
54
54
|
},
|
|
55
|
-
ec2MetadataV1Disabled: options?.ec2MetadataV1Disabled ?? (await
|
|
55
|
+
ec2MetadataV1Disabled: options?.ec2MetadataV1Disabled ?? (await config.loadConfig(IMDSv1_DISABLED_SELECTORS, { profile })()),
|
|
56
56
|
};
|
|
57
57
|
})();
|
|
58
58
|
this.disableFetchToken = options?.disableFetchToken || false;
|
|
@@ -140,7 +140,7 @@ class MetadataService {
|
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
-
const request = new
|
|
143
|
+
const request = new protocols.HttpRequest({
|
|
144
144
|
method: options.method || "GET",
|
|
145
145
|
headers: headers,
|
|
146
146
|
hostname: endpointUrl.hostname,
|
|
@@ -151,7 +151,7 @@ class MetadataService {
|
|
|
151
151
|
try {
|
|
152
152
|
const { response } = await handler.handle(request, {});
|
|
153
153
|
if (response.statusCode === 200 && response.body) {
|
|
154
|
-
return
|
|
154
|
+
return serde.sdkStreamMixin(response.body).transformToString();
|
|
155
155
|
}
|
|
156
156
|
else {
|
|
157
157
|
throw Object.assign(new Error(`Request failed with status code ${response.statusCode}`), {
|
|
@@ -180,7 +180,7 @@ class MetadataService {
|
|
|
180
180
|
connectionTimeout: httpOptions?.timeout,
|
|
181
181
|
});
|
|
182
182
|
const endpointUrl = new URL(endpoint);
|
|
183
|
-
const tokenRequest = new
|
|
183
|
+
const tokenRequest = new protocols.HttpRequest({
|
|
184
184
|
method: "PUT",
|
|
185
185
|
headers: {
|
|
186
186
|
"x-aws-ec2-metadata-token-ttl-seconds": String(this.tokenTtl),
|
|
@@ -194,7 +194,7 @@ class MetadataService {
|
|
|
194
194
|
const { response } = await handler.handle(tokenRequest, {});
|
|
195
195
|
let bodyString = "";
|
|
196
196
|
if (response.body) {
|
|
197
|
-
bodyString = await
|
|
197
|
+
bodyString = await serde.sdkStreamMixin(response.body).transformToString();
|
|
198
198
|
}
|
|
199
199
|
if (response.statusCode === 200 && bodyString) {
|
|
200
200
|
return bodyString;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { loadConfig } from "@smithy/
|
|
1
|
+
import { loadConfig } from "@smithy/core/config";
|
|
2
|
+
import { HttpRequest } from "@smithy/core/protocols";
|
|
3
|
+
import { sdkStreamMixin } from "@smithy/core/serde";
|
|
2
4
|
import { NodeHttpHandler } from "@smithy/node-http-handler";
|
|
3
|
-
import { HttpRequest } from "@smithy/protocol-http";
|
|
4
|
-
import { sdkStreamMixin } from "@smithy/util-stream";
|
|
5
5
|
import { ENDPOINT_SELECTORS, IMDSv1_DISABLED_SELECTORS } from "./ConfigLoaders";
|
|
6
6
|
export class MetadataService {
|
|
7
7
|
disableFetchToken;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LoadedConfigSelectors } from "@smithy/
|
|
1
|
+
import { LoadedConfigSelectors } from "@smithy/core/config";
|
|
2
2
|
export declare const ENV_ENDPOINT_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT";
|
|
3
3
|
export declare const CONFIG_ENDPOINT_NAME = "ec2_metadata_service_endpoint";
|
|
4
4
|
export declare const ENDPOINT_SELECTORS: LoadedConfigSelectors<
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/ec2-metadata-service",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1047.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
6
6
|
"build:cjs": "node ../../scripts/compilation/inline ec2-metadata-service",
|
|
@@ -25,15 +25,13 @@
|
|
|
25
25
|
"types": "./dist-types/index.d.ts",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@aws-sdk/types": "^3.973.8",
|
|
28
|
-
"@smithy/
|
|
29
|
-
"@smithy/node-http-handler": "^4.
|
|
30
|
-
"@smithy/protocol-http": "^5.3.14",
|
|
28
|
+
"@smithy/core": "^3.24.1",
|
|
29
|
+
"@smithy/node-http-handler": "^4.7.1",
|
|
31
30
|
"@smithy/types": "^4.14.1",
|
|
32
|
-
"@smithy/util-stream": "^4.5.25",
|
|
33
31
|
"tslib": "^2.6.2"
|
|
34
32
|
},
|
|
35
33
|
"devDependencies": {
|
|
36
|
-
"@aws-sdk/credential-providers": "3.
|
|
34
|
+
"@aws-sdk/credential-providers": "3.1047.0",
|
|
37
35
|
"@tsconfig/recommended": "1.0.1",
|
|
38
36
|
"@types/node": "^20.14.8",
|
|
39
37
|
"concurrently": "7.0.0",
|