@aws-sdk/client-sustainability 3.1074.0 → 3.1076.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,21 +1,187 @@
1
- var __exportStar = (m, e) => { Object.assign(e, m); };
2
- const { getAwsRegionExtensionConfiguration, resolveAwsRegionExtensionConfiguration, resolveUserAgentConfig, resolveHostHeaderConfig, getUserAgentPlugin, getHostHeaderPlugin, getLoggerPlugin, getRecursionDetectionPlugin } = require("@aws-sdk/core/client");
1
+ const { awsEndpointFunctions, emitWarningIfUnsupportedVersion: emitWarningIfUnsupportedVersion$1, createDefaultUserAgentProvider, NODE_APP_ID_CONFIG_OPTIONS, getAwsRegionExtensionConfiguration, resolveAwsRegionExtensionConfiguration, resolveUserAgentConfig, resolveHostHeaderConfig, getUserAgentPlugin, getHostHeaderPlugin, getLoggerPlugin, getRecursionDetectionPlugin } = require("@aws-sdk/core/client");
3
2
  const { getHttpAuthSchemeEndpointRuleSetPlugin, DefaultIdentityProviderConfig, getHttpSigningPlugin, createPaginator } = require("@smithy/core");
4
- const { getDefaultExtensionConfiguration, resolveDefaultRuntimeConfig, Client, Command, createAggregatedClient } = require("@smithy/core/client");
3
+ const { normalizeProvider, getSmithyContext, ServiceException, NoOpLogger, emitWarningIfUnsupportedVersion, loadConfigsForDefaultMode, getDefaultExtensionConfiguration, resolveDefaultRuntimeConfig, Client, Command, createAggregatedClient } = require("@smithy/core/client");
5
4
  exports.$Command = Command;
6
5
  exports.__Client = Client;
