@aws-sdk/client-bedrock 3.1068.0 → 3.1069.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/auth/httpAuthSchemeProvider.js +11 -17
- package/dist-cjs/endpoint/bdd.js +2 -5
- package/dist-cjs/endpoint/endpointResolver.js +7 -11
- package/dist-cjs/index.js +383 -403
- package/dist-cjs/models/BedrockServiceException.js +4 -8
- package/dist-cjs/models/errors.js +21 -34
- package/dist-cjs/runtimeConfig.browser.js +22 -26
- package/dist-cjs/runtimeConfig.js +36 -40
- package/dist-cjs/runtimeConfig.native.js +4 -7
- package/dist-cjs/runtimeConfig.shared.js +22 -26
- package/dist-cjs/schemas/schemas_0.js +1304 -835
- package/package.json +9 -9
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.BedrockServiceException =
|
|
4
|
-
const client_1 = require("@smithy/core/client");
|
|
5
|
-
Object.defineProperty(exports, "__ServiceException", { enumerable: true, get: function () { return client_1.ServiceException; } });
|
|
6
|
-
class BedrockServiceException extends client_1.ServiceException {
|
|
1
|
+
const { ServiceException: __ServiceException } = require("@smithy/core/client");
|
|
2
|
+
exports.__ServiceException = __ServiceException;
|
|
3
|
+
exports.BedrockServiceException = class BedrockServiceException extends __ServiceException {
|
|
7
4
|
constructor(options) {
|
|
8
5
|
super(options);
|
|
9
6
|
Object.setPrototypeOf(this, BedrockServiceException.prototype);
|
|
10
7
|
}
|
|
11
|
-
}
|
|
12
|
-
exports.BedrockServiceException = BedrockServiceException;
|
|
8
|
+
};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ServiceUnavailableException = exports.ResourceInUseException = exports.TooManyTagsException = exports.ServiceQuotaExceededException = exports.ResourceNotFoundException = exports.ConflictException = exports.ValidationException = exports.ThrottlingException = exports.InternalServerException = exports.AccessDeniedException = void 0;
|
|
4
|
-
const BedrockServiceException_1 = require("./BedrockServiceException");
|
|
5
|
-
class AccessDeniedException extends BedrockServiceException_1.BedrockServiceException {
|
|
1
|
+
const { BedrockServiceException: __BaseException } = require("./BedrockServiceException");
|
|
2
|
+
exports.AccessDeniedException = class AccessDeniedException extends __BaseException {
|
|
6
3
|
name = "AccessDeniedException";
|
|
7
4
|
$fault = "client";
|
|
8
5
|
constructor(opts) {
|
|
@@ -13,9 +10,8 @@ class AccessDeniedException extends BedrockServiceException_1.BedrockServiceExce
|
|
|
13
10
|
});
|
|
14
11
|
Object.setPrototypeOf(this, AccessDeniedException.prototype);
|
|
15
12
|
}
|
|
16
|
-
}
|
|
17
|
-
exports.
|
|
18
|
-
class InternalServerException extends BedrockServiceException_1.BedrockServiceException {
|
|
13
|
+
};
|
|
14
|
+
exports.InternalServerException = class InternalServerException extends __BaseException {
|
|
19
15
|
name = "InternalServerException";
|
|
20
16
|
$fault = "server";
|
|
21
17
|
constructor(opts) {
|
|
@@ -26,9 +22,8 @@ class InternalServerException extends BedrockServiceException_1.BedrockServiceEx
|
|
|
26
22
|
});
|
|
27
23
|
Object.setPrototypeOf(this, InternalServerException.prototype);
|
|
28
24
|
}
|
|
29
|
-
}
|
|
30
|
-
exports.
|
|
31
|
-
class ThrottlingException extends BedrockServiceException_1.BedrockServiceException {
|
|
25
|
+
};
|
|
26
|
+
exports.ThrottlingException = class ThrottlingException extends __BaseException {
|
|
32
27
|
name = "ThrottlingException";
|
|
33
28
|
$fault = "client";
|
|
34
29
|
constructor(opts) {
|
|
@@ -39,9 +34,8 @@ class ThrottlingException extends BedrockServiceException_1.BedrockServiceExcept
|
|
|
39
34
|
});
|
|
40
35
|
Object.setPrototypeOf(this, ThrottlingException.prototype);
|
|
41
36
|
}
|
|
42
|
-
}
|
|
43
|
-
exports.
|
|
44
|
-
class ValidationException extends BedrockServiceException_1.BedrockServiceException {
|
|
37
|
+
};
|
|
38
|
+
exports.ValidationException = class ValidationException extends __BaseException {
|
|
45
39
|
name = "ValidationException";
|
|
46
40
|
$fault = "client";
|
|
47
41
|
constructor(opts) {
|
|
@@ -52,9 +46,8 @@ class ValidationException extends BedrockServiceException_1.BedrockServiceExcept
|
|
|
52
46
|
});
|
|
53
47
|
Object.setPrototypeOf(this, ValidationException.prototype);
|
|
54
48
|
}
|
|
55
|
-
}
|
|
56
|
-
exports.
|
|
57
|
-
class ConflictException extends BedrockServiceException_1.BedrockServiceException {
|
|
49
|
+
};
|
|
50
|
+
exports.ConflictException = class ConflictException extends __BaseException {
|
|
58
51
|
name = "ConflictException";
|
|
59
52
|
$fault = "client";
|
|
60
53
|
constructor(opts) {
|
|
@@ -65,9 +58,8 @@ class ConflictException extends BedrockServiceException_1.BedrockServiceExceptio
|
|
|
65
58
|
});
|
|
66
59
|
Object.setPrototypeOf(this, ConflictException.prototype);
|
|
67
60
|
}
|
|
68
|
-
}
|
|
69
|
-
exports.
|
|
70
|
-
class ResourceNotFoundException extends BedrockServiceException_1.BedrockServiceException {
|
|
61
|
+
};
|
|
62
|
+
exports.ResourceNotFoundException = class ResourceNotFoundException extends __BaseException {
|
|
71
63
|
name = "ResourceNotFoundException";
|
|
72
64
|
$fault = "client";
|
|
73
65
|
constructor(opts) {
|
|
@@ -78,9 +70,8 @@ class ResourceNotFoundException extends BedrockServiceException_1.BedrockService
|
|
|
78
70
|
});
|
|
79
71
|
Object.setPrototypeOf(this, ResourceNotFoundException.prototype);
|
|
80
72
|
}
|
|
81
|
-
}
|
|
82
|
-
exports.
|
|
83
|
-
class ServiceQuotaExceededException extends BedrockServiceException_1.BedrockServiceException {
|
|
73
|
+
};
|
|
74
|
+
exports.ServiceQuotaExceededException = class ServiceQuotaExceededException extends __BaseException {
|
|
84
75
|
name = "ServiceQuotaExceededException";
|
|
85
76
|
$fault = "client";
|
|
86
77
|
constructor(opts) {
|
|
@@ -91,9 +82,8 @@ class ServiceQuotaExceededException extends BedrockServiceException_1.BedrockSer
|
|
|
91
82
|
});
|
|
92
83
|
Object.setPrototypeOf(this, ServiceQuotaExceededException.prototype);
|
|
93
84
|
}
|
|
94
|
-
}
|
|
95
|
-
exports.
|
|
96
|
-
class TooManyTagsException extends BedrockServiceException_1.BedrockServiceException {
|
|
85
|
+
};
|
|
86
|
+
exports.TooManyTagsException = class TooManyTagsException extends __BaseException {
|
|
97
87
|
name = "TooManyTagsException";
|
|
98
88
|
$fault = "client";
|
|
99
89
|
resourceName;
|
|
@@ -106,9 +96,8 @@ class TooManyTagsException extends BedrockServiceException_1.BedrockServiceExcep
|
|
|
106
96
|
Object.setPrototypeOf(this, TooManyTagsException.prototype);
|
|
107
97
|
this.resourceName = opts.resourceName;
|
|
108
98
|
}
|
|
109
|
-
}
|
|
110
|
-
exports.
|
|
111
|
-
class ResourceInUseException extends BedrockServiceException_1.BedrockServiceException {
|
|
99
|
+
};
|
|
100
|
+
exports.ResourceInUseException = class ResourceInUseException extends __BaseException {
|
|
112
101
|
name = "ResourceInUseException";
|
|
113
102
|
$fault = "client";
|
|
114
103
|
constructor(opts) {
|
|
@@ -119,9 +108,8 @@ class ResourceInUseException extends BedrockServiceException_1.BedrockServiceExc
|
|
|
119
108
|
});
|
|
120
109
|
Object.setPrototypeOf(this, ResourceInUseException.prototype);
|
|
121
110
|
}
|
|
122
|
-
}
|
|
123
|
-
exports.
|
|
124
|
-
class ServiceUnavailableException extends BedrockServiceException_1.BedrockServiceException {
|
|
111
|
+
};
|
|
112
|
+
exports.ServiceUnavailableException = class ServiceUnavailableException extends __BaseException {
|
|
125
113
|
name = "ServiceUnavailableException";
|
|
126
114
|
$fault = "server";
|
|
127
115
|
constructor(opts) {
|
|
@@ -132,5 +120,4 @@ class ServiceUnavailableException extends BedrockServiceException_1.BedrockServi
|
|
|
132
120
|
});
|
|
133
121
|
Object.setPrototypeOf(this, ServiceUnavailableException.prototype);
|
|
134
122
|
}
|
|
135
|
-
}
|
|
136
|
-
exports.ServiceUnavailableException = ServiceUnavailableException;
|
|
123
|
+
};
|
|
@@ -1,36 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const retry_1 = require("@smithy/core/retry");
|
|
11
|
-
const serde_1 = require("@smithy/core/serde");
|
|
12
|
-
const fetch_http_handler_1 = require("@smithy/fetch-http-handler");
|
|
13
|
-
const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
|
|
1
|
+
const packageInfo = require("../package.json");
|
|
2
|
+
const { Sha256 } = require("@aws-crypto/sha256-browser");
|
|
3
|
+
const { createDefaultUserAgentProvider } = require("@aws-sdk/core/client");
|
|
4
|
+
const { invalidProvider, loadConfigsForDefaultMode } = require("@smithy/core/client");
|
|
5
|
+
const { DEFAULT_USE_DUALSTACK_ENDPOINT, DEFAULT_USE_FIPS_ENDPOINT, resolveDefaultsModeConfig } = require("@smithy/core/config");
|
|
6
|
+
const { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } = require("@smithy/core/retry");
|
|
7
|
+
const { calculateBodyLength } = require("@smithy/core/serde");
|
|
8
|
+
const { FetchHttpHandler: RequestHandler, streamCollector } = require("@smithy/fetch-http-handler");
|
|
9
|
+
const { getRuntimeConfig: getSharedRuntimeConfig } = require("./runtimeConfig.shared");
|
|
14
10
|
const getRuntimeConfig = (config) => {
|
|
15
|
-
const defaultsMode =
|
|
16
|
-
const defaultConfigProvider = () => defaultsMode().then(
|
|
17
|
-
const clientSharedValues = (
|
|
11
|
+
const defaultsMode = resolveDefaultsModeConfig(config);
|
|
12
|
+
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
|
|
13
|
+
const clientSharedValues = getSharedRuntimeConfig(config);
|
|
18
14
|
return {
|
|
19
15
|
...clientSharedValues,
|
|
20
16
|
...config,
|
|
21
17
|
runtime: "browser",
|
|
22
18
|
defaultsMode,
|
|
23
|
-
bodyLengthChecker: config?.bodyLengthChecker ??
|
|
19
|
+
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
|
24
20
|
credentialDefaultProvider: config?.credentialDefaultProvider ?? ((_) => () => Promise.reject(new Error("Credential is missing"))),
|
|
25
|
-
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
|
26
|
-
maxAttempts: config?.maxAttempts ??
|
|
27
|
-
region: config?.region ??
|
|
28
|
-
requestHandler:
|
|
29
|
-
retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode ||
|
|
30
|
-
sha256: config?.sha256 ??
|
|
31
|
-
streamCollector: config?.streamCollector ??
|
|
32
|
-
useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(
|
|
33
|
-
useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(
|
|
21
|
+
defaultUserAgentProvider: config?.defaultUserAgentProvider ?? createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
22
|
+
maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
|
|
23
|
+
region: config?.region ?? invalidProvider("Region is missing"),
|
|
24
|
+
requestHandler: RequestHandler.create(config?.requestHandler ?? defaultConfigProvider),
|
|
25
|
+
retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE),
|
|
26
|
+
sha256: config?.sha256 ?? Sha256,
|
|
27
|
+
streamCollector: config?.streamCollector ?? streamCollector,
|
|
28
|
+
useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)),
|
|
29
|
+
useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT)),
|
|
34
30
|
};
|
|
35
31
|
};
|
|
36
32
|
exports.getRuntimeConfig = getRuntimeConfig;
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const retry_1 = require("@smithy/core/retry");
|
|
14
|
-
const serde_1 = require("@smithy/core/serde");
|
|
15
|
-
const node_http_handler_1 = require("@smithy/node-http-handler");
|
|
16
|
-
const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
|
|
1
|
+
const packageInfo = require("../package.json");
|
|
2
|
+
const { createDefaultUserAgentProvider, emitWarningIfUnsupportedVersion: awsCheckVersion, NODE_APP_ID_CONFIG_OPTIONS } = require("@aws-sdk/core/client");
|
|
3
|
+
const { AwsSdkSigV4Signer, NODE_AUTH_SCHEME_PREFERENCE_OPTIONS } = require("@aws-sdk/core/httpAuthSchemes");
|
|
4
|
+
const { defaultProvider: credentialDefaultProvider } = require("@aws-sdk/credential-provider-node");
|
|
5
|
+
const { fromEnvSigningName, nodeProvider } = require("@aws-sdk/token-providers");
|
|
6
|
+
const { HttpBearerAuthSigner } = require("@smithy/core");
|
|
7
|
+
const { emitWarningIfUnsupportedVersion, loadConfigsForDefaultMode } = require("@smithy/core/client");
|
|
8
|
+
const { loadConfig: loadNodeConfig, NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS, NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, resolveDefaultsModeConfig } = require("@smithy/core/config");
|
|
9
|
+
const { DEFAULT_RETRY_MODE, NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } = require("@smithy/core/retry");
|
|
10
|
+
const { calculateBodyLength, Hash } = require("@smithy/core/serde");
|
|
11
|
+
const { NodeHttpHandler: RequestHandler, streamCollector } = require("@smithy/node-http-handler");
|
|
12
|
+
const { getRuntimeConfig: getSharedRuntimeConfig } = require("./runtimeConfig.shared");
|
|
17
13
|
const getRuntimeConfig = (config) => {
|
|
18
|
-
|
|
19
|
-
const defaultsMode =
|
|
20
|
-
const defaultConfigProvider = () => defaultsMode().then(
|
|
21
|
-
const clientSharedValues = (
|
|
22
|
-
(
|
|
14
|
+
emitWarningIfUnsupportedVersion(process.version);
|
|
15
|
+
const defaultsMode = resolveDefaultsModeConfig(config);
|
|
16
|
+
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
|
|
17
|
+
const clientSharedValues = getSharedRuntimeConfig(config);
|
|
18
|
+
awsCheckVersion(process.version);
|
|
23
19
|
const loaderConfig = {
|
|
24
20
|
profile: config?.profile,
|
|
25
21
|
logger: clientSharedValues.logger,
|
|
@@ -30,42 +26,42 @@ const getRuntimeConfig = (config) => {
|
|
|
30
26
|
...config,
|
|
31
27
|
runtime: "node",
|
|
32
28
|
defaultsMode,
|
|
33
|
-
authSchemePreference: config?.authSchemePreference ?? (
|
|
34
|
-
bodyLengthChecker: config?.bodyLengthChecker ??
|
|
35
|
-
credentialDefaultProvider: config?.credentialDefaultProvider ??
|
|
36
|
-
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
|
29
|
+
authSchemePreference: config?.authSchemePreference ?? loadNodeConfig(NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
|
|
30
|
+
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
|
31
|
+
credentialDefaultProvider: config?.credentialDefaultProvider ?? credentialDefaultProvider,
|
|
32
|
+
defaultUserAgentProvider: config?.defaultUserAgentProvider ?? createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
37
33
|
httpAuthSchemes: config?.httpAuthSchemes ?? [
|
|
38
34
|
{
|
|
39
35
|
schemeId: "aws.auth#sigv4",
|
|
40
36
|
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
|
|
41
|
-
signer: new
|
|
37
|
+
signer: new AwsSdkSigV4Signer(),
|
|
42
38
|
},
|
|
43
39
|
{
|
|
44
40
|
schemeId: "smithy.api#httpBearerAuth",
|
|
45
41
|
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#httpBearerAuth") || (async (idProps) => {
|
|
46
42
|
try {
|
|
47
|
-
return await
|
|
43
|
+
return await fromEnvSigningName({ signingName: "bedrock" })();
|
|
48
44
|
}
|
|
49
45
|
catch (error) {
|
|
50
|
-
return await
|
|
46
|
+
return await nodeProvider(idProps)(idProps);
|
|
51
47
|
}
|
|
52
48
|
}),
|
|
53
|
-
signer: new
|
|
49
|
+
signer: new HttpBearerAuthSigner(),
|
|
54
50
|
},
|
|
55
51
|
],
|
|
56
|
-
maxAttempts: config?.maxAttempts ?? (
|
|
57
|
-
region: config?.region ?? (
|
|
58
|
-
requestHandler:
|
|
52
|
+
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
|
|
53
|
+
region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, { ...NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
|
|
54
|
+
requestHandler: RequestHandler.create(config?.requestHandler ?? defaultConfigProvider),
|
|
59
55
|
retryMode: config?.retryMode ??
|
|
60
|
-
(
|
|
61
|
-
...
|
|
62
|
-
default: async () => (await defaultConfigProvider()).retryMode ||
|
|
56
|
+
loadNodeConfig({
|
|
57
|
+
...NODE_RETRY_MODE_CONFIG_OPTIONS,
|
|
58
|
+
default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
|
|
63
59
|
}, config),
|
|
64
|
-
sha256: config?.sha256 ??
|
|
65
|
-
streamCollector: config?.streamCollector ??
|
|
66
|
-
useDualstackEndpoint: config?.useDualstackEndpoint ?? (
|
|
67
|
-
useFipsEndpoint: config?.useFipsEndpoint ?? (
|
|
68
|
-
userAgentAppId: config?.userAgentAppId ?? (
|
|
60
|
+
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
|
|
61
|
+
streamCollector: config?.streamCollector ?? streamCollector,
|
|
62
|
+
useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
|
63
|
+
useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
|
64
|
+
userAgentAppId: config?.userAgentAppId ?? loadNodeConfig(NODE_APP_ID_CONFIG_OPTIONS, loaderConfig),
|
|
69
65
|
};
|
|
70
66
|
};
|
|
71
67
|
exports.getRuntimeConfig = getRuntimeConfig;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.getRuntimeConfig = void 0;
|
|
4
|
-
const sha256_js_1 = require("@aws-crypto/sha256-js");
|
|
5
|
-
const runtimeConfig_browser_1 = require("./runtimeConfig.browser");
|
|
1
|
+
const { Sha256 } = require("@aws-crypto/sha256-js");
|
|
2
|
+
const { getRuntimeConfig: getBrowserRuntimeConfig } = require("./runtimeConfig.browser");
|
|
6
3
|
const getRuntimeConfig = (config) => {
|
|
7
|
-
const browserDefaults = (
|
|
4
|
+
const browserDefaults = getBrowserRuntimeConfig(config);
|
|
8
5
|
return {
|
|
9
6
|
...browserDefaults,
|
|
10
7
|
...config,
|
|
11
8
|
runtime: "react-native",
|
|
12
|
-
sha256: config?.sha256 ??
|
|
9
|
+
sha256: config?.sha256 ?? Sha256,
|
|
13
10
|
};
|
|
14
11
|
};
|
|
15
12
|
exports.getRuntimeConfig = getRuntimeConfig;
|
|
@@ -1,48 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const endpointResolver_1 = require("./endpoint/endpointResolver");
|
|
12
|
-
const schemas_0_1 = require("./schemas/schemas_0");
|
|
13
|
-
const getRuntimeConfig = (config) => {
|
|
1
|
+
const { AwsSdkSigV4Signer } = require("@aws-sdk/core/httpAuthSchemes");
|
|
2
|
+
const { AwsRestJsonProtocol } = require("@aws-sdk/core/protocols");
|
|
3
|
+
const { HttpBearerAuthSigner } = require("@smithy/core");
|
|
4
|
+
const { NoOpLogger } = require("@smithy/core/client");
|
|
5
|
+
const { parseUrl } = require("@smithy/core/protocols");
|
|
6
|
+
const { fromBase64, fromUtf8, toBase64, toUtf8 } = require("@smithy/core/serde");
|
|
7
|
+
const { defaultBedrockHttpAuthSchemeProvider } = require("./auth/httpAuthSchemeProvider");
|
|
8
|
+
const { defaultEndpointResolver } = require("./endpoint/endpointResolver");
|
|
9
|
+
const { errorTypeRegistries } = require("./schemas/schemas_0");
|
|
10
|
+
exports.getRuntimeConfig = (config) => {
|
|
14
11
|
return {
|
|
15
12
|
apiVersion: "2023-04-20",
|
|
16
|
-
base64Decoder: config?.base64Decoder ??
|
|
17
|
-
base64Encoder: config?.base64Encoder ??
|
|
13
|
+
base64Decoder: config?.base64Decoder ?? fromBase64,
|
|
14
|
+
base64Encoder: config?.base64Encoder ?? toBase64,
|
|
18
15
|
disableHostPrefix: config?.disableHostPrefix ?? false,
|
|
19
|
-
endpointProvider: config?.endpointProvider ??
|
|
16
|
+
endpointProvider: config?.endpointProvider ?? defaultEndpointResolver,
|
|
20
17
|
extensions: config?.extensions ?? [],
|
|
21
|
-
httpAuthSchemeProvider: config?.httpAuthSchemeProvider ??
|
|
18
|
+
httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultBedrockHttpAuthSchemeProvider,
|
|
22
19
|
httpAuthSchemes: config?.httpAuthSchemes ?? [
|
|
23
20
|
{
|
|
24
21
|
schemeId: "aws.auth#sigv4",
|
|
25
22
|
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
|
|
26
|
-
signer: new
|
|
23
|
+
signer: new AwsSdkSigV4Signer(),
|
|
27
24
|
},
|
|
28
25
|
{
|
|
29
26
|
schemeId: "smithy.api#httpBearerAuth",
|
|
30
27
|
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#httpBearerAuth"),
|
|
31
|
-
signer: new
|
|
28
|
+
signer: new HttpBearerAuthSigner(),
|
|
32
29
|
},
|
|
33
30
|
],
|
|
34
|
-
logger: config?.logger ?? new
|
|
35
|
-
protocol: config?.protocol ??
|
|
31
|
+
logger: config?.logger ?? new NoOpLogger(),
|
|
32
|
+
protocol: config?.protocol ?? AwsRestJsonProtocol,
|
|
36
33
|
protocolSettings: config?.protocolSettings ?? {
|
|
37
34
|
defaultNamespace: "com.amazonaws.bedrock",
|
|
38
|
-
errorTypeRegistries
|
|
35
|
+
errorTypeRegistries,
|
|
39
36
|
version: "2023-04-20",
|
|
40
37
|
serviceTarget: "AmazonBedrockControlPlaneService",
|
|
41
38
|
},
|
|
42
39
|
serviceId: config?.serviceId ?? "Bedrock",
|
|
43
|
-
urlParser: config?.urlParser ??
|
|
44
|
-
utf8Decoder: config?.utf8Decoder ??
|
|
45
|
-
utf8Encoder: config?.utf8Encoder ??
|
|
40
|
+
urlParser: config?.urlParser ?? parseUrl,
|
|
41
|
+
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
|
|
42
|
+
utf8Encoder: config?.utf8Encoder ?? toUtf8,
|
|
46
43
|
};
|
|
47
44
|
};
|
|
48
|
-
exports.getRuntimeConfig = getRuntimeConfig;
|