@aws-sdk/client-sustainability 3.1021.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.
Files changed (92) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +195 -0
  3. package/dist-cjs/auth/httpAuthSchemeProvider.js +126 -0
  4. package/dist-cjs/endpoint/endpointResolver.js +18 -0
  5. package/dist-cjs/endpoint/ruleset.js +7 -0
  6. package/dist-cjs/index.js +212 -0
  7. package/dist-cjs/models/SustainabilityServiceException.js +12 -0
  8. package/dist-cjs/models/errors.js +66 -0
  9. package/dist-cjs/runtimeConfig.browser.js +38 -0
  10. package/dist-cjs/runtimeConfig.js +55 -0
  11. package/dist-cjs/runtimeConfig.native.js +15 -0
  12. package/dist-cjs/runtimeConfig.shared.js +50 -0
  13. package/dist-cjs/schemas/schemas_0.js +157 -0
  14. package/dist-es/Sustainability.js +17 -0
  15. package/dist-es/SustainabilityClient.js +51 -0
  16. package/dist-es/auth/httpAuthExtensionConfiguration.js +38 -0
  17. package/dist-es/auth/httpAuthSchemeProvider.js +122 -0
  18. package/dist-es/commands/GetEstimatedCarbonEmissionsCommand.js +16 -0
  19. package/dist-es/commands/GetEstimatedCarbonEmissionsDimensionValuesCommand.js +16 -0
  20. package/dist-es/commands/index.js +2 -0
  21. package/dist-es/endpoint/EndpointParameters.js +11 -0
  22. package/dist-es/endpoint/endpointResolver.js +14 -0
  23. package/dist-es/endpoint/ruleset.js +4 -0
  24. package/dist-es/extensionConfiguration.js +1 -0
  25. package/dist-es/index.js +9 -0
  26. package/dist-es/models/SustainabilityServiceException.js +8 -0
  27. package/dist-es/models/enums.js +24 -0
  28. package/dist-es/models/errors.js +59 -0
  29. package/dist-es/models/models_0.js +1 -0
  30. package/dist-es/pagination/GetEstimatedCarbonEmissionsDimensionValuesPaginator.js +4 -0
  31. package/dist-es/pagination/GetEstimatedCarbonEmissionsPaginator.js +4 -0
  32. package/dist-es/pagination/Interfaces.js +1 -0
  33. package/dist-es/pagination/index.js +3 -0
  34. package/dist-es/runtimeConfig.browser.js +33 -0
  35. package/dist-es/runtimeConfig.js +50 -0
  36. package/dist-es/runtimeConfig.native.js +11 -0
  37. package/dist-es/runtimeConfig.shared.js +46 -0
  38. package/dist-es/runtimeExtensions.js +9 -0
  39. package/dist-es/schemas/schemas_0.js +154 -0
  40. package/dist-types/Sustainability.d.ts +38 -0
  41. package/dist-types/SustainabilityClient.d.ts +189 -0
  42. package/dist-types/auth/httpAuthExtensionConfiguration.d.ts +29 -0
  43. package/dist-types/auth/httpAuthSchemeProvider.d.ts +83 -0
  44. package/dist-types/commands/GetEstimatedCarbonEmissionsCommand.d.ts +198 -0
  45. package/dist-types/commands/GetEstimatedCarbonEmissionsDimensionValuesCommand.d.ts +152 -0
  46. package/dist-types/commands/index.d.ts +2 -0
  47. package/dist-types/endpoint/EndpointParameters.d.ts +44 -0
  48. package/dist-types/endpoint/endpointResolver.d.ts +8 -0
  49. package/dist-types/endpoint/ruleset.d.ts +2 -0
  50. package/dist-types/extensionConfiguration.d.ts +9 -0
  51. package/dist-types/index.d.ts +17 -0
  52. package/dist-types/models/SustainabilityServiceException.d.ts +14 -0
  53. package/dist-types/models/enums.d.ts +104 -0
  54. package/dist-types/models/errors.d.ts +56 -0
  55. package/dist-types/models/models_0.d.ts +197 -0
  56. package/dist-types/pagination/GetEstimatedCarbonEmissionsDimensionValuesPaginator.d.ts +7 -0
  57. package/dist-types/pagination/GetEstimatedCarbonEmissionsPaginator.d.ts +7 -0
  58. package/dist-types/pagination/Interfaces.d.ts +8 -0
  59. package/dist-types/pagination/index.d.ts +3 -0
  60. package/dist-types/runtimeConfig.browser.d.ts +56 -0
  61. package/dist-types/runtimeConfig.d.ts +56 -0
  62. package/dist-types/runtimeConfig.native.d.ts +55 -0
  63. package/dist-types/runtimeConfig.shared.d.ts +29 -0
  64. package/dist-types/runtimeExtensions.d.ts +17 -0
  65. package/dist-types/schemas/schemas_0.d.ts +25 -0
  66. package/dist-types/ts3.4/Sustainability.d.ts +65 -0
  67. package/dist-types/ts3.4/SustainabilityClient.d.ts +131 -0
  68. package/dist-types/ts3.4/auth/httpAuthExtensionConfiguration.d.ts +32 -0
  69. package/dist-types/ts3.4/auth/httpAuthSchemeProvider.d.ts +59 -0
  70. package/dist-types/ts3.4/commands/GetEstimatedCarbonEmissionsCommand.d.ts +51 -0
  71. package/dist-types/ts3.4/commands/GetEstimatedCarbonEmissionsDimensionValuesCommand.d.ts +51 -0
  72. package/dist-types/ts3.4/commands/index.d.ts +2 -0
  73. package/dist-types/ts3.4/endpoint/EndpointParameters.d.ts +45 -0
  74. package/dist-types/ts3.4/endpoint/endpointResolver.d.ts +8 -0
  75. package/dist-types/ts3.4/endpoint/ruleset.d.ts +2 -0
  76. package/dist-types/ts3.4/extensionConfiguration.d.ts +9 -0
  77. package/dist-types/ts3.4/index.d.ts +12 -0
  78. package/dist-types/ts3.4/models/SustainabilityServiceException.d.ts +9 -0
  79. package/dist-types/ts3.4/models/enums.d.ts +29 -0
  80. package/dist-types/ts3.4/models/errors.d.ts +36 -0
  81. package/dist-types/ts3.4/models/models_0.d.ts +54 -0
  82. package/dist-types/ts3.4/pagination/GetEstimatedCarbonEmissionsDimensionValuesPaginator.d.ts +11 -0
  83. package/dist-types/ts3.4/pagination/GetEstimatedCarbonEmissionsPaginator.d.ts +11 -0
  84. package/dist-types/ts3.4/pagination/Interfaces.d.ts +6 -0
  85. package/dist-types/ts3.4/pagination/index.d.ts +3 -0
  86. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +106 -0
  87. package/dist-types/ts3.4/runtimeConfig.d.ts +100 -0
  88. package/dist-types/ts3.4/runtimeConfig.native.d.ts +110 -0
  89. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +37 -0
  90. package/dist-types/ts3.4/runtimeExtensions.d.ts +11 -0
  91. package/dist-types/ts3.4/schemas/schemas_0.d.ts +24 -0
  92. package/package.json +101 -0