7
- const { resolveRegionConfig } = require("@smithy/core/config");
8
- const { resolveEndpointConfig, getEndpointPlugin } = require("@smithy/core/endpoints");
9
- const { getHttpHandlerExtensionConfiguration, resolveHttpHandlerRuntimeConfig, getContentLengthPlugin } = require("@smithy/core/protocols");
10
- const { resolveRetryConfig, getRetryPlugin } = require("@smithy/core/retry");
11
- const { getSchemaSerdePlugin } = require("@smithy/core/schema");
12
- const { resolveHttpAuthSchemeConfig, defaultSustainabilityHttpAuthSchemeParametersProvider } = require("./auth/httpAuthSchemeProvider");
13
- const { getRuntimeConfig } = require("./runtimeConfig");
14
- const { GetEstimatedCarbonEmissions$, GetEstimatedCarbonEmissionsDimensionValues$ } = require("./schemas/schemas_0");
15
- __exportStar(require("./schemas/schemas_0"), exports);
16
- __exportStar(require("./models/errors"), exports);
17
- const { SustainabilityServiceException } = require("./models/SustainabilityServiceException");
18
- exports.SustainabilityServiceException = SustainabilityServiceException;
6
+ const { resolveDefaultsModeConfig, loadConfig, NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS, resolveRegionConfig } = require("@smithy/core/config");
7
+ const { BinaryDecisionDiagram, EndpointCache, decideEndpoint, customEndpointFunctions, resolveParams, resolveEndpointConfig, getEndpointPlugin } = require("@smithy/core/endpoints");
8
+ const { parseUrl, getHttpHandlerExtensionConfiguration, resolveHttpHandlerRuntimeConfig, getContentLengthPlugin } = require("@smithy/core/protocols");
9
+ const { DEFAULT_RETRY_MODE, NODE_RETRY_MODE_CONFIG_OPTIONS, NODE_MAX_ATTEMPT_CONFIG_OPTIONS, resolveRetryConfig, getRetryPlugin } = require("@smithy/core/retry");
10
+ const { TypeRegistry, getSchemaSerdePlugin } = require("@smithy/core/schema");
11
+ const { resolveAwsSdkSigV4Config, resolveAwsSdkSigV4AConfig, AwsSdkSigV4Signer, AwsSdkSigV4ASigner, NODE_SIGV4A_CONFIG_OPTIONS, NODE_AUTH_SCHEME_PREFERENCE_OPTIONS } = require("@aws-sdk/core/httpAuthSchemes");
12
+ const { SignatureV4MultiRegion } = require("@aws-sdk/signature-v4-multi-region");
13
+ const { defaultProvider } = require("@aws-sdk/credential-provider-node");
14
+ const { toUtf8, fromUtf8, toBase64, fromBase64, Hash, calculateBodyLength } = require("@smithy/core/serde");
15
+ const { streamCollector, NodeHttpHandler } = require("@smithy/node-http-handler");
16
+ const { AwsRestJsonProtocol } = require("@aws-sdk/core/protocols");
17
+
18
+ const k = "ref", l = "authSchemes", m = "name", n = "signingRegion";
19
+ const a = "isSet", b = "PartitionResult", c = "stringEquals", d = "sigv4", e = { [k]: "Endpoint" }, f = { "fn": "getAttr", "argv": [{ [k]: b }, "name"] }, g = { [m]: "sigv4a", "signingRegionSet": ["*"] }, h = { [l]: [g, { [m]: d, [n]: "us-gov-west-1" }] }, i = { [l]: [g, { [m]: d, [n]: "{PartitionResult#implicitGlobalRegion}" }] }, j = [{ [k]: "Region" }];
20
+ const _data = {
21
+ conditions: [
22
+ [a, [e]],
23
+ [a, j],
24
+ ["aws.partition", j, b],
25
+ ["booleanEquals", [{ [k]: "UseFIPS" }, true]],
26
+ [c, [f, "aws"]],
27
+ [c, [f, "aws-us-gov"]]
28
+ ],
29
+ results: [
30
+ [-1],
31
+ [-1, "Invalid Configuration: FIPS and custom endpoint are not supported"],
32
+ [e, { [l]: [g, { [m]: d }] }],
33
+ ["https://api.sustainability.{Region}.{PartitionResult#dualStackDnsSuffix}", { [l]: [g, { [m]: d, [n]: "us-east-1" }] }],
34
+ ["https://sustainability.us-gov.{PartitionResult#dualStackDnsSuffix}", h],
35
+ ["https://sustainability-fips.us-gov.{PartitionResult#dualStackDnsSuffix}", h],
36
+ ["https://sustainability-fips.global.{PartitionResult#dualStackDnsSuffix}", i],
37
+ ["https://sustainability.global.{PartitionResult#dualStackDnsSuffix}", i],
38
+ [-1, "Invalid Configuration: Missing Region"]
39
+ ]
40
+ };
41
+ const root = 2;
42
+ const r = 100_000_000;
43
+ const nodes = new Int32Array([
44
+ -1, 1, -1,
45
+ 0, 9, 3,
46
+ 1, 4, r + 8,
47
+ 2, 5, r + 8,
48
+ 3, 8, 6,
49
+ 4, r + 3, 7,
50
+ 5, r + 4, r + 7,
51
+ 5, r + 5, r + 6,
52
+ 3, r + 1, r + 2,
53
+ ]);
54
+ const bdd = BinaryDecisionDiagram.from(nodes, root, _data.conditions, _data.results);
55
+
56
+ const cache = new EndpointCache({
57
+ size: 50,
58
+ params: ["Endpoint", "Region", "UseFIPS"],
59
+ });
60
+ const defaultEndpointResolver = (endpointParams, context = {}) => {
61
+ return cache.get(endpointParams, () => decideEndpoint(bdd, {
62
+ endpointParams: endpointParams,
63
+ logger: context.logger,
64
+ }));
65
+ };
66
+ customEndpointFunctions.aws = awsEndpointFunctions;
67
+
68
+ const createEndpointRuleSetHttpAuthSchemeParametersProvider = (defaultHttpAuthSchemeParametersProvider) => async (config, context, input) => {
69
+ if (!input) {
70
+ throw new Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`");
71
+ }
72
+ const defaultParameters = await defaultHttpAuthSchemeParametersProvider(config, context, input);
73
+ const instructionsFn = getSmithyContext(context)?.commandInstance?.constructor
74
+ ?.getEndpointParameterInstructions;
75
+ if (!instructionsFn) {
76
+ throw new Error(`getEndpointParameterInstructions() is not defined on '${context.commandName}'`);
77
+ }
78
+ const endpointParameters = await resolveParams(input, { getEndpointParameterInstructions: instructionsFn }, config);
79
+ return Object.assign(defaultParameters, endpointParameters);
80
+ };
81
+ const _defaultSustainabilityHttpAuthSchemeParametersProvider = async (config, context, input) => {
82
+ return {
83
+ operation: getSmithyContext(context).operation,
84
+ region: await normalizeProvider(config.region)() || (() => {
85
+ throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
86
+ })(),
87
+ };
88
+ };
89
+ const defaultSustainabilityHttpAuthSchemeParametersProvider = createEndpointRuleSetHttpAuthSchemeParametersProvider(_defaultSustainabilityHttpAuthSchemeParametersProvider);
90
+ function createAwsAuthSigv4HttpAuthOption(authParameters) {
91
+ return {
92
+ schemeId: "aws.auth#sigv4",
93
+ signingProperties: {
94
+ name: "sustainability",
95
+ region: authParameters.region,
96
+ },
97
+ propertiesExtractor: (config, context) => ({
98
+ signingProperties: {
99
+ config,
100
+ context,
101
+ },
102
+ }),
103
+ };
104
+ }
105
+ function createAwsAuthSigv4aHttpAuthOption(authParameters) {
106
+ return {
107
+ schemeId: "aws.auth#sigv4a",
108
+ signingProperties: {
109
+ name: "sustainability",
110
+ region: authParameters.region,
111
+ },
112
+ propertiesExtractor: (config, context) => ({
113
+ signingProperties: {
114
+ config,
115
+ context,
116
+ },
117
+ }),
118
+ };
119
+ }
120
+ const createEndpointRuleSetHttpAuthSchemeProvider = (defaultEndpointResolver, defaultHttpAuthSchemeResolver, createHttpAuthOptionFunctions) => {
121
+ const endpointRuleSetHttpAuthSchemeProvider = (authParameters) => {
122
+ const endpoint = defaultEndpointResolver(authParameters);
123
+ const authSchemes = endpoint.properties?.authSchemes;
124
+ if (!authSchemes) {
125
+ return defaultHttpAuthSchemeResolver(authParameters);
126
+ }
127
+ const options = [];
128
+ for (const scheme of authSchemes) {
129
+ const { name: resolvedName, properties = {}, ...rest } = scheme;
130
+ const name = resolvedName.toLowerCase();
131
+ if (resolvedName !== name) {
132
+ console.warn(`HttpAuthScheme has been normalized with lowercasing: '${resolvedName}' to '${name}'`);
133
+ }
134
+ let schemeId;
135
+ if (name === "sigv4a") {
136
+ schemeId = "aws.auth#sigv4a";
137
+ const sigv4Present = authSchemes.find((s) => {
138
+ const name = s.name.toLowerCase();
139
+ return name !== "sigv4a" && name.startsWith("sigv4");
140
+ });
141
+ if (SignatureV4MultiRegion.sigv4aDependency() === "none" && sigv4Present) {
142
+ continue;
143
+ }
144
+ }
145
+ else if (name.startsWith("sigv4")) {
146
+ schemeId = "aws.auth#sigv4";
147
+ }
148
+ else {
149
+ throw new Error(`Unknown HttpAuthScheme found in '@smithy.rules#endpointRuleSet': '${name}'`);
150
+ }
151
+ const createOption = createHttpAuthOptionFunctions[schemeId];
152
+ if (!createOption) {
153
+ throw new Error(`Could not find HttpAuthOption create function for '${schemeId}'`);
154
+ }
155
+ const option = createOption(authParameters);
156
+ option.schemeId = schemeId;
157
+ option.signingProperties = { ...(option.signingProperties || {}), ...rest, ...properties };
158
+ options.push(option);
159
+ }
160
+ return options;
161
+ };
162
+ return endpointRuleSetHttpAuthSchemeProvider;
163
+ };
164
+ const _defaultSustainabilityHttpAuthSchemeProvider = (authParameters) => {
165
+ const options = [];
166
+ switch (authParameters.operation) {
167
+ default: {
168
+ options.push(createAwsAuthSigv4aHttpAuthOption(authParameters));
169
+ options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
170
+ }
171
+ }
172
+ return options;
173
+ };
174
+ const defaultSustainabilityHttpAuthSchemeProvider = createEndpointRuleSetHttpAuthSchemeProvider(defaultEndpointResolver, _defaultSustainabilityHttpAuthSchemeProvider, {
175
+ "aws.auth#sigv4": createAwsAuthSigv4HttpAuthOption,
176
+ "aws.auth#sigv4a": createAwsAuthSigv4aHttpAuthOption,
177
+ });
178
+ const resolveHttpAuthSchemeConfig = (config) => {
179
+ const config_0 = resolveAwsSdkSigV4Config(config);
180
+ const config_1 = resolveAwsSdkSigV4AConfig(config_0);
181
+ return Object.assign(config_1, {
182
+ authSchemePreference: normalizeProvider(config.authSchemePreference ?? []),
183
+ });
184
+ };
19
185
 
20
186
  const resolveClientEndpointParameters = (options) => {
21
187
  return Object.assign(options, {
@@ -29,6 +195,294 @@ const commonParams = {
29
195
  Region: { type: "builtInParams", name: "region" },
30
196
  };
31
197
 
198
+ var version = "3.1075.0";
199
+ var packageInfo = {
200
+ version: version};
201
+
202
+ class SustainabilityServiceException extends ServiceException {
203
+ constructor(options) {
204
+ super(options);
205
+ Object.setPrototypeOf(this, SustainabilityServiceException.prototype);
206
+ }
207
+ }
208
+
209
+ class AccessDeniedException extends SustainabilityServiceException {
210
+ name = "AccessDeniedException";
211
+ $fault = "client";
212
+ Message;
213
+ constructor(opts) {
214
+ super({
215
+ name: "AccessDeniedException",
216
+ $fault: "client",
217
+ ...opts,
218
+ });
219
+ Object.setPrototypeOf(this, AccessDeniedException.prototype);
220
+ this.Message = opts.Message;
221
+ }
222
+ }
223
+ class InternalServerException extends SustainabilityServiceException {
224
+ name = "InternalServerException";
225
+ $fault = "server";
226
+ $retryable = {};
227
+ Message;
228
+ constructor(opts) {
229
+ super({
230
+ name: "InternalServerException",
231
+ $fault: "server",
232
+ ...opts,
233
+ });
234
+ Object.setPrototypeOf(this, InternalServerException.prototype);
235
+ this.Message = opts.Message;
236
+ }
237
+ }
238
+ class ThrottlingException extends SustainabilityServiceException {
239
+ name = "ThrottlingException";
240
+ $fault = "client";
241
+ $retryable = {};
242
+ Message;
243
+ constructor(opts) {
244
+ super({
245
+ name: "ThrottlingException",
246
+ $fault: "client",
247
+ ...opts,
248
+ });
249
+ Object.setPrototypeOf(this, ThrottlingException.prototype);
250
+ this.Message = opts.Message;
251
+ }
252
+ }
253
+ class ValidationException extends SustainabilityServiceException {
254
+ name = "ValidationException";
255
+ $fault = "client";
256
+ Message;
257
+ constructor(opts) {
258
+ super({
259
+ name: "ValidationException",
260
+ $fault: "client",
261
+ ...opts,
262
+ });
263
+ Object.setPrototypeOf(this, ValidationException.prototype);
264
+ this.Message = opts.Message;
265
+ }
266
+ }
267
+
268
+ const _ADE = "AccessDeniedException";
269
+ const _D = "Dimension";
270
+ const _DE = "DimensionEntry";
271
+ const _DEL = "DimensionEntryList";
272
+ const _DLM = "DimensionListMap";
273
+ const _DV = "DimensionsValues";
274
+ const _Di = "Dimensions";
275
+ const _E = "Emissions";
276
+ const _ECE = "EstimatedCarbonEmissions";
277
+ const _ECEL = "EstimatedCarbonEmissionsList";
278
+ const _EM = "EmissionsMap";
279
+ const _ET = "EmissionsTypes";
280
+ const _EV = "EmissionsValues";
281
+ const _En = "End";
282
+ const _FB = "FilterBy";
283
+ const _FE = "FilterExpression";
284
+ const _FYSM = "FiscalYearStartMonth";
285
+ const _G = "Granularity";
286
+ const _GB = "GroupBy";
287
+ const _GC = "GranularityConfiguration";
288
+ const _GECE = "GetEstimatedCarbonEmissions";
289
+ const _GECEDV = "GetEstimatedCarbonEmissionsDimensionValues";
290
+ const _GECEDVR = "GetEstimatedCarbonEmissionsDimensionValuesRequest";
291
+ const _GECEDVRe = "GetEstimatedCarbonEmissionsDimensionValuesResponse";
292
+ const _GECER = "GetEstimatedCarbonEmissionsRequest";
293
+ const _GECERe = "GetEstimatedCarbonEmissionsResponse";
294
+ const _ISE = "InternalServerException";
295
+ const _M = "Message";
296
+ const _MR = "MaxResults";
297
+ const _MV = "ModelVersion";
298
+ const _NT = "NextToken";
299
+ const _R = "Results";
300
+ const _S = "Start";
301
+ const _TE = "ThrottlingException";
302
+ const _TP = "TimePeriod";
303
+ const _U = "Unit";
304
+ const _V = "Value";
305
+ const _VE = "ValidationException";
306
+ const _c = "client";
307
+ const _e = "error";
308
+ const _h = "http";
309
+ const _hE = "httpError";
310
+ const _jN = "jsonName";
311
+ const _m = "message";
312
+ const _s = "smithy.ts.sdk.synthetic.com.amazonaws.sustainability";
313
+ const _se = "server";
314
+ const n0 = "com.amazonaws.sustainability";
315
+ const _s_registry = TypeRegistry.for(_s);
316
+ var SustainabilityServiceException$ = [-3, _s, "SustainabilityServiceException", 0, [], []];
317
+ _s_registry.registerError(SustainabilityServiceException$, SustainabilityServiceException);
318
+ const n0_registry = TypeRegistry.for(n0);
319
+ var AccessDeniedException$ = [-3, n0, _ADE,
320
+ { [_e]: _c, [_hE]: 403 },
321
+ [_M],
322
+ [[0, { [_jN]: _m }]], 1
323
+ ];
324
+ n0_registry.registerError(AccessDeniedException$, AccessDeniedException);
325
+ var InternalServerException$ = [-3, n0, _ISE,
326
+ { [_e]: _se, [_hE]: 500 },
327
+ [_M],
328
+ [[0, { [_jN]: _m }]], 1
329
+ ];
330
+ n0_registry.registerError(InternalServerException$, InternalServerException);
331
+ var ThrottlingException$ = [-3, n0, _TE,
332
+ { [_e]: _c, [_hE]: 429 },
333
+ [_M],
334
+ [[0, { [_jN]: _m }]], 1
335
+ ];
336
+ n0_registry.registerError(ThrottlingException$, ThrottlingException);
337
+ var ValidationException$ = [-3, n0, _VE,
338
+ { [_e]: _c, [_hE]: 400 },
339
+ [_M],
340
+ [[0, { [_jN]: _m }]], 1
341
+ ];
342
+ n0_registry.registerError(ValidationException$, ValidationException);
343
+ const errorTypeRegistries = [
344
+ _s_registry,
345
+ n0_registry,
346
+ ];
347
+ var DimensionEntry$ = [3, n0, _DE,
348
+ 0,
349
+ [_D, _V],
350
+ [0, 0], 2
351
+ ];
352
+ var Emissions$ = [3, n0, _E,
353
+ 0,
354
+ [_V, _U],
355
+ [1, 0], 2
356
+ ];
357
+ var EstimatedCarbonEmissions$ = [3, n0, _ECE,
358
+ 0,
359
+ [_TP, _DV, _MV, _EV],
360
+ [() => TimePeriod$, 128 | 0, 0, () => EmissionsMap], 4
361
+ ];
362
+ var FilterExpression$ = [3, n0, _FE,
363
+ 0,
364
+ [_Di],
365
+ [[2, n0, _DLM, 0, 0, 64 | 0]]
366
+ ];
367
+ var GetEstimatedCarbonEmissionsDimensionValuesRequest$ = [3, n0, _GECEDVR,
368
+ 0,
369
+ [_TP, _Di, _MR, _NT],
370
+ [() => TimePeriod$, 64 | 0, 1, 0], 2
371
+ ];
372
+ var GetEstimatedCarbonEmissionsDimensionValuesResponse$ = [3, n0, _GECEDVRe,
373
+ 0,
374
+ [_R, _NT],
375
+ [() => DimensionEntryList, 0]
376
+ ];
377
+ var GetEstimatedCarbonEmissionsRequest$ = [3, n0, _GECER,
378
+ 0,
379
+ [_TP, _GB, _FB, _ET, _G, _GC, _MR, _NT],
380
+ [() => TimePeriod$, 64 | 0, () => FilterExpression$, 64 | 0, 0, () => GranularityConfiguration$, 1, 0], 1
381
+ ];
382
+ var GetEstimatedCarbonEmissionsResponse$ = [3, n0, _GECERe,
383
+ 0,
384
+ [_R, _NT],
385
+ [() => EstimatedCarbonEmissionsList, 0], 1
386
+ ];
387
+ var GranularityConfiguration$ = [3, n0, _GC,
388
+ 0,
389
+ [_FYSM],
390
+ [1]
391
+ ];
392
+ var TimePeriod$ = [3, n0, _TP,
393
+ 0,
394
+ [_S, _En],
395
+ [5, 5], 2
396
+ ];
397
+ var DimensionEntryList = [1, n0, _DEL,
398
+ 0, () => DimensionEntry$
399
+ ];
400
+ var EstimatedCarbonEmissionsList = [1, n0, _ECEL,
401
+ 0, () => EstimatedCarbonEmissions$
402
+ ];
403
+ var EmissionsMap = [2, n0, _EM,
404
+ 0, 0, () => Emissions$
405
+ ];
406
+ var GetEstimatedCarbonEmissions$ = [9, n0, _GECE,
407
+ { [_h]: ["POST", "/v1/estimated-carbon-emissions", 200] }, () => GetEstimatedCarbonEmissionsRequest$, () => GetEstimatedCarbonEmissionsResponse$
408
+ ];
409
+ var GetEstimatedCarbonEmissionsDimensionValues$ = [9, n0, _GECEDV,
410
+ { [_h]: ["POST", "/v1/estimated-carbon-emissions-dimension-values", 200] }, () => GetEstimatedCarbonEmissionsDimensionValuesRequest$, () => GetEstimatedCarbonEmissionsDimensionValuesResponse$
411
+ ];
412
+
413
+ const getRuntimeConfig$1 = (config) => {
414
+ return {
415
+ apiVersion: "2018-05-10",
416
+ base64Decoder: config?.base64Decoder ?? fromBase64,
417
+ base64Encoder: config?.base64Encoder ?? toBase64,
418
+ disableHostPrefix: config?.disableHostPrefix ?? false,
419
+ endpointProvider: config?.endpointProvider ?? defaultEndpointResolver,
420
+ extensions: config?.extensions ?? [],
421
+ httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultSustainabilityHttpAuthSchemeProvider,
422
+ httpAuthSchemes: config?.httpAuthSchemes ?? [
423
+ {
424
+ schemeId: "aws.auth#sigv4",
425
+ identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
426
+ signer: new AwsSdkSigV4Signer(),
427
+ },
428
+ {
429
+ schemeId: "aws.auth#sigv4a",
430
+ identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4a"),
431
+ signer: new AwsSdkSigV4ASigner(),
432
+ },
433
+ ],
434
+ logger: config?.logger ?? new NoOpLogger(),
435
+ protocol: config?.protocol ?? AwsRestJsonProtocol,
436
+ protocolSettings: config?.protocolSettings ?? {
437
+ defaultNamespace: "com.amazonaws.sustainability",
438
+ errorTypeRegistries,
439
+ version: "2018-05-10",
440
+ serviceTarget: "AwsSustainabilityApiService",
441
+ },
442
+ serviceId: config?.serviceId ?? "Sustainability",
443
+ signerConstructor: config?.signerConstructor ?? SignatureV4MultiRegion,
444
+ urlParser: config?.urlParser ?? parseUrl,
445
+ utf8Decoder: config?.utf8Decoder ?? fromUtf8,
446
+ utf8Encoder: config?.utf8Encoder ?? toUtf8,
447
+ };
448
+ };
449
+
450
+ const getRuntimeConfig = (config) => {
451
+ emitWarningIfUnsupportedVersion(process.version);
452
+ const defaultsMode = resolveDefaultsModeConfig(config);
453
+ const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
454
+ const clientSharedValues = getRuntimeConfig$1(config);
455
+ emitWarningIfUnsupportedVersion$1(process.version);
456
+ const loaderConfig = {
457
+ profile: config?.profile,
458
+ logger: clientSharedValues.logger,
459
+ };
460
+ return {
461
+ ...clientSharedValues,
462
+ ...config,
463
+ runtime: "node",
464
+ defaultsMode,
465
+ authSchemePreference: config?.authSchemePreference ?? loadConfig(NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
466
+ bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
467
+ credentialDefaultProvider: config?.credentialDefaultProvider ?? defaultProvider,
468
+ defaultUserAgentProvider: config?.defaultUserAgentProvider ?? createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
469
+ maxAttempts: config?.maxAttempts ?? loadConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
470
+ region: config?.region ?? loadConfig(NODE_REGION_CONFIG_OPTIONS, { ...NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
471
+ requestHandler: NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider),
472
+ retryMode: config?.retryMode ??
473
+ loadConfig({
474
+ ...NODE_RETRY_MODE_CONFIG_OPTIONS,
475
+ default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
476
+ }, config),
477
+ sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
478
+ sigv4aSigningRegionSet: config?.sigv4aSigningRegionSet ?? loadConfig(NODE_SIGV4A_CONFIG_OPTIONS, loaderConfig),
479
+ streamCollector: config?.streamCollector ?? streamCollector,
480
+ useDualstackEndpoint: config?.useDualstackEndpoint ?? loadConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
481
+ useFipsEndpoint: config?.useFipsEndpoint ?? loadConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
482
+ userAgentAppId: config?.userAgentAppId ?? loadConfig(NODE_APP_ID_CONFIG_OPTIONS, loaderConfig),
483
+ };
484
+ };
485
+
32
486
  const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
33
487
  const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
34
488
  let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
@@ -175,13 +629,36 @@ const EmissionsUnit = {
175
629
  MT_CO2E: "MTCO2e",
176
630
  };
177
631
 
632
+ exports.AccessDeniedException = AccessDeniedException;
633
+ exports.AccessDeniedException$ = AccessDeniedException$;
178
634
  exports.Dimension = Dimension;
635
+ exports.DimensionEntry$ = DimensionEntry$;
636
+ exports.Emissions$ = Emissions$;
179
637
  exports.EmissionsType = EmissionsType;
180
638
  exports.EmissionsUnit = EmissionsUnit;
639
+ exports.EstimatedCarbonEmissions$ = EstimatedCarbonEmissions$;
640
+ exports.FilterExpression$ = FilterExpression$;
641
+ exports.GetEstimatedCarbonEmissions$ = GetEstimatedCarbonEmissions$;
181
642
  exports.GetEstimatedCarbonEmissionsCommand = GetEstimatedCarbonEmissionsCommand;
643
+ exports.GetEstimatedCarbonEmissionsDimensionValues$ = GetEstimatedCarbonEmissionsDimensionValues$;
182
644
  exports.GetEstimatedCarbonEmissionsDimensionValuesCommand = GetEstimatedCarbonEmissionsDimensionValuesCommand;
645
+ exports.GetEstimatedCarbonEmissionsDimensionValuesRequest$ = GetEstimatedCarbonEmissionsDimensionValuesRequest$;
646
+ exports.GetEstimatedCarbonEmissionsDimensionValuesResponse$ = GetEstimatedCarbonEmissionsDimensionValuesResponse$;
647
+ exports.GetEstimatedCarbonEmissionsRequest$ = GetEstimatedCarbonEmissionsRequest$;
648
+ exports.GetEstimatedCarbonEmissionsResponse$ = GetEstimatedCarbonEmissionsResponse$;
649
+ exports.GranularityConfiguration$ = GranularityConfiguration$;
650
+ exports.InternalServerException = InternalServerException;
651
+ exports.InternalServerException$ = InternalServerException$;
183
652
  exports.Sustainability = Sustainability;
184
653
  exports.SustainabilityClient = SustainabilityClient;
654
+ exports.SustainabilityServiceException = SustainabilityServiceException;
655
+ exports.SustainabilityServiceException$ = SustainabilityServiceException$;
656
+ exports.ThrottlingException = ThrottlingException;
657
+ exports.ThrottlingException$ = ThrottlingException$;
185
658
  exports.TimeGranularity = TimeGranularity;
659
+ exports.TimePeriod$ = TimePeriod$;
660
+ exports.ValidationException = ValidationException;
661
+ exports.ValidationException$ = ValidationException$;
662
+ exports.errorTypeRegistries = errorTypeRegistries;
186
663
  exports.paginateGetEstimatedCarbonEmissions = paginateGetEstimatedCarbonEmissions;
187
664
  exports.paginateGetEstimatedCarbonEmissionsDimensionValues = paginateGetEstimatedCarbonEmissionsDimensionValues;
@@ -14,7 +14,7 @@ export declare const getRuntimeConfig: (config: SustainabilityClientConfig) => {
14
14
  requestHandler: import("@smithy/core/protocols").HttpHandler<any> | RequestHandler;
15
15
  retryMode: string | import("@smithy/types").Provider<string>;
16
16
  sha256: import("@smithy/types").HashConstructor;
17
- streamCollector: import("@smithy/types").StreamCollector;
17
+ streamCollector: (stream: import("stream").Readable | import("stream/web").ReadableStream | ReadableStream | Blob) => Promise<Uint8Array>;
18
18
  useDualstackEndpoint: (boolean | import("@smithy/types").Provider<boolean>) & (boolean | import("@smithy/types").Provider<boolean | undefined>);
19
19
  useFipsEndpoint: (boolean | import("@smithy/types").Provider<boolean>) & (boolean | import("@smithy/types").Provider<boolean | undefined>);
20
20
  cacheMiddleware?: boolean | undefined;
@@ -16,7 +16,7 @@ export declare const getRuntimeConfig: (config: SustainabilityClientConfig) => {
16
16
  retryMode: string | import("@smithy/types").Provider<string>;
17
17
  sha256: import("@smithy/types").HashConstructor;
18
18
  sigv4aSigningRegionSet: string[] | import("@smithy/types").Provider<string[] | undefined>;
19
- streamCollector: import("@smithy/types").StreamCollector;
19
+ streamCollector: (stream: import("stream").Readable | import("stream/web").ReadableStream | ReadableStream | Blob) => Promise<Uint8Array>;
20
20
  useDualstackEndpoint: boolean | import("@smithy/types").Provider<boolean>;
21
21
  useFipsEndpoint: boolean | import("@smithy/types").Provider<boolean>;
22
22
  userAgentAppId: string | import("@smithy/types").Provider<string | undefined>;
@@ -15,7 +15,7 @@ export declare const getRuntimeConfig: (config: SustainabilityClientConfig) => {
15
15
  apiVersion: string;
16
16
  urlParser: import("@smithy/types").UrlParser;
17
17
  bodyLengthChecker: import("@smithy/types").BodyLengthCalculator;
18
- streamCollector: import("@smithy/types").StreamCollector;
18
+ streamCollector: (stream: import("stream").Readable | import("stream/web").ReadableStream | ReadableStream | Blob) => Promise<Uint8Array>;
19
19
  base64Decoder: import("@smithy/types").Decoder;
20
20
  base64Encoder: (_input: Uint8Array | string) => string;
21
21
  utf8Decoder: import("@smithy/types").Decoder;
@@ -21,7 +21,13 @@ export declare const getRuntimeConfig: (config: SustainabilityClientConfig) => {
21
21
  | RequestHandler;
22
22
  retryMode: string | import("@smithy/types").Provider<string>;
23
23
  sha256: import("@smithy/types").HashConstructor;
24
- streamCollector: import("@smithy/types").StreamCollector;
24
+ streamCollector: (
25
+ stream:
26
+ | import("stream").Readable
27
+ | import("stream/web").ReadableStream
28
+ | ReadableStream
29
+ | Blob
30
+ ) => Promise<Uint8Array>;
25
31
  useDualstackEndpoint: (boolean | import("@smithy/types").Provider<boolean>) &
26
32
  (boolean | import("@smithy/types").Provider<boolean | undefined>);
27
33
  useFipsEndpoint: (boolean | import("@smithy/types").Provider<boolean>) &
@@ -25,7 +25,13 @@ export declare const getRuntimeConfig: (config: SustainabilityClientConfig) => {
25
25
  sigv4aSigningRegionSet:
26
26
  | string[]
27
27
  | import("@smithy/types").Provider<string[] | undefined>;
28
- streamCollector: import("@smithy/types").StreamCollector;
28
+ streamCollector: (
29
+ stream:
30
+ | import("stream").Readable
31
+ | import("stream/web").ReadableStream
32
+ | ReadableStream
33
+ | Blob
34
+ ) => Promise<Uint8Array>;
29
35
  useDualstackEndpoint: boolean | import("@smithy/types").Provider<boolean>;
30
36
  useFipsEndpoint: boolean | import("@smithy/types").Provider<boolean>;
31
37
  userAgentAppId: string | import("@smithy/types").Provider<string | undefined>;
@@ -20,7 +20,13 @@ export declare const getRuntimeConfig: (config: SustainabilityClientConfig) => {
20
20
  apiVersion: string;
21
21
  urlParser: import("@smithy/types").UrlParser;
22
22
  bodyLengthChecker: import("@smithy/types").BodyLengthCalculator;
23
- streamCollector: import("@smithy/types").StreamCollector;
23
+ streamCollector: (
24
+ stream:
25
+ | import("stream").Readable
26
+ | import("stream/web").ReadableStream
27
+ | ReadableStream
28
+ | Blob
29
+ ) => Promise<Uint8Array>;
24
30
  base64Decoder: import("@smithy/types").Decoder;
25
31
  base64Encoder: (_input: Uint8Array | string) => string;
26
32
  utf8Decoder: import("@smithy/types").Decoder;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-sustainability",
3
3
  "description": "AWS SDK for JavaScript Sustainability Client for Node.js, Browser and React Native",
4
- "version": "3.1074.0",
4
+ "version": "3.1076.0",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
7
7
  "build:cjs": "node ../../scripts/compilation/inline",
@@ -21,14 +21,14 @@
21
21
  "dependencies": {
22
22
  "@aws-crypto/sha256-browser": "5.2.0",
23
23
  "@aws-crypto/sha256-js": "5.2.0",
24
- "@aws-sdk/core": "^3.974.23",
25
- "@aws-sdk/credential-provider-node": "^3.972.58",
26
- "@aws-sdk/signature-v4-multi-region": "^3.996.35",
27
- "@aws-sdk/types": "^3.973.13",
28
- "@smithy/core": "^3.24.6",
29
- "@smithy/fetch-http-handler": "^5.4.6",
30
- "@smithy/node-http-handler": "^4.7.6",
31
- "@smithy/types": "^4.14.3",
24
+ "@aws-sdk/core": "^3.974.24",
25
+ "@aws-sdk/credential-provider-node": "^3.972.59",
26
+ "@aws-sdk/signature-v4-multi-region": "^3.996.36",
27
+ "@aws-sdk/types": "^3.973.14",
28
+ "@smithy/core": "^3.27.0",
29
+ "@smithy/fetch-http-handler": "^5.6.0",
30
+ "@smithy/node-http-handler": "^4.9.0",
31
+ "@smithy/types": "^4.15.0",
32
32
  "tslib": "^2.6.2"
33
33
  },
34
34
  "devDependencies": {
@@ -1,122 +0,0 @@
1
- const { resolveAwsSdkSigV4AConfig, resolveAwsSdkSigV4Config } = require("@aws-sdk/core/httpAuthSchemes");
2
- const { SignatureV4MultiRegion } = require("@aws-sdk/signature-v4-multi-region");
3
- const { getSmithyContext, normalizeProvider } = require("@smithy/core/client");
4
- const { resolveParams } = require("@smithy/core/endpoints");
5
- const { defaultEndpointResolver } = require("../endpoint/endpointResolver");
6
- const createEndpointRuleSetHttpAuthSchemeParametersProvider = (defaultHttpAuthSchemeParametersProvider) => async (config, context, input) => {
7
- if (!input) {
8
- throw new Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`");
9
- }
10
- const defaultParameters = await defaultHttpAuthSchemeParametersProvider(config, context, input);
11
- const instructionsFn = getSmithyContext(context)?.commandInstance?.constructor
12
- ?.getEndpointParameterInstructions;
13
- if (!instructionsFn) {
14
- throw new Error(`getEndpointParameterInstructions() is not defined on '${context.commandName}'`);
15
- }
16
- const endpointParameters = await resolveParams(input, { getEndpointParameterInstructions: instructionsFn }, config);
17
- return Object.assign(defaultParameters, endpointParameters);
18
- };
19
- const _defaultSustainabilityHttpAuthSchemeParametersProvider = async (config, context, input) => {
20
- return {
21
- operation: getSmithyContext(context).operation,
22
- region: await normalizeProvider(config.region)() || (() => {
23
- throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
24
- })(),
25
- };
26
- };
27
- exports.defaultSustainabilityHttpAuthSchemeParametersProvider = createEndpointRuleSetHttpAuthSchemeParametersProvider(_defaultSustainabilityHttpAuthSchemeParametersProvider);
28
- function createAwsAuthSigv4HttpAuthOption(authParameters) {
29
- return {
30
- schemeId: "aws.auth#sigv4",
31
- signingProperties: {
32
- name: "sustainability",
33
- region: authParameters.region,
34
- },
35
- propertiesExtractor: (config, context) => ({
36
- signingProperties: {
37
- config,
38
- context,
39
- },
40
- }),
41
- };
42
- }
43
- function createAwsAuthSigv4aHttpAuthOption(authParameters) {
44
- return {
45
- schemeId: "aws.auth#sigv4a",
46
- signingProperties: {
47
- name: "sustainability",
48
- region: authParameters.region,
49
- },
50
- propertiesExtractor: (config, context) => ({
51
- signingProperties: {
52
- config,
53
- context,
54
- },
55
- }),
56
- };
57
- }
58
- const createEndpointRuleSetHttpAuthSchemeProvider = (defaultEndpointResolver, defaultHttpAuthSchemeResolver, createHttpAuthOptionFunctions) => {
59
- const endpointRuleSetHttpAuthSchemeProvider = (authParameters) => {
60
- const endpoint = defaultEndpointResolver(authParameters);
61
- const authSchemes = endpoint.properties?.authSchemes;
62
- if (!authSchemes) {
63
- return defaultHttpAuthSchemeResolver(authParameters);
64
- }
65
- const options = [];
66
- for (const scheme of authSchemes) {
67
- const { name: resolvedName, properties = {}, ...rest } = scheme;
68
- const name = resolvedName.toLowerCase();
69
- if (resolvedName !== name) {
70
- console.warn(`HttpAuthScheme has been normalized with lowercasing: '${resolvedName}' to '${name}'`);
71
- }
72
- let schemeId;
73
- if (name === "sigv4a") {
74
- schemeId = "aws.auth#sigv4a";
75
- const sigv4Present = authSchemes.find((s) => {
76
- const name = s.name.toLowerCase();
77
- return name !== "sigv4a" && name.startsWith("sigv4");
78
- });
79
- if (SignatureV4MultiRegion.sigv4aDependency() === "none" && sigv4Present) {
80
- continue;
81
- }
82
- }
83
- else if (name.startsWith("sigv4")) {
84
- schemeId = "aws.auth#sigv4";
85
- }
86
- else {
87
- throw new Error(`Unknown HttpAuthScheme found in '@smithy.rules#endpointRuleSet': '${name}'`);
88
- }
89
- const createOption = createHttpAuthOptionFunctions[schemeId];
90
- if (!createOption) {
91
- throw new Error(`Could not find HttpAuthOption create function for '${schemeId}'`);
92
- }
93
- const option = createOption(authParameters);
94
- option.schemeId = schemeId;
95
- option.signingProperties = { ...(option.signingProperties || {}), ...rest, ...properties };
96
- options.push(option);
97
- }
98
- return options;
99
- };
100
- return endpointRuleSetHttpAuthSchemeProvider;
101
- };
102
- const _defaultSustainabilityHttpAuthSchemeProvider = (authParameters) => {
103
- const options = [];
104
- switch (authParameters.operation) {
105
- default: {
106
- options.push(createAwsAuthSigv4aHttpAuthOption(authParameters));
107
- options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
108
- }
109
- }
110
- return options;
111
- };
112
- exports.defaultSustainabilityHttpAuthSchemeProvider = createEndpointRuleSetHttpAuthSchemeProvider(defaultEndpointResolver, _defaultSustainabilityHttpAuthSchemeProvider, {
113
- "aws.auth#sigv4": createAwsAuthSigv4HttpAuthOption,
114
- "aws.auth#sigv4a": createAwsAuthSigv4aHttpAuthOption,
115
- });
116
- exports.resolveHttpAuthSchemeConfig = (config) => {
117
- const config_0 = resolveAwsSdkSigV4Config(config);
118
- const config_1 = resolveAwsSdkSigV4AConfig(config_0);
119
- return Object.assign(config_1, {
120
- authSchemePreference: normalizeProvider(config.authSchemePreference ?? []),
121
- });
122
- };
@@ -1,38 +0,0 @@
1
- const { BinaryDecisionDiagram } = require("@smithy/core/endpoints");
2
- const k = "ref", l = "authSchemes", m = "name", n = "signingRegion";
3
- const a = "isSet", b = "PartitionResult", c = "stringEquals", d = "sigv4", e = { [k]: "Endpoint" }, f = { "fn": "getAttr", "argv": [{ [k]: b }, "name"] }, g = { [m]: "sigv4a", "signingRegionSet": ["*"] }, h = { [l]: [g, { [m]: d, [n]: "us-gov-west-1" }] }, i = { [l]: [g, { [m]: d, [n]: "{PartitionResult#implicitGlobalRegion}" }] }, j = [{ [k]: "Region" }];
4
- const _data = {
5
- conditions: [
6
- [a, [e]],
7
- [a, j],
8
- ["aws.partition", j, b],
9
- ["booleanEquals", [{ [k]: "UseFIPS" }, true]],
10
- [c, [f, "aws"]],
11
- [c, [f, "aws-us-gov"]]
12
- ],
13
- results: [
14
- [-1],
15
- [-1, "Invalid Configuration: FIPS and custom endpoint are not supported"],
16
- [e, { [l]: [g, { [m]: d }] }],
17
- ["https://api.sustainability.{Region}.{PartitionResult#dualStackDnsSuffix}", { [l]: [g, { [m]: d, [n]: "us-east-1" }] }],
18
- ["https://sustainability.us-gov.{PartitionResult#dualStackDnsSuffix}", h],
19
- ["https://sustainability-fips.us-gov.{PartitionResult#dualStackDnsSuffix}", h],
20
- ["https://sustainability-fips.global.{PartitionResult#dualStackDnsSuffix}", i],
21
- ["https://sustainability.global.{PartitionResult#dualStackDnsSuffix}", i],
22
- [-1, "Invalid Configuration: Missing Region"]
23
- ]
24
- };
25
- const root = 2;
26
- const r = 100_000_000;
27
- const nodes = new Int32Array([
28
- -1, 1, -1,
29
- 0, 9, 3,
30
- 1, 4, r + 8,
31
- 2, 5, r + 8,
32
- 3, 8, 6,
33
- 4, r + 3, 7,
34
- 5, r + 4, r + 7,
35
- 5, r + 5, r + 6,
36
- 3, r + 1, r + 2,
37
- ]);
38
- exports.bdd = BinaryDecisionDiagram.from(nodes, root, _data.conditions, _data.results);
@@ -1,14 +0,0 @@
1
- const { awsEndpointFunctions } = require("@aws-sdk/core/client");
2
- const { customEndpointFunctions, decideEndpoint, EndpointCache } = require("@smithy/core/endpoints");
3
- const { bdd } = require("./bdd");
4
- const cache = new EndpointCache({
5
- size: 50,
6
- params: ["Endpoint", "Region", "UseFIPS"],
7
- });
8
- exports.defaultEndpointResolver = (endpointParams, context = {}) => {
9
- return cache.get(endpointParams, () => decideEndpoint(bdd, {
10
- endpointParams: endpointParams,
11
- logger: context.logger,
12
- }));
13
- };
14
- customEndpointFunctions.aws = awsEndpointFunctions;
@@ -1,8 +0,0 @@
1
- const { ServiceException: __ServiceException } = require("@smithy/core/client");
2
- exports.__ServiceException = __ServiceException;
3
- exports.SustainabilityServiceException = class SustainabilityServiceException extends __ServiceException {
4
- constructor(options) {
5
- super(options);
6
- Object.setPrototypeOf(this, SustainabilityServiceException.prototype);
7
- }
8
- };
@@ -1,59 +0,0 @@
1
- const { SustainabilityServiceException: __BaseException } = require("./SustainabilityServiceException");
2
- exports.AccessDeniedException = class AccessDeniedException extends __BaseException {
3
- name = "AccessDeniedException";
4
- $fault = "client";
5
- Message;
6
- constructor(opts) {
7
- super({
8
- name: "AccessDeniedException",
9
- $fault: "client",
10
- ...opts,
11
- });
12
- Object.setPrototypeOf(this, AccessDeniedException.prototype);
13
- this.Message = opts.Message;
14
- }
15
- };
16
- exports.InternalServerException = class InternalServerException extends __BaseException {
17
- name = "InternalServerException";
18
- $fault = "server";
19
- $retryable = {};
20
- Message;
21
- constructor(opts) {
22
- super({
23
- name: "InternalServerException",
24
- $fault: "server",
25
- ...opts,
26
- });
27
- Object.setPrototypeOf(this, InternalServerException.prototype);
28
- this.Message = opts.Message;
29
- }
30
- };
31
- exports.ThrottlingException = class ThrottlingException extends __BaseException {
32
- name = "ThrottlingException";
33
- $fault = "client";
34
- $retryable = {};
35
- Message;
36
- constructor(opts) {
37
- super({
38
- name: "ThrottlingException",
39
- $fault: "client",
40
- ...opts,
41
- });
42
- Object.setPrototypeOf(this, ThrottlingException.prototype);
43
- this.Message = opts.Message;
44
- }
45
- };
46
- exports.ValidationException = class ValidationException extends __BaseException {
47
- name = "ValidationException";
48
- $fault = "client";
49
- Message;
50
- constructor(opts) {
51
- super({
52
- name: "ValidationException",
53
- $fault: "client",
54
- ...opts,
55
- });
56
- Object.setPrototypeOf(this, ValidationException.prototype);
57
- this.Message = opts.Message;
58
- }
59
- };
@@ -1,32 +0,0 @@
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");
10
- const getRuntimeConfig = (config) => {
11
- const defaultsMode = resolveDefaultsModeConfig(config);
12
- const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
13
- const clientSharedValues = getSharedRuntimeConfig(config);
14
- return {
15
- ...clientSharedValues,
16
- ...config,
17
- runtime: "browser",
18
- defaultsMode,
19
- bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
20
- credentialDefaultProvider: config?.credentialDefaultProvider ?? ((_) => () => Promise.reject(new Error("Credential is missing"))),
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)),
30
- };
31
- };
32
- exports.getRuntimeConfig = getRuntimeConfig;
@@ -1,46 +0,0 @@
1
- const packageInfo = require("../package.json");
2
- const { createDefaultUserAgentProvider, emitWarningIfUnsupportedVersion: awsCheckVersion, NODE_APP_ID_CONFIG_OPTIONS } = require("@aws-sdk/core/client");
3
- const { NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, NODE_SIGV4A_CONFIG_OPTIONS } = require("@aws-sdk/core/httpAuthSchemes");
4
- const { defaultProvider: credentialDefaultProvider } = require("@aws-sdk/credential-provider-node");
5
- const { emitWarningIfUnsupportedVersion, loadConfigsForDefaultMode } = require("@smithy/core/client");
6
- 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");
7
- const { DEFAULT_RETRY_MODE, NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } = require("@smithy/core/retry");
8
- const { calculateBodyLength, Hash } = require("@smithy/core/serde");
9
- const { NodeHttpHandler: RequestHandler, streamCollector } = require("@smithy/node-http-handler");
10
- const { getRuntimeConfig: getSharedRuntimeConfig } = require("./runtimeConfig.shared");
11
- const getRuntimeConfig = (config) => {
12
- emitWarningIfUnsupportedVersion(process.version);
13
- const defaultsMode = resolveDefaultsModeConfig(config);
14
- const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
15
- const clientSharedValues = getSharedRuntimeConfig(config);
16
- awsCheckVersion(process.version);
17
- const loaderConfig = {
18
- profile: config?.profile,
19
- logger: clientSharedValues.logger,
20
- };
21
- return {
22
- ...clientSharedValues,
23
- ...config,
24
- runtime: "node",
25
- defaultsMode,
26
- authSchemePreference: config?.authSchemePreference ?? loadNodeConfig(NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
27
- bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
28
- credentialDefaultProvider: config?.credentialDefaultProvider ?? credentialDefaultProvider,
29
- defaultUserAgentProvider: config?.defaultUserAgentProvider ?? createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
30
- maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
31
- region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, { ...NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
32
- requestHandler: RequestHandler.create(config?.requestHandler ?? defaultConfigProvider),
33
- retryMode: config?.retryMode ??
34
- loadNodeConfig({
35
- ...NODE_RETRY_MODE_CONFIG_OPTIONS,
36
- default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
37
- }, config),
38
- sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
39
- sigv4aSigningRegionSet: config?.sigv4aSigningRegionSet ?? loadNodeConfig(NODE_SIGV4A_CONFIG_OPTIONS, loaderConfig),
40
- streamCollector: config?.streamCollector ?? streamCollector,
41
- useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
42
- useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
43
- userAgentAppId: config?.userAgentAppId ?? loadNodeConfig(NODE_APP_ID_CONFIG_OPTIONS, loaderConfig),
44
- };
45
- };
46
- exports.getRuntimeConfig = getRuntimeConfig;
@@ -1,12 +0,0 @@
1
- const { Sha256 } = require("@aws-crypto/sha256-js");
2
- const { getRuntimeConfig: getBrowserRuntimeConfig } = require("./runtimeConfig.browser");
3
- const getRuntimeConfig = (config) => {
4
- const browserDefaults = getBrowserRuntimeConfig(config);
5
- return {
6
- ...browserDefaults,
7
- ...config,
8
- runtime: "react-native",
9
- sha256: config?.sha256 ?? Sha256,
10
- };
11
- };
12
- exports.getRuntimeConfig = getRuntimeConfig;
@@ -1,45 +0,0 @@
1
- const { AwsSdkSigV4ASigner, AwsSdkSigV4Signer } = require("@aws-sdk/core/httpAuthSchemes");
2
- const { AwsRestJsonProtocol } = require("@aws-sdk/core/protocols");
3
- const { SignatureV4MultiRegion } = require("@aws-sdk/signature-v4-multi-region");
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 { defaultSustainabilityHttpAuthSchemeProvider } = require("./auth/httpAuthSchemeProvider");
8
- const { defaultEndpointResolver } = require("./endpoint/endpointResolver");
9
- const { errorTypeRegistries } = require("./schemas/schemas_0");
10
- exports.getRuntimeConfig = (config) => {
11
- return {
12
- apiVersion: "2018-05-10",
13
- base64Decoder: config?.base64Decoder ?? fromBase64,
14
- base64Encoder: config?.base64Encoder ?? toBase64,
15
- disableHostPrefix: config?.disableHostPrefix ?? false,
16
- endpointProvider: config?.endpointProvider ?? defaultEndpointResolver,
17
- extensions: config?.extensions ?? [],
18
- httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultSustainabilityHttpAuthSchemeProvider,
19
- httpAuthSchemes: config?.httpAuthSchemes ?? [
20
- {
21
- schemeId: "aws.auth#sigv4",
22
- identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
23
- signer: new AwsSdkSigV4Signer(),
24
- },
25
- {
26
- schemeId: "aws.auth#sigv4a",
27
- identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4a"),
28
- signer: new AwsSdkSigV4ASigner(),
29
- },
30
- ],
31
- logger: config?.logger ?? new NoOpLogger(),
32
- protocol: config?.protocol ?? AwsRestJsonProtocol,
33
- protocolSettings: config?.protocolSettings ?? {
34
- defaultNamespace: "com.amazonaws.sustainability",
35
- errorTypeRegistries,
36
- version: "2018-05-10",
37
- serviceTarget: "AwsSustainabilityApiService",
38
- },
39
- serviceId: config?.serviceId ?? "Sustainability",
40
- signerConstructor: config?.signerConstructor ?? SignatureV4MultiRegion,
41
- urlParser: config?.urlParser ?? parseUrl,
42
- utf8Decoder: config?.utf8Decoder ?? fromUtf8,
43
- utf8Encoder: config?.utf8Encoder ?? toUtf8,
44
- };
45
- };
@@ -1,169 +0,0 @@
1
- const _ADE = "AccessDeniedException";
2
- const _D = "Dimension";
3
- const _DE = "DimensionEntry";
4
- const _DEL = "DimensionEntryList";
5
- const _DLM = "DimensionListMap";
6
- const _DV = "DimensionsValues";
7
- const _Di = "Dimensions";
8
- const _E = "Emissions";
9
- const _ECE = "EstimatedCarbonEmissions";
10
- const _ECEL = "EstimatedCarbonEmissionsList";
11
- const _EM = "EmissionsMap";
12
- const _ET = "EmissionsTypes";
13
- const _EV = "EmissionsValues";
14
- const _En = "End";
15
- const _FB = "FilterBy";
16
- const _FE = "FilterExpression";
17
- const _FYSM = "FiscalYearStartMonth";
18
- const _G = "Granularity";
19
- const _GB = "GroupBy";
20
- const _GC = "GranularityConfiguration";
21
- const _GECE = "GetEstimatedCarbonEmissions";
22
- const _GECEDV = "GetEstimatedCarbonEmissionsDimensionValues";
23
- const _GECEDVR = "GetEstimatedCarbonEmissionsDimensionValuesRequest";
24
- const _GECEDVRe = "GetEstimatedCarbonEmissionsDimensionValuesResponse";
25
- const _GECER = "GetEstimatedCarbonEmissionsRequest";
26
- const _GECERe = "GetEstimatedCarbonEmissionsResponse";
27
- const _ISE = "InternalServerException";
28
- const _M = "Message";
29
- const _MR = "MaxResults";
30
- const _MV = "ModelVersion";
31
- const _NT = "NextToken";
32
- const _R = "Results";
33
- const _S = "Start";
34
- const _TE = "ThrottlingException";
35
- const _TP = "TimePeriod";
36
- const _U = "Unit";
37
- const _V = "Value";
38
- const _VE = "ValidationException";
39
- const _c = "client";
40
- const _e = "error";
41
- const _h = "http";
42
- const _hE = "httpError";
43
- const _jN = "jsonName";
44
- const _m = "message";
45
- const _s = "smithy.ts.sdk.synthetic.com.amazonaws.sustainability";
46
- const _se = "server";
47
- const n0 = "com.amazonaws.sustainability";
48
- const { TypeRegistry } = require("@smithy/core/schema");
49
- const { AccessDeniedException, InternalServerException, ThrottlingException, ValidationException } = require("../models/errors");
50
- const { SustainabilityServiceException } = require("../models/SustainabilityServiceException");
51
- const _s_registry = TypeRegistry.for(_s);
52
- const SustainabilityServiceException$ = [-3, _s, "SustainabilityServiceException", 0, [], []];
53
- exports.SustainabilityServiceException$ = SustainabilityServiceException$;
54
- _s_registry.registerError(SustainabilityServiceException$, SustainabilityServiceException);
55
- const n0_registry = TypeRegistry.for(n0);
56
- const AccessDeniedException$ = [-3, n0, _ADE,
57
- { [_e]: _c, [_hE]: 403 },
58
- [_M],
59
- [[0, { [_jN]: _m }]], 1
60
- ];
61
- exports.AccessDeniedException$ = AccessDeniedException$;
62
- n0_registry.registerError(AccessDeniedException$, AccessDeniedException);
63
- const InternalServerException$ = [-3, n0, _ISE,
64
- { [_e]: _se, [_hE]: 500 },
65
- [_M],
66
- [[0, { [_jN]: _m }]], 1
67
- ];
68
- exports.InternalServerException$ = InternalServerException$;
69
- n0_registry.registerError(InternalServerException$, InternalServerException);
70
- const ThrottlingException$ = [-3, n0, _TE,
71
- { [_e]: _c, [_hE]: 429 },
72
- [_M],
73
- [[0, { [_jN]: _m }]], 1
74
- ];
75
- exports.ThrottlingException$ = ThrottlingException$;
76
- n0_registry.registerError(ThrottlingException$, ThrottlingException);
77
- const ValidationException$ = [-3, n0, _VE,
78
- { [_e]: _c, [_hE]: 400 },
79
- [_M],
80
- [[0, { [_jN]: _m }]], 1
81
- ];
82
- exports.ValidationException$ = ValidationException$;
83
- n0_registry.registerError(ValidationException$, ValidationException);
84
- exports.errorTypeRegistries = [
85
- _s_registry,
86
- n0_registry,
87
- ];
88
- const DimensionEntry$ = [3, n0, _DE,
89
- 0,
90
- [_D, _V],
91
- [0, 0], 2
92
- ];
93
- exports.DimensionEntry$ = DimensionEntry$;
94
- const Emissions$ = [3, n0, _E,
95
- 0,
96
- [_V, _U],
97
- [1, 0], 2
98
- ];
99
- exports.Emissions$ = Emissions$;
100
- const EstimatedCarbonEmissions$ = [3, n0, _ECE,
101
- 0,
102
- [_TP, _DV, _MV, _EV],
103
- [() => TimePeriod$, 128 | 0, 0, () => EmissionsMap], 4
104
- ];
105
- exports.EstimatedCarbonEmissions$ = EstimatedCarbonEmissions$;
106
- const FilterExpression$ = [3, n0, _FE,
107
- 0,
108
- [_Di],
109
- [[2, n0, _DLM, 0, 0, 64 | 0]]
110
- ];
111
- exports.FilterExpression$ = FilterExpression$;
112
- const GetEstimatedCarbonEmissionsDimensionValuesRequest$ = [3, n0, _GECEDVR,
113
- 0,
114
- [_TP, _Di, _MR, _NT],
115
- [() => TimePeriod$, 64 | 0, 1, 0], 2
116
- ];
117
- exports.GetEstimatedCarbonEmissionsDimensionValuesRequest$ = GetEstimatedCarbonEmissionsDimensionValuesRequest$;
118
- const GetEstimatedCarbonEmissionsDimensionValuesResponse$ = [3, n0, _GECEDVRe,
119
- 0,
120
- [_R, _NT],
121
- [() => DimensionEntryList, 0]
122
- ];
123
- exports.GetEstimatedCarbonEmissionsDimensionValuesResponse$ = GetEstimatedCarbonEmissionsDimensionValuesResponse$;
124
- const GetEstimatedCarbonEmissionsRequest$ = [3, n0, _GECER,
125
- 0,
126
- [_TP, _GB, _FB, _ET, _G, _GC, _MR, _NT],
127
- [() => TimePeriod$, 64 | 0, () => FilterExpression$, 64 | 0, 0, () => GranularityConfiguration$, 1, 0], 1
128
- ];
129
- exports.GetEstimatedCarbonEmissionsRequest$ = GetEstimatedCarbonEmissionsRequest$;
130
- const GetEstimatedCarbonEmissionsResponse$ = [3, n0, _GECERe,
131
- 0,
132
- [_R, _NT],
133
- [() => EstimatedCarbonEmissionsList, 0], 1
134
- ];
135
- exports.GetEstimatedCarbonEmissionsResponse$ = GetEstimatedCarbonEmissionsResponse$;
136
- const GranularityConfiguration$ = [3, n0, _GC,
137
- 0,
138
- [_FYSM],
139
- [1]
140
- ];
141
- exports.GranularityConfiguration$ = GranularityConfiguration$;
142
- const TimePeriod$ = [3, n0, _TP,
143
- 0,
144
- [_S, _En],
145
- [5, 5], 2
146
- ];
147
- exports.TimePeriod$ = TimePeriod$;
148
- var DimensionEntryList = [1, n0, _DEL,
149
- 0, () => DimensionEntry$
150
- ];
151
- var DimensionList = 64 | 0;
152
- var DimensionValueList = 64 | 0;
153
- var EmissionsTypeList = 64 | 0;
154
- var EstimatedCarbonEmissionsList = [1, n0, _ECEL,
155
- 0, () => EstimatedCarbonEmissions$
156
- ];
157
- var DimensionListMap = [2, n0, _DLM,
158
- 0, 0, 64 | 0
159
- ];
160
- var DimensionsMap = 128 | 0;
161
- var EmissionsMap = [2, n0, _EM,
162
- 0, 0, () => Emissions$
163
- ];
164
- exports.GetEstimatedCarbonEmissions$ = [9, n0, _GECE,
165
- { [_h]: ["POST", "/v1/estimated-carbon-emissions", 200] }, () => GetEstimatedCarbonEmissionsRequest$, () => GetEstimatedCarbonEmissionsResponse$
166
- ];
167
- exports.GetEstimatedCarbonEmissionsDimensionValues$ = [9, n0, _GECEDV,
168
- { [_h]: ["POST", "/v1/estimated-carbon-emissions-dimension-values", 200] }, () => GetEstimatedCarbonEmissionsDimensionValuesRequest$, () => GetEstimatedCarbonEmissionsDimensionValuesResponse$
169
- ];