@aws-sdk/client-sagemaker-metrics 3.229.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/LICENSE +201 -0
- package/README.md +213 -0
- package/dist-cjs/SageMakerMetrics.js +22 -0
- package/dist-cjs/SageMakerMetricsClient.js +40 -0
- package/dist-cjs/commands/BatchPutMetricsCommand.js +46 -0
- package/dist-cjs/commands/index.js +4 -0
- package/dist-cjs/endpoint/EndpointParameters.js +12 -0
- package/dist-cjs/endpoint/endpointResolver.js +12 -0
- package/dist-cjs/endpoint/ruleset.js +303 -0
- package/dist-cjs/index.js +10 -0
- package/dist-cjs/models/SageMakerMetricsServiceException.js +11 -0
- package/dist-cjs/models/index.js +4 -0
- package/dist-cjs/models/models_0.js +26 -0
- package/dist-cjs/protocols/Aws_restJson1.js +147 -0
- package/dist-cjs/runtimeConfig.browser.js +42 -0
- package/dist-cjs/runtimeConfig.js +51 -0
- package/dist-cjs/runtimeConfig.native.js +15 -0
- package/dist-cjs/runtimeConfig.shared.js +18 -0
- package/dist-es/SageMakerMetrics.js +18 -0
- package/dist-es/SageMakerMetricsClient.js +36 -0
- package/dist-es/commands/BatchPutMetricsCommand.js +42 -0
- package/dist-es/commands/index.js +1 -0
- package/dist-es/endpoint/EndpointParameters.js +8 -0
- package/dist-es/endpoint/endpointResolver.js +8 -0
- package/dist-es/endpoint/ruleset.js +300 -0
- package/dist-es/index.js +5 -0
- package/dist-es/models/SageMakerMetricsServiceException.js +7 -0
- package/dist-es/models/index.js +1 -0
- package/dist-es/models/models_0.js +19 -0
- package/dist-es/protocols/Aws_restJson1.js +142 -0
- package/dist-es/runtimeConfig.browser.js +37 -0
- package/dist-es/runtimeConfig.js +46 -0
- package/dist-es/runtimeConfig.native.js +11 -0
- package/dist-es/runtimeConfig.shared.js +14 -0
- package/dist-types/SageMakerMetrics.d.ts +24 -0
- package/dist-types/SageMakerMetricsClient.d.ts +150 -0
- package/dist-types/commands/BatchPutMetricsCommand.d.ts +39 -0
- package/dist-types/commands/index.d.ts +1 -0
- package/dist-types/endpoint/EndpointParameters.d.ts +19 -0
- package/dist-types/endpoint/endpointResolver.d.ts +5 -0
- package/dist-types/endpoint/ruleset.d.ts +2 -0
- package/dist-types/index.d.ts +5 -0
- package/dist-types/models/SageMakerMetricsServiceException.d.ts +10 -0
- package/dist-types/models/index.d.ts +1 -0
- package/dist-types/models/models_0.d.ts +91 -0
- package/dist-types/protocols/Aws_restJson1.d.ts +5 -0
- package/dist-types/runtimeConfig.browser.d.ts +42 -0
- package/dist-types/runtimeConfig.d.ts +42 -0
- package/dist-types/runtimeConfig.native.d.ts +41 -0
- package/dist-types/runtimeConfig.shared.d.ts +16 -0
- package/dist-types/ts3.4/SageMakerMetrics.d.ts +21 -0
- package/dist-types/ts3.4/SageMakerMetricsClient.d.ts +116 -0
- package/dist-types/ts3.4/commands/BatchPutMetricsCommand.d.ts +37 -0
- package/dist-types/ts3.4/commands/index.d.ts +1 -0
- package/dist-types/ts3.4/endpoint/EndpointParameters.d.ts +34 -0
- package/dist-types/ts3.4/endpoint/endpointResolver.d.ts +8 -0
- package/dist-types/ts3.4/endpoint/ruleset.d.ts +2 -0
- package/dist-types/ts3.4/index.d.ts +5 -0
- package/dist-types/ts3.4/models/SageMakerMetricsServiceException.d.ts +7 -0
- package/dist-types/ts3.4/models/index.d.ts +1 -0
- package/dist-types/ts3.4/models/models_0.d.ts +35 -0
- package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +17 -0
- package/dist-types/ts3.4/runtimeConfig.browser.d.ts +93 -0
- package/dist-types/ts3.4/runtimeConfig.d.ts +93 -0
- package/dist-types/ts3.4/runtimeConfig.native.d.ts +82 -0
- package/dist-types/ts3.4/runtimeConfig.shared.d.ts +18 -0
- package/package.json +102 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { resolveRegionConfig } from "@aws-sdk/config-resolver";
|
|
2
|
+
import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length";
|
|
3
|
+
import { resolveEndpointConfig } from "@aws-sdk/middleware-endpoint";
|
|
4
|
+
import { getHostHeaderPlugin, resolveHostHeaderConfig, } from "@aws-sdk/middleware-host-header";
|
|
5
|
+
import { getLoggerPlugin } from "@aws-sdk/middleware-logger";
|
|
6
|
+
import { getRecursionDetectionPlugin } from "@aws-sdk/middleware-recursion-detection";
|
|
7
|
+
import { getRetryPlugin, resolveRetryConfig } from "@aws-sdk/middleware-retry";
|
|
8
|
+
import { getAwsAuthPlugin, resolveAwsAuthConfig, } from "@aws-sdk/middleware-signing";
|
|
9
|
+
import { getUserAgentPlugin, resolveUserAgentConfig, } from "@aws-sdk/middleware-user-agent";
|
|
10
|
+
import { Client as __Client, } from "@aws-sdk/smithy-client";
|
|
11
|
+
import { resolveClientEndpointParameters, } from "./endpoint/EndpointParameters";
|
|
12
|
+
import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
|
|
13
|
+
export class SageMakerMetricsClient extends __Client {
|
|
14
|
+
constructor(configuration) {
|
|
15
|
+
const _config_0 = __getRuntimeConfig(configuration);
|
|
16
|
+
const _config_1 = resolveClientEndpointParameters(_config_0);
|
|
17
|
+
const _config_2 = resolveRegionConfig(_config_1);
|
|
18
|
+
const _config_3 = resolveEndpointConfig(_config_2);
|
|
19
|
+
const _config_4 = resolveRetryConfig(_config_3);
|
|
20
|
+
const _config_5 = resolveHostHeaderConfig(_config_4);
|
|
21
|
+
const _config_6 = resolveAwsAuthConfig(_config_5);
|
|
22
|
+
const _config_7 = resolveUserAgentConfig(_config_6);
|
|
23
|
+
super(_config_7);
|
|
24
|
+
this.config = _config_7;
|
|
25
|
+
this.middlewareStack.use(getRetryPlugin(this.config));
|
|
26
|
+
this.middlewareStack.use(getContentLengthPlugin(this.config));
|
|
27
|
+
this.middlewareStack.use(getHostHeaderPlugin(this.config));
|
|
28
|
+
this.middlewareStack.use(getLoggerPlugin(this.config));
|
|
29
|
+
this.middlewareStack.use(getRecursionDetectionPlugin(this.config));
|
|
30
|
+
this.middlewareStack.use(getAwsAuthPlugin(this.config));
|
|
31
|
+
this.middlewareStack.use(getUserAgentPlugin(this.config));
|
|
32
|
+
}
|
|
33
|
+
destroy() {
|
|
34
|
+
super.destroy();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { getEndpointPlugin } from "@aws-sdk/middleware-endpoint";
|
|
2
|
+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
|
|
3
|
+
import { Command as $Command } from "@aws-sdk/smithy-client";
|
|
4
|
+
import { BatchPutMetricsRequestFilterSensitiveLog, BatchPutMetricsResponseFilterSensitiveLog, } from "../models/models_0";
|
|
5
|
+
import { deserializeAws_restJson1BatchPutMetricsCommand, serializeAws_restJson1BatchPutMetricsCommand, } from "../protocols/Aws_restJson1";
|
|
6
|
+
export class BatchPutMetricsCommand extends $Command {
|
|
7
|
+
constructor(input) {
|
|
8
|
+
super();
|
|
9
|
+
this.input = input;
|
|
10
|
+
}
|
|
11
|
+
static getEndpointParameterInstructions() {
|
|
12
|
+
return {
|
|
13
|
+
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
|
|
14
|
+
Endpoint: { type: "builtInParams", name: "endpoint" },
|
|
15
|
+
Region: { type: "builtInParams", name: "region" },
|
|
16
|
+
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
resolveMiddleware(clientStack, configuration, options) {
|
|
20
|
+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
|
|
21
|
+
this.middlewareStack.use(getEndpointPlugin(configuration, BatchPutMetricsCommand.getEndpointParameterInstructions()));
|
|
22
|
+
const stack = clientStack.concat(this.middlewareStack);
|
|
23
|
+
const { logger } = configuration;
|
|
24
|
+
const clientName = "SageMakerMetricsClient";
|
|
25
|
+
const commandName = "BatchPutMetricsCommand";
|
|
26
|
+
const handlerExecutionContext = {
|
|
27
|
+
logger,
|
|
28
|
+
clientName,
|
|
29
|
+
commandName,
|
|
30
|
+
inputFilterSensitiveLog: BatchPutMetricsRequestFilterSensitiveLog,
|
|
31
|
+
outputFilterSensitiveLog: BatchPutMetricsResponseFilterSensitiveLog,
|
|
32
|
+
};
|
|
33
|
+
const { requestHandler } = configuration;
|
|
34
|
+
return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
|
|
35
|
+
}
|
|
36
|
+
serialize(input, context) {
|
|
37
|
+
return serializeAws_restJson1BatchPutMetricsCommand(input, context);
|
|
38
|
+
}
|
|
39
|
+
deserialize(output, context) {
|
|
40
|
+
return deserializeAws_restJson1BatchPutMetricsCommand(output, context);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./BatchPutMetricsCommand";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { resolveEndpoint } from "@aws-sdk/util-endpoints";
|
|
2
|
+
import { ruleSet } from "./ruleset";
|
|
3
|
+
export const defaultEndpointResolver = (endpointParams, context = {}) => {
|
|
4
|
+
return resolveEndpoint(ruleSet, {
|
|
5
|
+
endpointParams: endpointParams,
|
|
6
|
+
logger: context.logger,
|
|
7
|
+
});
|
|
8
|
+
};
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
export const ruleSet = {
|
|
2
|
+
version: "1.0",
|
|
3
|
+
parameters: {
|
|
4
|
+
Region: {
|
|
5
|
+
builtIn: "AWS::Region",
|
|
6
|
+
required: true,
|
|
7
|
+
documentation: "The AWS region used to dispatch the request.",
|
|
8
|
+
type: "String",
|
|
9
|
+
},
|
|
10
|
+
UseDualStack: {
|
|
11
|
+
builtIn: "AWS::UseDualStack",
|
|
12
|
+
required: true,
|
|
13
|
+
default: false,
|
|
14
|
+
documentation: "When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.",
|
|
15
|
+
type: "Boolean",
|
|
16
|
+
},
|
|
17
|
+
UseFIPS: {
|
|
18
|
+
builtIn: "AWS::UseFIPS",
|
|
19
|
+
required: true,
|
|
20
|
+
default: false,
|
|
21
|
+
documentation: "When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.",
|
|
22
|
+
type: "Boolean",
|
|
23
|
+
},
|
|
24
|
+
Endpoint: {
|
|
25
|
+
builtIn: "SDK::Endpoint",
|
|
26
|
+
required: false,
|
|
27
|
+
documentation: "Override the endpoint used to send this request",
|
|
28
|
+
type: "String",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
rules: [
|
|
32
|
+
{
|
|
33
|
+
conditions: [
|
|
34
|
+
{
|
|
35
|
+
fn: "aws.partition",
|
|
36
|
+
argv: [
|
|
37
|
+
{
|
|
38
|
+
ref: "Region",
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
assign: "PartitionResult",
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
type: "tree",
|
|
45
|
+
rules: [
|
|
46
|
+
{
|
|
47
|
+
conditions: [
|
|
48
|
+
{
|
|
49
|
+
fn: "isSet",
|
|
50
|
+
argv: [
|
|
51
|
+
{
|
|
52
|
+
ref: "Endpoint",
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
type: "tree",
|
|
58
|
+
rules: [
|
|
59
|
+
{
|
|
60
|
+
conditions: [
|
|
61
|
+
{
|
|
62
|
+
fn: "booleanEquals",
|
|
63
|
+
argv: [
|
|
64
|
+
{
|
|
65
|
+
ref: "UseFIPS",
|
|
66
|
+
},
|
|
67
|
+
true,
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
error: "Invalid Configuration: FIPS and custom endpoint are not supported",
|
|
72
|
+
type: "error",
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
conditions: [],
|
|
76
|
+
type: "tree",
|
|
77
|
+
rules: [
|
|
78
|
+
{
|
|
79
|
+
conditions: [
|
|
80
|
+
{
|
|
81
|
+
fn: "booleanEquals",
|
|
82
|
+
argv: [
|
|
83
|
+
{
|
|
84
|
+
ref: "UseDualStack",
|
|
85
|
+
},
|
|
86
|
+
true,
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
error: "Invalid Configuration: Dualstack and custom endpoint are not supported",
|
|
91
|
+
type: "error",
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
conditions: [],
|
|
95
|
+
endpoint: {
|
|
96
|
+
url: {
|
|
97
|
+
ref: "Endpoint",
|
|
98
|
+
},
|
|
99
|
+
properties: {},
|
|
100
|
+
headers: {},
|
|
101
|
+
},
|
|
102
|
+
type: "endpoint",
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
conditions: [
|
|
110
|
+
{
|
|
111
|
+
fn: "booleanEquals",
|
|
112
|
+
argv: [
|
|
113
|
+
{
|
|
114
|
+
ref: "UseFIPS",
|
|
115
|
+
},
|
|
116
|
+
true,
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
fn: "booleanEquals",
|
|
121
|
+
argv: [
|
|
122
|
+
{
|
|
123
|
+
ref: "UseDualStack",
|
|
124
|
+
},
|
|
125
|
+
true,
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
type: "tree",
|
|
130
|
+
rules: [
|
|
131
|
+
{
|
|
132
|
+
conditions: [
|
|
133
|
+
{
|
|
134
|
+
fn: "booleanEquals",
|
|
135
|
+
argv: [
|
|
136
|
+
true,
|
|
137
|
+
{
|
|
138
|
+
fn: "getAttr",
|
|
139
|
+
argv: [
|
|
140
|
+
{
|
|
141
|
+
ref: "PartitionResult",
|
|
142
|
+
},
|
|
143
|
+
"supportsFIPS",
|
|
144
|
+
],
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
fn: "booleanEquals",
|
|
150
|
+
argv: [
|
|
151
|
+
true,
|
|
152
|
+
{
|
|
153
|
+
fn: "getAttr",
|
|
154
|
+
argv: [
|
|
155
|
+
{
|
|
156
|
+
ref: "PartitionResult",
|
|
157
|
+
},
|
|
158
|
+
"supportsDualStack",
|
|
159
|
+
],
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
type: "tree",
|
|
165
|
+
rules: [
|
|
166
|
+
{
|
|
167
|
+
conditions: [],
|
|
168
|
+
endpoint: {
|
|
169
|
+
url: "https://metrics.sagemaker-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",
|
|
170
|
+
properties: {},
|
|
171
|
+
headers: {},
|
|
172
|
+
},
|
|
173
|
+
type: "endpoint",
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
conditions: [],
|
|
179
|
+
error: "FIPS and DualStack are enabled, but this partition does not support one or both",
|
|
180
|
+
type: "error",
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
conditions: [
|
|
186
|
+
{
|
|
187
|
+
fn: "booleanEquals",
|
|
188
|
+
argv: [
|
|
189
|
+
{
|
|
190
|
+
ref: "UseFIPS",
|
|
191
|
+
},
|
|
192
|
+
true,
|
|
193
|
+
],
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
type: "tree",
|
|
197
|
+
rules: [
|
|
198
|
+
{
|
|
199
|
+
conditions: [
|
|
200
|
+
{
|
|
201
|
+
fn: "booleanEquals",
|
|
202
|
+
argv: [
|
|
203
|
+
true,
|
|
204
|
+
{
|
|
205
|
+
fn: "getAttr",
|
|
206
|
+
argv: [
|
|
207
|
+
{
|
|
208
|
+
ref: "PartitionResult",
|
|
209
|
+
},
|
|
210
|
+
"supportsFIPS",
|
|
211
|
+
],
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
},
|
|
215
|
+
],
|
|
216
|
+
type: "tree",
|
|
217
|
+
rules: [
|
|
218
|
+
{
|
|
219
|
+
conditions: [],
|
|
220
|
+
endpoint: {
|
|
221
|
+
url: "https://metrics.sagemaker-fips.{Region}.{PartitionResult#dnsSuffix}",
|
|
222
|
+
properties: {},
|
|
223
|
+
headers: {},
|
|
224
|
+
},
|
|
225
|
+
type: "endpoint",
|
|
226
|
+
},
|
|
227
|
+
],
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
conditions: [],
|
|
231
|
+
error: "FIPS is enabled but this partition does not support FIPS",
|
|
232
|
+
type: "error",
|
|
233
|
+
},
|
|
234
|
+
],
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
conditions: [
|
|
238
|
+
{
|
|
239
|
+
fn: "booleanEquals",
|
|
240
|
+
argv: [
|
|
241
|
+
{
|
|
242
|
+
ref: "UseDualStack",
|
|
243
|
+
},
|
|
244
|
+
true,
|
|
245
|
+
],
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
type: "tree",
|
|
249
|
+
rules: [
|
|
250
|
+
{
|
|
251
|
+
conditions: [
|
|
252
|
+
{
|
|
253
|
+
fn: "booleanEquals",
|
|
254
|
+
argv: [
|
|
255
|
+
true,
|
|
256
|
+
{
|
|
257
|
+
fn: "getAttr",
|
|
258
|
+
argv: [
|
|
259
|
+
{
|
|
260
|
+
ref: "PartitionResult",
|
|
261
|
+
},
|
|
262
|
+
"supportsDualStack",
|
|
263
|
+
],
|
|
264
|
+
},
|
|
265
|
+
],
|
|
266
|
+
},
|
|
267
|
+
],
|
|
268
|
+
type: "tree",
|
|
269
|
+
rules: [
|
|
270
|
+
{
|
|
271
|
+
conditions: [],
|
|
272
|
+
endpoint: {
|
|
273
|
+
url: "https://metrics.sagemaker.{Region}.{PartitionResult#dualStackDnsSuffix}",
|
|
274
|
+
properties: {},
|
|
275
|
+
headers: {},
|
|
276
|
+
},
|
|
277
|
+
type: "endpoint",
|
|
278
|
+
},
|
|
279
|
+
],
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
conditions: [],
|
|
283
|
+
error: "DualStack is enabled but this partition does not support DualStack",
|
|
284
|
+
type: "error",
|
|
285
|
+
},
|
|
286
|
+
],
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
conditions: [],
|
|
290
|
+
endpoint: {
|
|
291
|
+
url: "https://metrics.sagemaker.{Region}.{PartitionResult#dnsSuffix}",
|
|
292
|
+
properties: {},
|
|
293
|
+
headers: {},
|
|
294
|
+
},
|
|
295
|
+
type: "endpoint",
|
|
296
|
+
},
|
|
297
|
+
],
|
|
298
|
+
},
|
|
299
|
+
],
|
|
300
|
+
};
|
package/dist-es/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ServiceException as __ServiceException, } from "@aws-sdk/smithy-client";
|
|
2
|
+
export class SageMakerMetricsServiceException extends __ServiceException {
|
|
3
|
+
constructor(options) {
|
|
4
|
+
super(options);
|
|
5
|
+
Object.setPrototypeOf(this, SageMakerMetricsServiceException.prototype);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./models_0";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export var PutMetricsErrorCode;
|
|
2
|
+
(function (PutMetricsErrorCode) {
|
|
3
|
+
PutMetricsErrorCode["CONFLICT_ERROR"] = "CONFLICT_ERROR";
|
|
4
|
+
PutMetricsErrorCode["INTERNAL_ERROR"] = "INTERNAL_ERROR";
|
|
5
|
+
PutMetricsErrorCode["METRIC_LIMIT_EXCEEDED"] = "METRIC_LIMIT_EXCEEDED";
|
|
6
|
+
PutMetricsErrorCode["VALIDATION_ERROR"] = "VALIDATION_ERROR";
|
|
7
|
+
})(PutMetricsErrorCode || (PutMetricsErrorCode = {}));
|
|
8
|
+
export const RawMetricDataFilterSensitiveLog = (obj) => ({
|
|
9
|
+
...obj,
|
|
10
|
+
});
|
|
11
|
+
export const BatchPutMetricsRequestFilterSensitiveLog = (obj) => ({
|
|
12
|
+
...obj,
|
|
13
|
+
});
|
|
14
|
+
export const BatchPutMetricsErrorFilterSensitiveLog = (obj) => ({
|
|
15
|
+
...obj,
|
|
16
|
+
});
|
|
17
|
+
export const BatchPutMetricsResponseFilterSensitiveLog = (obj) => ({
|
|
18
|
+
...obj,
|
|
19
|
+
});
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
|
|
2
|
+
import { expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map as __map, serializeFloat as __serializeFloat, throwDefaultError, } from "@aws-sdk/smithy-client";
|
|
3
|
+
import { SageMakerMetricsServiceException as __BaseException } from "../models/SageMakerMetricsServiceException";
|
|
4
|
+
export const serializeAws_restJson1BatchPutMetricsCommand = async (input, context) => {
|
|
5
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
6
|
+
const headers = {
|
|
7
|
+
"content-type": "application/json",
|
|
8
|
+
};
|
|
9
|
+
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/BatchPutMetrics";
|
|
10
|
+
let body;
|
|
11
|
+
body = JSON.stringify({
|
|
12
|
+
...(input.MetricData != null && { MetricData: serializeAws_restJson1RawMetricDataList(input.MetricData, context) }),
|
|
13
|
+
...(input.TrialComponentName != null && { TrialComponentName: input.TrialComponentName }),
|
|
14
|
+
});
|
|
15
|
+
return new __HttpRequest({
|
|
16
|
+
protocol,
|
|
17
|
+
hostname,
|
|
18
|
+
port,
|
|
19
|
+
method: "PUT",
|
|
20
|
+
headers,
|
|
21
|
+
path: resolvedPath,
|
|
22
|
+
body,
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
export const deserializeAws_restJson1BatchPutMetricsCommand = async (output, context) => {
|
|
26
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
27
|
+
return deserializeAws_restJson1BatchPutMetricsCommandError(output, context);
|
|
28
|
+
}
|
|
29
|
+
const contents = map({
|
|
30
|
+
$metadata: deserializeMetadata(output),
|
|
31
|
+
});
|
|
32
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
33
|
+
if (data.Errors != null) {
|
|
34
|
+
contents.Errors = deserializeAws_restJson1BatchPutMetricsErrorList(data.Errors, context);
|
|
35
|
+
}
|
|
36
|
+
return contents;
|
|
37
|
+
};
|
|
38
|
+
const deserializeAws_restJson1BatchPutMetricsCommandError = async (output, context) => {
|
|
39
|
+
const parsedOutput = {
|
|
40
|
+
...output,
|
|
41
|
+
body: await parseErrorBody(output.body, context),
|
|
42
|
+
};
|
|
43
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
44
|
+
const parsedBody = parsedOutput.body;
|
|
45
|
+
throwDefaultError({
|
|
46
|
+
output,
|
|
47
|
+
parsedBody,
|
|
48
|
+
exceptionCtor: __BaseException,
|
|
49
|
+
errorCode,
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
const map = __map;
|
|
53
|
+
const serializeAws_restJson1RawMetricData = (input, context) => {
|
|
54
|
+
return {
|
|
55
|
+
...(input.MetricName != null && { MetricName: input.MetricName }),
|
|
56
|
+
...(input.Step != null && { Step: input.Step }),
|
|
57
|
+
...(input.Timestamp != null && { Timestamp: Math.round(input.Timestamp.getTime() / 1000) }),
|
|
58
|
+
...(input.Value != null && { Value: __serializeFloat(input.Value) }),
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
const serializeAws_restJson1RawMetricDataList = (input, context) => {
|
|
62
|
+
return input
|
|
63
|
+
.filter((e) => e != null)
|
|
64
|
+
.map((entry) => {
|
|
65
|
+
return serializeAws_restJson1RawMetricData(entry, context);
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
const deserializeAws_restJson1BatchPutMetricsError = (output, context) => {
|
|
69
|
+
return {
|
|
70
|
+
Code: __expectString(output.Code),
|
|
71
|
+
MetricIndex: __expectInt32(output.MetricIndex),
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
const deserializeAws_restJson1BatchPutMetricsErrorList = (output, context) => {
|
|
75
|
+
const retVal = (output || [])
|
|
76
|
+
.filter((e) => e != null)
|
|
77
|
+
.map((entry) => {
|
|
78
|
+
if (entry === null) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
return deserializeAws_restJson1BatchPutMetricsError(entry, context);
|
|
82
|
+
});
|
|
83
|
+
return retVal;
|
|
84
|
+
};
|
|
85
|
+
const deserializeMetadata = (output) => ({
|
|
86
|
+
httpStatusCode: output.statusCode,
|
|
87
|
+
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
|
|
88
|
+
extendedRequestId: output.headers["x-amz-id-2"],
|
|
89
|
+
cfId: output.headers["x-amz-cf-id"],
|
|
90
|
+
});
|
|
91
|
+
const collectBody = (streamBody = new Uint8Array(), context) => {
|
|
92
|
+
if (streamBody instanceof Uint8Array) {
|
|
93
|
+
return Promise.resolve(streamBody);
|
|
94
|
+
}
|
|
95
|
+
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
|
|
96
|
+
};
|
|
97
|
+
const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
|
|
98
|
+
const isSerializableHeaderValue = (value) => value !== undefined &&
|
|
99
|
+
value !== null &&
|
|
100
|
+
value !== "" &&
|
|
101
|
+
(!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
|
|
102
|
+
(!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
|
|
103
|
+
const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
104
|
+
if (encoded.length) {
|
|
105
|
+
return JSON.parse(encoded);
|
|
106
|
+
}
|
|
107
|
+
return {};
|
|
108
|
+
});
|
|
109
|
+
const parseErrorBody = async (errorBody, context) => {
|
|
110
|
+
const value = await parseBody(errorBody, context);
|
|
111
|
+
value.message = value.message ?? value.Message;
|
|
112
|
+
return value;
|
|
113
|
+
};
|
|
114
|
+
const loadRestJsonErrorCode = (output, data) => {
|
|
115
|
+
const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
116
|
+
const sanitizeErrorCode = (rawValue) => {
|
|
117
|
+
let cleanValue = rawValue;
|
|
118
|
+
if (typeof cleanValue === "number") {
|
|
119
|
+
cleanValue = cleanValue.toString();
|
|
120
|
+
}
|
|
121
|
+
if (cleanValue.indexOf(",") >= 0) {
|
|
122
|
+
cleanValue = cleanValue.split(",")[0];
|
|
123
|
+
}
|
|
124
|
+
if (cleanValue.indexOf(":") >= 0) {
|
|
125
|
+
cleanValue = cleanValue.split(":")[0];
|
|
126
|
+
}
|
|
127
|
+
if (cleanValue.indexOf("#") >= 0) {
|
|
128
|
+
cleanValue = cleanValue.split("#")[1];
|
|
129
|
+
}
|
|
130
|
+
return cleanValue;
|
|
131
|
+
};
|
|
132
|
+
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
133
|
+
if (headerKey !== undefined) {
|
|
134
|
+
return sanitizeErrorCode(output.headers[headerKey]);
|
|
135
|
+
}
|
|
136
|
+
if (data.code !== undefined) {
|
|
137
|
+
return sanitizeErrorCode(data.code);
|
|
138
|
+
}
|
|
139
|
+
if (data["__type"] !== undefined) {
|
|
140
|
+
return sanitizeErrorCode(data["__type"]);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import packageInfo from "../package.json";
|
|
2
|
+
import { Sha256 } from "@aws-crypto/sha256-browser";
|
|
3
|
+
import { DEFAULT_USE_DUALSTACK_ENDPOINT, DEFAULT_USE_FIPS_ENDPOINT } from "@aws-sdk/config-resolver";
|
|
4
|
+
import { FetchHttpHandler as RequestHandler, streamCollector } from "@aws-sdk/fetch-http-handler";
|
|
5
|
+
import { invalidProvider } from "@aws-sdk/invalid-dependency";
|
|
6
|
+
import { calculateBodyLength } from "@aws-sdk/util-body-length-browser";
|
|
7
|
+
import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/util-retry";
|
|
8
|
+
import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser";
|
|
9
|
+
import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser";
|
|
10
|
+
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
|
|
11
|
+
import { loadConfigsForDefaultMode } from "@aws-sdk/smithy-client";
|
|
12
|
+
import { resolveDefaultsModeConfig } from "@aws-sdk/util-defaults-mode-browser";
|
|
13
|
+
export const getRuntimeConfig = (config) => {
|
|
14
|
+
const defaultsMode = resolveDefaultsModeConfig(config);
|
|
15
|
+
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
|
|
16
|
+
const clientSharedValues = getSharedRuntimeConfig(config);
|
|
17
|
+
return {
|
|
18
|
+
...clientSharedValues,
|
|
19
|
+
...config,
|
|
20
|
+
runtime: "browser",
|
|
21
|
+
defaultsMode,
|
|
22
|
+
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
|
23
|
+
credentialDefaultProvider: config?.credentialDefaultProvider ?? ((_) => () => Promise.reject(new Error("Credential is missing"))),
|
|
24
|
+
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
|
25
|
+
defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
26
|
+
maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
|
|
27
|
+
region: config?.region ?? invalidProvider("Region is missing"),
|
|
28
|
+
requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider),
|
|
29
|
+
retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE),
|
|
30
|
+
sha256: config?.sha256 ?? Sha256,
|
|
31
|
+
streamCollector: config?.streamCollector ?? streamCollector,
|
|
32
|
+
useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)),
|
|
33
|
+
useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT)),
|
|
34
|
+
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
|
|
35
|
+
utf8Encoder: config?.utf8Encoder ?? toUtf8,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import packageInfo from "../package.json";
|
|
2
|
+
import { decorateDefaultCredentialProvider } from "@aws-sdk/client-sts";
|
|
3
|
+
import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS, NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, } from "@aws-sdk/config-resolver";
|
|
4
|
+
import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node";
|
|
5
|
+
import { Hash } from "@aws-sdk/hash-node";
|
|
6
|
+
import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry";
|
|
7
|
+
import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider";
|
|
8
|
+
import { NodeHttpHandler as RequestHandler, streamCollector } from "@aws-sdk/node-http-handler";
|
|
9
|
+
import { calculateBodyLength } from "@aws-sdk/util-body-length-node";
|
|
10
|
+
import { DEFAULT_RETRY_MODE } from "@aws-sdk/util-retry";
|
|
11
|
+
import { defaultUserAgent } from "@aws-sdk/util-user-agent-node";
|
|
12
|
+
import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node";
|
|
13
|
+
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
|
|
14
|
+
import { loadConfigsForDefaultMode } from "@aws-sdk/smithy-client";
|
|
15
|
+
import { resolveDefaultsModeConfig } from "@aws-sdk/util-defaults-mode-node";
|
|
16
|
+
import { emitWarningIfUnsupportedVersion } from "@aws-sdk/smithy-client";
|
|
17
|
+
export const getRuntimeConfig = (config) => {
|
|
18
|
+
emitWarningIfUnsupportedVersion(process.version);
|
|
19
|
+
const defaultsMode = resolveDefaultsModeConfig(config);
|
|
20
|
+
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
|
|
21
|
+
const clientSharedValues = getSharedRuntimeConfig(config);
|
|
22
|
+
return {
|
|
23
|
+
...clientSharedValues,
|
|
24
|
+
...config,
|
|
25
|
+
runtime: "node",
|
|
26
|
+
defaultsMode,
|
|
27
|
+
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
|
28
|
+
credentialDefaultProvider: config?.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider),
|
|
29
|
+
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
|
30
|
+
defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
31
|
+
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
|
|
32
|
+
region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
|
|
33
|
+
requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider),
|
|
34
|
+
retryMode: config?.retryMode ??
|
|
35
|
+
loadNodeConfig({
|
|
36
|
+
...NODE_RETRY_MODE_CONFIG_OPTIONS,
|
|
37
|
+
default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
|
|
38
|
+
}),
|
|
39
|
+
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
|
|
40
|
+
streamCollector: config?.streamCollector ?? streamCollector,
|
|
41
|
+
useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS),
|
|
42
|
+
useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS),
|
|
43
|
+
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
|
|
44
|
+
utf8Encoder: config?.utf8Encoder ?? toUtf8,
|
|
45
|
+
};
|
|
46
|
+
};
|