@@ -0,0 +1,51 @@
1
+ import { getHostHeaderPlugin, resolveHostHeaderConfig, } from "@aws-sdk/middleware-host-header";
2
+ import { getLoggerPlugin } from "@aws-sdk/middleware-logger";
3
+ import { getRecursionDetectionPlugin } from "@aws-sdk/middleware-recursion-detection";
4
+ import { getUserAgentPlugin, resolveUserAgentConfig, } from "@aws-sdk/middleware-user-agent";
5
+ import { resolveRegionConfig } from "@smithy/config-resolver";
6
+ import { DefaultIdentityProviderConfig, getHttpAuthSchemeEndpointRuleSetPlugin, getHttpSigningPlugin, } from "@smithy/core";
7
+ import { getSchemaSerdePlugin } from "@smithy/core/schema";
8
+ import { getContentLengthPlugin } from "@smithy/middleware-content-length";
9
+ import { resolveEndpointConfig, } from "@smithy/middleware-endpoint";
10
+ import { getRetryPlugin, resolveRetryConfig, } from "@smithy/middleware-retry";
11
+ import { Client as __Client, } from "@smithy/smithy-client";
12
+ import { defaultSustainabilityHttpAuthSchemeParametersProvider, resolveHttpAuthSchemeConfig, } from "./auth/httpAuthSchemeProvider";
13
+ import { resolveClientEndpointParameters, } from "./endpoint/EndpointParameters";
14
+ import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
15
+ import { resolveRuntimeExtensions } from "./runtimeExtensions";
16
+ export { __Client };
17
+ export class SustainabilityClient extends __Client {
18
+ config;
19
+ constructor(...[configuration]) {
20
+ const _config_0 = __getRuntimeConfig(configuration || {});
21
+ super(_config_0);
22
+ this.initConfig = _config_0;
23
+ const _config_1 = resolveClientEndpointParameters(_config_0);
24
+ const _config_2 = resolveUserAgentConfig(_config_1);
25
+ const _config_3 = resolveRetryConfig(_config_2);
26
+ const _config_4 = resolveRegionConfig(_config_3);
27
+ const _config_5 = resolveHostHeaderConfig(_config_4);
28
+ const _config_6 = resolveEndpointConfig(_config_5);
29
+ const _config_7 = resolveHttpAuthSchemeConfig(_config_6);
30
+ const _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []);
31
+ this.config = _config_8;
32
+ this.middlewareStack.use(getSchemaSerdePlugin(this.config));
33
+ this.middlewareStack.use(getUserAgentPlugin(this.config));
34
+ this.middlewareStack.use(getRetryPlugin(this.config));
35
+ this.middlewareStack.use(getContentLengthPlugin(this.config));
36
+ this.middlewareStack.use(getHostHeaderPlugin(this.config));
37
+ this.middlewareStack.use(getLoggerPlugin(this.config));
38
+ this.middlewareStack.use(getRecursionDetectionPlugin(this.config));
39
+ this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin(this.config, {
40
+ httpAuthSchemeParametersProvider: defaultSustainabilityHttpAuthSchemeParametersProvider,
41
+ identityProviderConfigProvider: async (config) => new DefaultIdentityProviderConfig({
42
+ "aws.auth#sigv4": config.credentials,
43
+ "aws.auth#sigv4a": config.credentials,
44
+ }),
45
+ }));
46
+ this.middlewareStack.use(getHttpSigningPlugin(this.config));
47
+ }
48
+ destroy() {
49
+ super.destroy();
50
+ }
51
+ }
@@ -0,0 +1,38 @@
1
+ export const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
2
+ const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
3
+ let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
4
+ let _credentials = runtimeConfig.credentials;
5
+ return {
6
+ setHttpAuthScheme(httpAuthScheme) {
7
+ const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
8
+ if (index === -1) {
9
+ _httpAuthSchemes.push(httpAuthScheme);
10
+ }
11
+ else {
12
+ _httpAuthSchemes.splice(index, 1, httpAuthScheme);
13
+ }
14
+ },
15
+ httpAuthSchemes() {
16
+ return _httpAuthSchemes;
17
+ },
18
+ setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
19
+ _httpAuthSchemeProvider = httpAuthSchemeProvider;
20
+ },
21
+ httpAuthSchemeProvider() {
22
+ return _httpAuthSchemeProvider;
23
+ },
24
+ setCredentials(credentials) {
25
+ _credentials = credentials;
26
+ },
27
+ credentials() {
28
+ return _credentials;
29
+ },
30
+ };
31
+ };
32
+ export const resolveHttpAuthRuntimeConfig = (config) => {
33
+ return {
34
+ httpAuthSchemes: config.httpAuthSchemes(),
35
+ httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
36
+ credentials: config.credentials(),
37
+ };
38
+ };
@@ -0,0 +1,122 @@
1
+ import { resolveAwsSdkSigV4AConfig, resolveAwsSdkSigV4Config, } from "@aws-sdk/core/httpAuthSchemes";
2
+ import { SignatureV4MultiRegion } from "@aws-sdk/signature-v4-multi-region";
3
+ import { resolveParams } from "@smithy/middleware-endpoint";
4
+ import { getSmithyContext, normalizeProvider } from "@smithy/util-middleware";
5
+ import { defaultEndpointResolver } from "../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
+ export const 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
+ export const defaultSustainabilityHttpAuthSchemeProvider = createEndpointRuleSetHttpAuthSchemeProvider(defaultEndpointResolver, _defaultSustainabilityHttpAuthSchemeProvider, {
113
+ "aws.auth#sigv4": createAwsAuthSigv4HttpAuthOption,
114
+ "aws.auth#sigv4a": createAwsAuthSigv4aHttpAuthOption,
115
+ });
116
+ export const 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
+ };
@@ -0,0 +1,16 @@
1
+ import { getEndpointPlugin } from "@smithy/middleware-endpoint";
2
+ import { Command as $Command } from "@smithy/smithy-client";
3
+ import { commonParams } from "../endpoint/EndpointParameters";
4
+ import { GetEstimatedCarbonEmissions$ } from "../schemas/schemas_0";
5
+ export { $Command };
6
+ export class GetEstimatedCarbonEmissionsCommand extends $Command
7
+ .classBuilder()
8
+ .ep(commonParams)
9
+ .m(function (Command, cs, config, o) {
10
+ return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
11
+ })
12
+ .s("AwsSustainabilityApiService", "GetEstimatedCarbonEmissions", {})
13
+ .n("SustainabilityClient", "GetEstimatedCarbonEmissionsCommand")
14
+ .sc(GetEstimatedCarbonEmissions$)
15
+ .build() {
16
+ }
@@ -0,0 +1,16 @@
1
+ import { getEndpointPlugin } from "@smithy/middleware-endpoint";
2
+ import { Command as $Command } from "@smithy/smithy-client";
3
+ import { commonParams } from "../endpoint/EndpointParameters";
4
+ import { GetEstimatedCarbonEmissionsDimensionValues$ } from "../schemas/schemas_0";
5
+ export { $Command };
6
+ export class GetEstimatedCarbonEmissionsDimensionValuesCommand extends $Command
7
+ .classBuilder()
8
+ .ep(commonParams)
9
+ .m(function (Command, cs, config, o) {
10
+ return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
11
+ })
12
+ .s("AwsSustainabilityApiService", "GetEstimatedCarbonEmissionsDimensionValues", {})
13
+ .n("SustainabilityClient", "GetEstimatedCarbonEmissionsDimensionValuesCommand")
14
+ .sc(GetEstimatedCarbonEmissionsDimensionValues$)
15
+ .build() {
16
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./GetEstimatedCarbonEmissionsCommand";
2
+ export * from "./GetEstimatedCarbonEmissionsDimensionValuesCommand";
@@ -0,0 +1,11 @@
1
+ export const resolveClientEndpointParameters = (options) => {
2
+ return Object.assign(options, {
3
+ useFipsEndpoint: options.useFipsEndpoint ?? false,
4
+ defaultSigningName: "sustainability",
5
+ });
6
+ };
7
+ export const commonParams = {
8
+ UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
9
+ Endpoint: { type: "builtInParams", name: "endpoint" },
10
+ Region: { type: "builtInParams", name: "region" },
11
+ };
@@ -0,0 +1,14 @@
1
+ import { awsEndpointFunctions } from "@aws-sdk/util-endpoints";
2
+ import { customEndpointFunctions, EndpointCache, resolveEndpoint } from "@smithy/util-endpoints";
3
+ import { ruleSet } from "./ruleset";
4
+ const cache = new EndpointCache({
5
+ size: 50,
6
+ params: ["Endpoint", "Region", "UseFIPS"],
7
+ });
8
+ export const defaultEndpointResolver = (endpointParams, context = {}) => {
9
+ return cache.get(endpointParams, () => resolveEndpoint(ruleSet, {
10
+ endpointParams: endpointParams,
11
+ logger: context.logger,
12
+ }));
13
+ };
14
+ customEndpointFunctions.aws = awsEndpointFunctions;
@@ -0,0 +1,4 @@
1
+ const v = "argv", w = "ref", x = "authSchemes", y = "name", z = "signingRegion";
2
+ const a = true, b = false, c = "isSet", d = "error", e = "sigv4", f = "endpoint", g = "tree", h = "PartitionResult", i = "stringEquals", j = { "required": false, "type": "string" }, k = { [w]: "Endpoint" }, l = { "fn": "booleanEquals", [v]: [{ [w]: "UseFIPS" }, true] }, m = { [y]: "sigv4a", "signingRegionSet": ["*"] }, n = {}, o = { "fn": "getAttr", [v]: [{ [w]: h }, "name"] }, p = { "fn": "booleanEquals", [v]: [{ [w]: "UseFIPS" }, false] }, q = { "fn": i, [v]: [o, "aws-us-gov"] }, r = { [x]: [m, { [y]: e, [z]: "us-gov-west-1" }] }, s = { [x]: [m, { [y]: e, [z]: "{PartitionResult#implicitGlobalRegion}" }] }, t = [l], u = [{ [w]: "Region" }];
3
+ const _data = { version: "1.0", parameters: { UseFIPS: { required: a, default: b, type: "boolean" }, Endpoint: j, Region: j }, rules: [{ conditions: [{ fn: c, [v]: [k] }], rules: [{ conditions: t, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: d }, { endpoint: { url: k, properties: { [x]: [m, { [y]: e }] }, headers: n }, type: f }], type: g }, { rules: [{ conditions: [{ fn: c, [v]: u }], rules: [{ conditions: [{ fn: "aws.partition", [v]: u, assign: h }], rules: [{ conditions: [{ fn: i, [v]: [o, "aws"] }, p], endpoint: { url: "https://api.sustainability.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: { [x]: [m, { [y]: e, [z]: "us-east-1" }] }, headers: n }, type: f }, { conditions: [q, p], endpoint: { url: "https://sustainability.us-gov.{PartitionResult#dualStackDnsSuffix}", properties: r, headers: n }, type: f }, { conditions: [q, l], endpoint: { url: "https://sustainability-fips.us-gov.{PartitionResult#dualStackDnsSuffix}", properties: r, headers: n }, type: f }, { conditions: t, endpoint: { url: "https://sustainability-fips.global.{PartitionResult#dualStackDnsSuffix}", properties: s, headers: n }, type: f }, { endpoint: { url: "https://sustainability.global.{PartitionResult#dualStackDnsSuffix}", properties: s, headers: n }, type: f }], type: g }], type: g }, { error: "Invalid Configuration: Missing Region", type: d }], type: g }] };
4
+ export const ruleSet = _data;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ export * from "./SustainabilityClient";
2
+ export * from "./Sustainability";
3
+ export * from "./commands";
4
+ export * from "./schemas/schemas_0";
5
+ export * from "./pagination";
6
+ export * from "./models/enums";
7
+ export * from "./models/errors";
8
+ export * from "./models/models_0";
9
+ export { SustainabilityServiceException } from "./models/SustainabilityServiceException";
@@ -0,0 +1,8 @@
1
+ import { ServiceException as __ServiceException, } from "@smithy/smithy-client";
2
+ export { __ServiceException };
3
+ export class SustainabilityServiceException extends __ServiceException {
4
+ constructor(options) {
5
+ super(options);
6
+ Object.setPrototypeOf(this, SustainabilityServiceException.prototype);
7
+ }
8
+ }
@@ -0,0 +1,24 @@
1
+ export const EmissionsType = {
2
+ TOTAL_LBM_CARBON_EMISSIONS: "TOTAL_LBM_CARBON_EMISSIONS",
3
+ TOTAL_MBM_CARBON_EMISSIONS: "TOTAL_MBM_CARBON_EMISSIONS",
4
+ TOTAL_SCOPE_1_CARBON_EMISSIONS: "TOTAL_SCOPE_1_CARBON_EMISSIONS",
5
+ TOTAL_SCOPE_2_LBM_CARBON_EMISSIONS: "TOTAL_SCOPE_2_LBM_CARBON_EMISSIONS",
6
+ TOTAL_SCOPE_2_MBM_CARBON_EMISSIONS: "TOTAL_SCOPE_2_MBM_CARBON_EMISSIONS",
7
+ TOTAL_SCOPE_3_LBM_CARBON_EMISSIONS: "TOTAL_SCOPE_3_LBM_CARBON_EMISSIONS",
8
+ TOTAL_SCOPE_3_MBM_CARBON_EMISSIONS: "TOTAL_SCOPE_3_MBM_CARBON_EMISSIONS",
9
+ };
10
+ export const Dimension = {
11
+ REGION: "REGION",
12
+ SERVICE: "SERVICE",
13
+ USAGE_ACCOUNT_ID: "USAGE_ACCOUNT_ID",
14
+ };
15
+ export const TimeGranularity = {
16
+ MONTHLY: "MONTHLY",
17
+ QUARTERLY_CALENDAR: "QUARTERLY_CALENDAR",
18
+ QUARTERLY_FISCAL: "QUARTERLY_FISCAL",
19
+ YEARLY_CALENDAR: "YEARLY_CALENDAR",
20
+ YEARLY_FISCAL: "YEARLY_FISCAL",
21
+ };
22
+ export const EmissionsUnit = {
23
+ MT_CO2E: "MTCO2e",
24
+ };
@@ -0,0 +1,59 @@
1
+ import { SustainabilityServiceException as __BaseException } from "./SustainabilityServiceException";
2
+ export 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
+ export 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
+ export 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
+ export 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
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import { createPaginator } from "@smithy/core";
2
+ import { GetEstimatedCarbonEmissionsDimensionValuesCommand, } from "../commands/GetEstimatedCarbonEmissionsDimensionValuesCommand";
3
+ import { SustainabilityClient } from "../SustainabilityClient";
4
+ export const paginateGetEstimatedCarbonEmissionsDimensionValues = createPaginator(SustainabilityClient, GetEstimatedCarbonEmissionsDimensionValuesCommand, "NextToken", "NextToken", "MaxResults");
@@ -0,0 +1,4 @@
1
+ import { createPaginator } from "@smithy/core";
2
+ import { GetEstimatedCarbonEmissionsCommand, } from "../commands/GetEstimatedCarbonEmissionsCommand";
3
+ import { SustainabilityClient } from "../SustainabilityClient";
4
+ export const paginateGetEstimatedCarbonEmissions = createPaginator(SustainabilityClient, GetEstimatedCarbonEmissionsCommand, "NextToken", "NextToken", "MaxResults");
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from "./Interfaces";
2
+ export * from "./GetEstimatedCarbonEmissionsPaginator";
3
+ export * from "./GetEstimatedCarbonEmissionsDimensionValuesPaginator";
@@ -0,0 +1,33 @@
1
+ import packageInfo from "../package.json";
2
+ import { Sha256 } from "@aws-crypto/sha256-browser";
3
+ import { createDefaultUserAgentProvider } from "@aws-sdk/util-user-agent-browser";
4
+ import { DEFAULT_USE_DUALSTACK_ENDPOINT, DEFAULT_USE_FIPS_ENDPOINT } from "@smithy/config-resolver";
5
+ import { FetchHttpHandler as RequestHandler, streamCollector } from "@smithy/fetch-http-handler";
6
+ import { invalidProvider } from "@smithy/invalid-dependency";
7
+ import { loadConfigsForDefaultMode } from "@smithy/smithy-client";
8
+ import { calculateBodyLength } from "@smithy/util-body-length-browser";
9
+ import { resolveDefaultsModeConfig } from "@smithy/util-defaults-mode-browser";
10
+ import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@smithy/util-retry";
11
+ import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
12
+ export const getRuntimeConfig = (config) => {
13
+ const defaultsMode = resolveDefaultsModeConfig(config);
14
+ const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
15
+ const clientSharedValues = getSharedRuntimeConfig(config);
16
+ return {
17
+ ...clientSharedValues,
18
+ ...config,
19
+ runtime: "browser",
20
+ defaultsMode,
21
+ bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
22
+ credentialDefaultProvider: config?.credentialDefaultProvider ?? ((_) => () => Promise.reject(new Error("Credential is missing"))),
23
+ defaultUserAgentProvider: config?.defaultUserAgentProvider ?? createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
24
+ maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
25
+ region: config?.region ?? invalidProvider("Region is missing"),
26
+ requestHandler: RequestHandler.create(config?.requestHandler ?? defaultConfigProvider),
27
+ retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE),
28
+ sha256: config?.sha256 ?? Sha256,
29
+ streamCollector: config?.streamCollector ?? streamCollector,
30
+ useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)),
31
+ useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT)),
32
+ };
33
+ };
@@ -0,0 +1,50 @@
1
+ import packageInfo from "../package.json";
2
+ import { emitWarningIfUnsupportedVersion as awsCheckVersion } from "@aws-sdk/core/client";
3
+ import { NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, NODE_SIGV4A_CONFIG_OPTIONS } from "@aws-sdk/core/httpAuthSchemes";
4
+ import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node";
5
+ import { createDefaultUserAgentProvider, NODE_APP_ID_CONFIG_OPTIONS } from "@aws-sdk/util-user-agent-node";
6
+ import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS, NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, } from "@smithy/config-resolver";
7
+ import { Hash } from "@smithy/hash-node";
8
+ import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@smithy/middleware-retry";
9
+ import { loadConfig as loadNodeConfig } from "@smithy/node-config-provider";
10
+ import { NodeHttpHandler as RequestHandler, streamCollector } from "@smithy/node-http-handler";
11
+ import { emitWarningIfUnsupportedVersion, loadConfigsForDefaultMode } from "@smithy/smithy-client";
12
+ import { calculateBodyLength } from "@smithy/util-body-length-node";
13
+ import { resolveDefaultsModeConfig } from "@smithy/util-defaults-mode-node";
14
+ import { DEFAULT_RETRY_MODE } from "@smithy/util-retry";
15
+ import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
16
+ export const getRuntimeConfig = (config) => {
17
+ emitWarningIfUnsupportedVersion(process.version);
18
+ const defaultsMode = resolveDefaultsModeConfig(config);
19
+ const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
20
+ const clientSharedValues = getSharedRuntimeConfig(config);
21
+ awsCheckVersion(process.version);
22
+ const loaderConfig = {
23
+ profile: config?.profile,
24
+ logger: clientSharedValues.logger,
25
+ };
26
+ return {
27
+ ...clientSharedValues,
28
+ ...config,
29
+ runtime: "node",
30
+ defaultsMode,
31
+ authSchemePreference: config?.authSchemePreference ?? loadNodeConfig(NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
32
+ bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
33
+ credentialDefaultProvider: config?.credentialDefaultProvider ?? credentialDefaultProvider,
34
+ defaultUserAgentProvider: config?.defaultUserAgentProvider ?? createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
35
+ maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
36
+ region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, { ...NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
37
+ requestHandler: RequestHandler.create(config?.requestHandler ?? defaultConfigProvider),
38
+ retryMode: config?.retryMode ??
39
+ loadNodeConfig({
40
+ ...NODE_RETRY_MODE_CONFIG_OPTIONS,
41
+ default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
42
+ }, config),
43
+ sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
44
+ sigv4aSigningRegionSet: config?.sigv4aSigningRegionSet ?? loadNodeConfig(NODE_SIGV4A_CONFIG_OPTIONS, loaderConfig),
45
+ streamCollector: config?.streamCollector ?? streamCollector,
46
+ useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
47
+ useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
48
+ userAgentAppId: config?.userAgentAppId ?? loadNodeConfig(NODE_APP_ID_CONFIG_OPTIONS, loaderConfig),
49
+ };
50
+ };
@@ -0,0 +1,11 @@
1
+ import { Sha256 } from "@aws-crypto/sha256-js";
2
+ import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser";
3
+ export 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
+ };
@@ -0,0 +1,46 @@
1
+ import { AwsSdkSigV4ASigner, AwsSdkSigV4Signer } from "@aws-sdk/core/httpAuthSchemes";
2
+ import { AwsRestJsonProtocol } from "@aws-sdk/core/protocols";
3
+ import { SignatureV4MultiRegion } from "@aws-sdk/signature-v4-multi-region";
4
+ import { NoOpLogger } from "@smithy/smithy-client";
5
+ import { parseUrl } from "@smithy/url-parser";
6
+ import { fromBase64, toBase64 } from "@smithy/util-base64";
7
+ import { fromUtf8, toUtf8 } from "@smithy/util-utf8";
8
+ import { defaultSustainabilityHttpAuthSchemeProvider } from "./auth/httpAuthSchemeProvider";
9
+ import { defaultEndpointResolver } from "./endpoint/endpointResolver";
10
+ import { errorTypeRegistries } from "./schemas/schemas_0";
11
+ export const getRuntimeConfig = (config) => {
12
+ return {
13
+ apiVersion: "2018-05-10",
14
+ base64Decoder: config?.base64Decoder ?? fromBase64,
15
+ base64Encoder: config?.base64Encoder ?? toBase64,
16
+ disableHostPrefix: config?.disableHostPrefix ?? false,
17
+ endpointProvider: config?.endpointProvider ?? defaultEndpointResolver,
18
+ extensions: config?.extensions ?? [],
19
+ httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultSustainabilityHttpAuthSchemeProvider,
20
+ httpAuthSchemes: config?.httpAuthSchemes ?? [
21
+ {
22
+ schemeId: "aws.auth#sigv4",
23
+ identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
24
+ signer: new AwsSdkSigV4Signer(),
25
+ },
26
+ {
27
+ schemeId: "aws.auth#sigv4a",
28
+ identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4a"),
29
+ signer: new AwsSdkSigV4ASigner(),
30
+ },
31
+ ],
32
+ logger: config?.logger ?? new NoOpLogger(),
33
+ protocol: config?.protocol ?? AwsRestJsonProtocol,
34
+ protocolSettings: config?.protocolSettings ?? {
35
+ defaultNamespace: "com.amazonaws.sustainability",
36
+ errorTypeRegistries,
37
+ version: "2018-05-10",
38
+ serviceTarget: "AwsSustainabilityApiService",
39
+ },
40
+ serviceId: config?.serviceId ?? "Sustainability",
41
+ signerConstructor: config?.signerConstructor ?? SignatureV4MultiRegion,
42
+ urlParser: config?.urlParser ?? parseUrl,
43
+ utf8Decoder: config?.utf8Decoder ?? fromUtf8,
44
+ utf8Encoder: config?.utf8Encoder ?? toUtf8,
45
+ };
46
+ };
@@ -0,0 +1,9 @@
1
+ import { getAwsRegionExtensionConfiguration, resolveAwsRegionExtensionConfiguration, } from "@aws-sdk/region-config-resolver";
2
+ import { getHttpHandlerExtensionConfiguration, resolveHttpHandlerRuntimeConfig } from "@smithy/protocol-http";
3
+ import { getDefaultExtensionConfiguration, resolveDefaultRuntimeConfig } from "@smithy/smithy-client";
4
+ import { getHttpAuthExtensionConfiguration, resolveHttpAuthRuntimeConfig } from "./auth/httpAuthExtensionConfiguration";
5
+ export const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
6
+ const extensionConfiguration = Object.assign(getAwsRegionExtensionConfiguration(runtimeConfig), getDefaultExtensionConfiguration(runtimeConfig), getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration(runtimeConfig));
7
+ extensions.forEach((extension) => extension.configure(extensionConfiguration));
8
+ return Object.assign(runtimeConfig, resolveAwsRegionExtensionConfiguration(extensionConfiguration), resolveDefaultRuntimeConfig(extensionConfiguration), resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig(extensionConfiguration));
9
+ };