@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,212 @@
1
+ 'use strict';
2
+
3
+ var middlewareHostHeader = require('@aws-sdk/middleware-host-header');
4
+ var middlewareLogger = require('@aws-sdk/middleware-logger');
5
+ var middlewareRecursionDetection = require('@aws-sdk/middleware-recursion-detection');
6
+ var middlewareUserAgent = require('@aws-sdk/middleware-user-agent');
7
+ var configResolver = require('@smithy/config-resolver');
8
+ var core = require('@smithy/core');
9
+ var schema = require('@smithy/core/schema');
10
+ var middlewareContentLength = require('@smithy/middleware-content-length');
11
+ var middlewareEndpoint = require('@smithy/middleware-endpoint');
12
+ var middlewareRetry = require('@smithy/middleware-retry');
13
+ var smithyClient = require('@smithy/smithy-client');
14
+ var httpAuthSchemeProvider = require('./auth/httpAuthSchemeProvider');
15
+ var runtimeConfig = require('./runtimeConfig');
16
+ var regionConfigResolver = require('@aws-sdk/region-config-resolver');
17
+ var protocolHttp = require('@smithy/protocol-http');
18
+ var schemas_0 = require('./schemas/schemas_0');
19
+ var errors = require('./models/errors');
20
+ var SustainabilityServiceException = require('./models/SustainabilityServiceException');
21
+
22
+ const resolveClientEndpointParameters = (options) => {
23
+ return Object.assign(options, {
24
+ useFipsEndpoint: options.useFipsEndpoint ?? false,
25
+ defaultSigningName: "sustainability",
26
+ });
27
+ };
28
+ const commonParams = {
29
+ UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
30
+ Endpoint: { type: "builtInParams", name: "endpoint" },
31
+ Region: { type: "builtInParams", name: "region" },
32
+ };
33
+
34
+ const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
35
+ const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
36
+ let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
37
+ let _credentials = runtimeConfig.credentials;
38
+ return {
39
+ setHttpAuthScheme(httpAuthScheme) {
40
+ const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
41
+ if (index === -1) {
42
+ _httpAuthSchemes.push(httpAuthScheme);
43
+ }
44
+ else {
45
+ _httpAuthSchemes.splice(index, 1, httpAuthScheme);
46
+ }
47
+ },
48
+ httpAuthSchemes() {
49
+ return _httpAuthSchemes;
50
+ },
51
+ setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
52
+ _httpAuthSchemeProvider = httpAuthSchemeProvider;
53
+ },
54
+ httpAuthSchemeProvider() {
55
+ return _httpAuthSchemeProvider;
56
+ },
57
+ setCredentials(credentials) {
58
+ _credentials = credentials;
59
+ },
60
+ credentials() {
61
+ return _credentials;
62
+ },
63
+ };
64
+ };
65
+ const resolveHttpAuthRuntimeConfig = (config) => {
66
+ return {
67
+ httpAuthSchemes: config.httpAuthSchemes(),
68
+ httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
69
+ credentials: config.credentials(),
70
+ };
71
+ };
72
+
73
+ const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
74
+ const extensionConfiguration = Object.assign(regionConfigResolver.getAwsRegionExtensionConfiguration(runtimeConfig), smithyClient.getDefaultExtensionConfiguration(runtimeConfig), protocolHttp.getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration(runtimeConfig));
75
+ extensions.forEach((extension) => extension.configure(extensionConfiguration));
76
+ return Object.assign(runtimeConfig, regionConfigResolver.resolveAwsRegionExtensionConfiguration(extensionConfiguration), smithyClient.resolveDefaultRuntimeConfig(extensionConfiguration), protocolHttp.resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig(extensionConfiguration));
77
+ };
78
+
79
+ class SustainabilityClient extends smithyClient.Client {
80
+ config;
81
+ constructor(...[configuration]) {
82
+ const _config_0 = runtimeConfig.getRuntimeConfig(configuration || {});
83
+ super(_config_0);
84
+ this.initConfig = _config_0;
85
+ const _config_1 = resolveClientEndpointParameters(_config_0);
86
+ const _config_2 = middlewareUserAgent.resolveUserAgentConfig(_config_1);
87
+ const _config_3 = middlewareRetry.resolveRetryConfig(_config_2);
88
+ const _config_4 = configResolver.resolveRegionConfig(_config_3);
89
+ const _config_5 = middlewareHostHeader.resolveHostHeaderConfig(_config_4);
90
+ const _config_6 = middlewareEndpoint.resolveEndpointConfig(_config_5);
91
+ const _config_7 = httpAuthSchemeProvider.resolveHttpAuthSchemeConfig(_config_6);
92
+ const _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []);
93
+ this.config = _config_8;
94
+ this.middlewareStack.use(schema.getSchemaSerdePlugin(this.config));
95
+ this.middlewareStack.use(middlewareUserAgent.getUserAgentPlugin(this.config));
96
+ this.middlewareStack.use(middlewareRetry.getRetryPlugin(this.config));
97
+ this.middlewareStack.use(middlewareContentLength.getContentLengthPlugin(this.config));
98
+ this.middlewareStack.use(middlewareHostHeader.getHostHeaderPlugin(this.config));
99
+ this.middlewareStack.use(middlewareLogger.getLoggerPlugin(this.config));
100
+ this.middlewareStack.use(middlewareRecursionDetection.getRecursionDetectionPlugin(this.config));
101
+ this.middlewareStack.use(core.getHttpAuthSchemeEndpointRuleSetPlugin(this.config, {
102
+ httpAuthSchemeParametersProvider: httpAuthSchemeProvider.defaultSustainabilityHttpAuthSchemeParametersProvider,
103
+ identityProviderConfigProvider: async (config) => new core.DefaultIdentityProviderConfig({
104
+ "aws.auth#sigv4": config.credentials,
105
+ "aws.auth#sigv4a": config.credentials,
106
+ }),
107
+ }));
108
+ this.middlewareStack.use(core.getHttpSigningPlugin(this.config));
109
+ }
110
+ destroy() {
111
+ super.destroy();
112
+ }
113
+ }
114
+
115
+ class GetEstimatedCarbonEmissionsCommand extends smithyClient.Command
116
+ .classBuilder()
117
+ .ep(commonParams)
118
+ .m(function (Command, cs, config, o) {
119
+ return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
120
+ })
121
+ .s("AwsSustainabilityApiService", "GetEstimatedCarbonEmissions", {})
122
+ .n("SustainabilityClient", "GetEstimatedCarbonEmissionsCommand")
123
+ .sc(schemas_0.GetEstimatedCarbonEmissions$)
124
+ .build() {
125
+ }
126
+
127
+ class GetEstimatedCarbonEmissionsDimensionValuesCommand extends smithyClient.Command
128
+ .classBuilder()
129
+ .ep(commonParams)
130
+ .m(function (Command, cs, config, o) {
131
+ return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
132
+ })
133
+ .s("AwsSustainabilityApiService", "GetEstimatedCarbonEmissionsDimensionValues", {})
134
+ .n("SustainabilityClient", "GetEstimatedCarbonEmissionsDimensionValuesCommand")
135
+ .sc(schemas_0.GetEstimatedCarbonEmissionsDimensionValues$)
136
+ .build() {
137
+ }
138
+
139
+ const paginateGetEstimatedCarbonEmissionsDimensionValues = core.createPaginator(SustainabilityClient, GetEstimatedCarbonEmissionsDimensionValuesCommand, "NextToken", "NextToken", "MaxResults");
140
+
141
+ const paginateGetEstimatedCarbonEmissions = core.createPaginator(SustainabilityClient, GetEstimatedCarbonEmissionsCommand, "NextToken", "NextToken", "MaxResults");
142
+
143
+ const commands = {
144
+ GetEstimatedCarbonEmissionsCommand,
145
+ GetEstimatedCarbonEmissionsDimensionValuesCommand,
146
+ };
147
+ const paginators = {
148
+ paginateGetEstimatedCarbonEmissions,
149
+ paginateGetEstimatedCarbonEmissionsDimensionValues,
150
+ };
151
+ class Sustainability extends SustainabilityClient {
152
+ }
153
+ smithyClient.createAggregatedClient(commands, Sustainability, { paginators });
154
+
155
+ const EmissionsType = {
156
+ TOTAL_LBM_CARBON_EMISSIONS: "TOTAL_LBM_CARBON_EMISSIONS",
157
+ TOTAL_MBM_CARBON_EMISSIONS: "TOTAL_MBM_CARBON_EMISSIONS",
158
+ TOTAL_SCOPE_1_CARBON_EMISSIONS: "TOTAL_SCOPE_1_CARBON_EMISSIONS",
159
+ TOTAL_SCOPE_2_LBM_CARBON_EMISSIONS: "TOTAL_SCOPE_2_LBM_CARBON_EMISSIONS",
160
+ TOTAL_SCOPE_2_MBM_CARBON_EMISSIONS: "TOTAL_SCOPE_2_MBM_CARBON_EMISSIONS",
161
+ TOTAL_SCOPE_3_LBM_CARBON_EMISSIONS: "TOTAL_SCOPE_3_LBM_CARBON_EMISSIONS",
162
+ TOTAL_SCOPE_3_MBM_CARBON_EMISSIONS: "TOTAL_SCOPE_3_MBM_CARBON_EMISSIONS",
163
+ };
164
+ const Dimension = {
165
+ REGION: "REGION",
166
+ SERVICE: "SERVICE",
167
+ USAGE_ACCOUNT_ID: "USAGE_ACCOUNT_ID",
168
+ };
169
+ const TimeGranularity = {
170
+ MONTHLY: "MONTHLY",
171
+ QUARTERLY_CALENDAR: "QUARTERLY_CALENDAR",
172
+ QUARTERLY_FISCAL: "QUARTERLY_FISCAL",
173
+ YEARLY_CALENDAR: "YEARLY_CALENDAR",
174
+ YEARLY_FISCAL: "YEARLY_FISCAL",
175
+ };
176
+ const EmissionsUnit = {
177
+ MT_CO2E: "MTCO2e",
178
+ };
179
+
180
+ exports.$Command = smithyClient.Command;
181
+ exports.__Client = smithyClient.Client;
182
+ exports.SustainabilityServiceException = SustainabilityServiceException.SustainabilityServiceException;
183
+ exports.Dimension = Dimension;
184
+ exports.EmissionsType = EmissionsType;
185
+ exports.EmissionsUnit = EmissionsUnit;
186
+ exports.GetEstimatedCarbonEmissionsCommand = GetEstimatedCarbonEmissionsCommand;
187
+ exports.GetEstimatedCarbonEmissionsDimensionValuesCommand = GetEstimatedCarbonEmissionsDimensionValuesCommand;
188
+ exports.Sustainability = Sustainability;
189
+ exports.SustainabilityClient = SustainabilityClient;
190
+ exports.TimeGranularity = TimeGranularity;
191
+ exports.paginateGetEstimatedCarbonEmissions = paginateGetEstimatedCarbonEmissions;
192
+ exports.paginateGetEstimatedCarbonEmissionsDimensionValues = paginateGetEstimatedCarbonEmissionsDimensionValues;
193
+ Object.prototype.hasOwnProperty.call(schemas_0, '__proto__') &&
194
+ !Object.prototype.hasOwnProperty.call(exports, '__proto__') &&
195
+ Object.defineProperty(exports, '__proto__', {
196
+ enumerable: true,
197
+ value: schemas_0['__proto__']
198
+ });
199
+
200
+ Object.keys(schemas_0).forEach(function (k) {
201
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = schemas_0[k];
202
+ });
203
+ Object.prototype.hasOwnProperty.call(errors, '__proto__') &&
204
+ !Object.prototype.hasOwnProperty.call(exports, '__proto__') &&
205
+ Object.defineProperty(exports, '__proto__', {
206
+ enumerable: true,
207
+ value: errors['__proto__']
208
+ });
209
+
210
+ Object.keys(errors).forEach(function (k) {
211
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = errors[k];
212
+ });
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SustainabilityServiceException = exports.__ServiceException = void 0;
4
+ const smithy_client_1 = require("@smithy/smithy-client");
5
+ Object.defineProperty(exports, "__ServiceException", { enumerable: true, get: function () { return smithy_client_1.ServiceException; } });
6
+ class SustainabilityServiceException extends smithy_client_1.ServiceException {
7
+ constructor(options) {
8
+ super(options);
9
+ Object.setPrototypeOf(this, SustainabilityServiceException.prototype);
10
+ }
11
+ }
12
+ exports.SustainabilityServiceException = SustainabilityServiceException;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ValidationException = exports.ThrottlingException = exports.InternalServerException = exports.AccessDeniedException = void 0;
4
+ const SustainabilityServiceException_1 = require("./SustainabilityServiceException");
5
+ class AccessDeniedException extends SustainabilityServiceException_1.SustainabilityServiceException {
6
+ name = "AccessDeniedException";
7
+ $fault = "client";
8
+ Message;
9
+ constructor(opts) {
10
+ super({
11
+ name: "AccessDeniedException",
12
+ $fault: "client",
13
+ ...opts,
14
+ });
15
+ Object.setPrototypeOf(this, AccessDeniedException.prototype);
16
+ this.Message = opts.Message;
17
+ }
18
+ }
19
+ exports.AccessDeniedException = AccessDeniedException;
20
+ class InternalServerException extends SustainabilityServiceException_1.SustainabilityServiceException {
21
+ name = "InternalServerException";
22
+ $fault = "server";
23
+ $retryable = {};
24
+ Message;
25
+ constructor(opts) {
26
+ super({
27
+ name: "InternalServerException",
28
+ $fault: "server",
29
+ ...opts,
30
+ });
31
+ Object.setPrototypeOf(this, InternalServerException.prototype);
32
+ this.Message = opts.Message;
33
+ }
34
+ }
35
+ exports.InternalServerException = InternalServerException;
36
+ class ThrottlingException extends SustainabilityServiceException_1.SustainabilityServiceException {
37
+ name = "ThrottlingException";
38
+ $fault = "client";
39
+ $retryable = {};
40
+ Message;
41
+ constructor(opts) {
42
+ super({
43
+ name: "ThrottlingException",
44
+ $fault: "client",
45
+ ...opts,
46
+ });
47
+ Object.setPrototypeOf(this, ThrottlingException.prototype);
48
+ this.Message = opts.Message;
49
+ }
50
+ }
51
+ exports.ThrottlingException = ThrottlingException;
52
+ class ValidationException extends SustainabilityServiceException_1.SustainabilityServiceException {
53
+ name = "ValidationException";
54
+ $fault = "client";
55
+ Message;
56
+ constructor(opts) {
57
+ super({
58
+ name: "ValidationException",
59
+ $fault: "client",
60
+ ...opts,
61
+ });
62
+ Object.setPrototypeOf(this, ValidationException.prototype);
63
+ this.Message = opts.Message;
64
+ }
65
+ }
66
+ exports.ValidationException = ValidationException;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRuntimeConfig = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const package_json_1 = tslib_1.__importDefault(require("../package.json"));
6
+ const sha256_browser_1 = require("@aws-crypto/sha256-browser");
7
+ const util_user_agent_browser_1 = require("@aws-sdk/util-user-agent-browser");
8
+ const config_resolver_1 = require("@smithy/config-resolver");
9
+ const fetch_http_handler_1 = require("@smithy/fetch-http-handler");
10
+ const invalid_dependency_1 = require("@smithy/invalid-dependency");
11
+ const smithy_client_1 = require("@smithy/smithy-client");
12
+ const util_body_length_browser_1 = require("@smithy/util-body-length-browser");
13
+ const util_defaults_mode_browser_1 = require("@smithy/util-defaults-mode-browser");
14
+ const util_retry_1 = require("@smithy/util-retry");
15
+ const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
16
+ const getRuntimeConfig = (config) => {
17
+ const defaultsMode = (0, util_defaults_mode_browser_1.resolveDefaultsModeConfig)(config);
18
+ const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode);
19
+ const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config);
20
+ return {
21
+ ...clientSharedValues,
22
+ ...config,
23
+ runtime: "browser",
24
+ defaultsMode,
25
+ bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_browser_1.calculateBodyLength,
26
+ credentialDefaultProvider: config?.credentialDefaultProvider ?? ((_) => () => Promise.reject(new Error("Credential is missing"))),
27
+ defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_browser_1.createDefaultUserAgentProvider)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }),
28
+ maxAttempts: config?.maxAttempts ?? util_retry_1.DEFAULT_MAX_ATTEMPTS,
29
+ region: config?.region ?? (0, invalid_dependency_1.invalidProvider)("Region is missing"),
30
+ requestHandler: fetch_http_handler_1.FetchHttpHandler.create(config?.requestHandler ?? defaultConfigProvider),
31
+ retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE),
32
+ sha256: config?.sha256 ?? sha256_browser_1.Sha256,
33
+ streamCollector: config?.streamCollector ?? fetch_http_handler_1.streamCollector,
34
+ useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(config_resolver_1.DEFAULT_USE_DUALSTACK_ENDPOINT)),
35
+ useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(config_resolver_1.DEFAULT_USE_FIPS_ENDPOINT)),
36
+ };
37
+ };
38
+ exports.getRuntimeConfig = getRuntimeConfig;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRuntimeConfig = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const package_json_1 = tslib_1.__importDefault(require("../package.json"));
6
+ const client_1 = require("@aws-sdk/core/client");
7
+ const httpAuthSchemes_1 = require("@aws-sdk/core/httpAuthSchemes");
8
+ const credential_provider_node_1 = require("@aws-sdk/credential-provider-node");
9
+ const util_user_agent_node_1 = require("@aws-sdk/util-user-agent-node");
10
+ const config_resolver_1 = require("@smithy/config-resolver");
11
+ const hash_node_1 = require("@smithy/hash-node");
12
+ const middleware_retry_1 = require("@smithy/middleware-retry");
13
+ const node_config_provider_1 = require("@smithy/node-config-provider");
14
+ const node_http_handler_1 = require("@smithy/node-http-handler");
15
+ const smithy_client_1 = require("@smithy/smithy-client");
16
+ const util_body_length_node_1 = require("@smithy/util-body-length-node");
17
+ const util_defaults_mode_node_1 = require("@smithy/util-defaults-mode-node");
18
+ const util_retry_1 = require("@smithy/util-retry");
19
+ const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
20
+ const getRuntimeConfig = (config) => {
21
+ (0, smithy_client_1.emitWarningIfUnsupportedVersion)(process.version);
22
+ const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config);
23
+ const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode);
24
+ const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config);
25
+ (0, client_1.emitWarningIfUnsupportedVersion)(process.version);
26
+ const loaderConfig = {
27
+ profile: config?.profile,
28
+ logger: clientSharedValues.logger,
29
+ };
30
+ return {
31
+ ...clientSharedValues,
32
+ ...config,
33
+ runtime: "node",
34
+ defaultsMode,
35
+ authSchemePreference: config?.authSchemePreference ?? (0, node_config_provider_1.loadConfig)(httpAuthSchemes_1.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
36
+ bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength,
37
+ credentialDefaultProvider: config?.credentialDefaultProvider ?? credential_provider_node_1.defaultProvider,
38
+ defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_node_1.createDefaultUserAgentProvider)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }),
39
+ maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
40
+ region: config?.region ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, { ...config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
41
+ requestHandler: node_http_handler_1.NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider),
42
+ retryMode: config?.retryMode ??
43
+ (0, node_config_provider_1.loadConfig)({
44
+ ...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS,
45
+ default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE,
46
+ }, config),
47
+ sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"),
48
+ sigv4aSigningRegionSet: config?.sigv4aSigningRegionSet ?? (0, node_config_provider_1.loadConfig)(httpAuthSchemes_1.NODE_SIGV4A_CONFIG_OPTIONS, loaderConfig),
49
+ streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector,
50
+ useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
51
+ useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
52
+ userAgentAppId: config?.userAgentAppId ?? (0, node_config_provider_1.loadConfig)(util_user_agent_node_1.NODE_APP_ID_CONFIG_OPTIONS, loaderConfig),
53
+ };
54
+ };
55
+ exports.getRuntimeConfig = getRuntimeConfig;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRuntimeConfig = void 0;
4
+ const sha256_js_1 = require("@aws-crypto/sha256-js");
5
+ const runtimeConfig_browser_1 = require("./runtimeConfig.browser");
6
+ const getRuntimeConfig = (config) => {
7
+ const browserDefaults = (0, runtimeConfig_browser_1.getRuntimeConfig)(config);
8
+ return {
9
+ ...browserDefaults,
10
+ ...config,
11
+ runtime: "react-native",
12
+ sha256: config?.sha256 ?? sha256_js_1.Sha256,
13
+ };
14
+ };
15
+ exports.getRuntimeConfig = getRuntimeConfig;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRuntimeConfig = void 0;
4
+ const httpAuthSchemes_1 = require("@aws-sdk/core/httpAuthSchemes");
5
+ const protocols_1 = require("@aws-sdk/core/protocols");
6
+ const signature_v4_multi_region_1 = require("@aws-sdk/signature-v4-multi-region");
7
+ const smithy_client_1 = require("@smithy/smithy-client");
8
+ const url_parser_1 = require("@smithy/url-parser");
9
+ const util_base64_1 = require("@smithy/util-base64");
10
+ const util_utf8_1 = require("@smithy/util-utf8");
11
+ const httpAuthSchemeProvider_1 = require("./auth/httpAuthSchemeProvider");
12
+ const endpointResolver_1 = require("./endpoint/endpointResolver");
13
+ const schemas_0_1 = require("./schemas/schemas_0");
14
+ const getRuntimeConfig = (config) => {
15
+ return {
16
+ apiVersion: "2018-05-10",
17
+ base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64,
18
+ base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64,
19
+ disableHostPrefix: config?.disableHostPrefix ?? false,
20
+ endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver,
21
+ extensions: config?.extensions ?? [],
22
+ httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? httpAuthSchemeProvider_1.defaultSustainabilityHttpAuthSchemeProvider,
23
+ httpAuthSchemes: config?.httpAuthSchemes ?? [
24
+ {
25
+ schemeId: "aws.auth#sigv4",
26
+ identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
27
+ signer: new httpAuthSchemes_1.AwsSdkSigV4Signer(),
28
+ },
29
+ {
30
+ schemeId: "aws.auth#sigv4a",
31
+ identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4a"),
32
+ signer: new httpAuthSchemes_1.AwsSdkSigV4ASigner(),
33
+ },
34
+ ],
35
+ logger: config?.logger ?? new smithy_client_1.NoOpLogger(),
36
+ protocol: config?.protocol ?? protocols_1.AwsRestJsonProtocol,
37
+ protocolSettings: config?.protocolSettings ?? {
38
+ defaultNamespace: "com.amazonaws.sustainability",
39
+ errorTypeRegistries: schemas_0_1.errorTypeRegistries,
40
+ version: "2018-05-10",
41
+ serviceTarget: "AwsSustainabilityApiService",
42
+ },
43
+ serviceId: config?.serviceId ?? "Sustainability",
44
+ signerConstructor: config?.signerConstructor ?? signature_v4_multi_region_1.SignatureV4MultiRegion,
45
+ urlParser: config?.urlParser ?? url_parser_1.parseUrl,
46
+ utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8,
47
+ utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8,
48
+ };
49
+ };
50
+ exports.getRuntimeConfig = getRuntimeConfig;
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetEstimatedCarbonEmissionsDimensionValues$ = exports.GetEstimatedCarbonEmissions$ = exports.TimePeriod$ = exports.GranularityConfiguration$ = exports.GetEstimatedCarbonEmissionsResponse$ = exports.GetEstimatedCarbonEmissionsRequest$ = exports.GetEstimatedCarbonEmissionsDimensionValuesResponse$ = exports.GetEstimatedCarbonEmissionsDimensionValuesRequest$ = exports.FilterExpression$ = exports.EstimatedCarbonEmissions$ = exports.Emissions$ = exports.DimensionEntry$ = exports.errorTypeRegistries = exports.ValidationException$ = exports.ThrottlingException$ = exports.InternalServerException$ = exports.AccessDeniedException$ = exports.SustainabilityServiceException$ = void 0;
4
+ const _ADE = "AccessDeniedException";
5
+ const _D = "Dimension";
6
+ const _DE = "DimensionEntry";
7
+ const _DEL = "DimensionEntryList";
8
+ const _DLM = "DimensionListMap";
9
+ const _DV = "DimensionsValues";
10
+ const _Di = "Dimensions";
11
+ const _E = "Emissions";
12
+ const _ECE = "EstimatedCarbonEmissions";
13
+ const _ECEL = "EstimatedCarbonEmissionsList";
14
+ const _EM = "EmissionsMap";
15
+ const _ET = "EmissionsTypes";
16
+ const _EV = "EmissionsValues";
17
+ const _En = "End";
18
+ const _FB = "FilterBy";
19
+ const _FE = "FilterExpression";
20
+ const _FYSM = "FiscalYearStartMonth";
21
+ const _G = "Granularity";
22
+ const _GB = "GroupBy";
23
+ const _GC = "GranularityConfiguration";
24
+ const _GECE = "GetEstimatedCarbonEmissions";
25
+ const _GECEDV = "GetEstimatedCarbonEmissionsDimensionValues";
26
+ const _GECEDVR = "GetEstimatedCarbonEmissionsDimensionValuesRequest";
27
+ const _GECEDVRe = "GetEstimatedCarbonEmissionsDimensionValuesResponse";
28
+ const _GECER = "GetEstimatedCarbonEmissionsRequest";
29
+ const _GECERe = "GetEstimatedCarbonEmissionsResponse";
30
+ const _ISE = "InternalServerException";
31
+ const _M = "Message";
32
+ const _MR = "MaxResults";
33
+ const _MV = "ModelVersion";
34
+ const _NT = "NextToken";
35
+ const _R = "Results";
36
+ const _S = "Start";
37
+ const _TE = "ThrottlingException";
38
+ const _TP = "TimePeriod";
39
+ const _U = "Unit";
40
+ const _V = "Value";
41
+ const _VE = "ValidationException";
42
+ const _c = "client";
43
+ const _e = "error";
44
+ const _h = "http";
45
+ const _hE = "httpError";
46
+ const _jN = "jsonName";
47
+ const _m = "message";
48
+ const _s = "smithy.ts.sdk.synthetic.com.amazonaws.sustainability";
49
+ const _se = "server";
50
+ const n0 = "com.amazonaws.sustainability";
51
+ const schema_1 = require("@smithy/core/schema");
52
+ const errors_1 = require("../models/errors");
53
+ const SustainabilityServiceException_1 = require("../models/SustainabilityServiceException");
54
+ const _s_registry = schema_1.TypeRegistry.for(_s);
55
+ exports.SustainabilityServiceException$ = [-3, _s, "SustainabilityServiceException", 0, [], []];
56
+ _s_registry.registerError(exports.SustainabilityServiceException$, SustainabilityServiceException_1.SustainabilityServiceException);
57
+ const n0_registry = schema_1.TypeRegistry.for(n0);
58
+ exports.AccessDeniedException$ = [-3, n0, _ADE,
59
+ { [_e]: _c, [_hE]: 403 },
60
+ [_M],
61
+ [[0, { [_jN]: _m }]], 1
62
+ ];
63
+ n0_registry.registerError(exports.AccessDeniedException$, errors_1.AccessDeniedException);
64
+ exports.InternalServerException$ = [-3, n0, _ISE,
65
+ { [_e]: _se, [_hE]: 500 },
66
+ [_M],
67
+ [[0, { [_jN]: _m }]], 1
68
+ ];
69
+ n0_registry.registerError(exports.InternalServerException$, errors_1.InternalServerException);
70
+ exports.ThrottlingException$ = [-3, n0, _TE,
71
+ { [_e]: _c, [_hE]: 429 },
72
+ [_M],
73
+ [[0, { [_jN]: _m }]], 1
74
+ ];
75
+ n0_registry.registerError(exports.ThrottlingException$, errors_1.ThrottlingException);
76
+ exports.ValidationException$ = [-3, n0, _VE,
77
+ { [_e]: _c, [_hE]: 400 },
78
+ [_M],
79
+ [[0, { [_jN]: _m }]], 1
80
+ ];
81
+ n0_registry.registerError(exports.ValidationException$, errors_1.ValidationException);
82
+ exports.errorTypeRegistries = [
83
+ _s_registry,
84
+ n0_registry,
85
+ ];
86
+ exports.DimensionEntry$ = [3, n0, _DE,
87
+ 0,
88
+ [_D, _V],
89
+ [0, 0], 2
90
+ ];
91
+ exports.Emissions$ = [3, n0, _E,
92
+ 0,
93
+ [_V, _U],
94
+ [1, 0], 2
95
+ ];
96
+ exports.EstimatedCarbonEmissions$ = [3, n0, _ECE,
97
+ 0,
98
+ [_TP, _DV, _MV, _EV],
99
+ [() => exports.TimePeriod$, 128 | 0, 0, () => EmissionsMap], 4
100
+ ];
101
+ exports.FilterExpression$ = [3, n0, _FE,
102
+ 0,
103
+ [_Di],
104
+ [[2, n0, _DLM, 0, 0, 64 | 0]]
105
+ ];
106
+ exports.GetEstimatedCarbonEmissionsDimensionValuesRequest$ = [3, n0, _GECEDVR,
107
+ 0,
108
+ [_TP, _Di, _MR, _NT],
109
+ [() => exports.TimePeriod$, 64 | 0, 1, 0], 2
110
+ ];
111
+ exports.GetEstimatedCarbonEmissionsDimensionValuesResponse$ = [3, n0, _GECEDVRe,
112
+ 0,
113
+ [_R, _NT],
114
+ [() => DimensionEntryList, 0]
115
+ ];
116
+ exports.GetEstimatedCarbonEmissionsRequest$ = [3, n0, _GECER,
117
+ 0,
118
+ [_TP, _GB, _FB, _ET, _G, _GC, _MR, _NT],
119
+ [() => exports.TimePeriod$, 64 | 0, () => exports.FilterExpression$, 64 | 0, 0, () => exports.GranularityConfiguration$, 1, 0], 1
120
+ ];
121
+ exports.GetEstimatedCarbonEmissionsResponse$ = [3, n0, _GECERe,
122
+ 0,
123
+ [_R, _NT],
124
+ [() => EstimatedCarbonEmissionsList, 0], 1
125
+ ];
126
+ exports.GranularityConfiguration$ = [3, n0, _GC,
127
+ 0,
128
+ [_FYSM],
129
+ [1]
130
+ ];
131
+ exports.TimePeriod$ = [3, n0, _TP,
132
+ 0,
133
+ [_S, _En],
134
+ [5, 5], 2
135
+ ];
136
+ var DimensionEntryList = [1, n0, _DEL,
137
+ 0, () => exports.DimensionEntry$
138
+ ];
139
+ var DimensionList = 64 | 0;
140
+ var DimensionValueList = 64 | 0;
141
+ var EmissionsTypeList = 64 | 0;
142
+ var EstimatedCarbonEmissionsList = [1, n0, _ECEL,
143
+ 0, () => exports.EstimatedCarbonEmissions$
144
+ ];
145
+ var DimensionListMap = [2, n0, _DLM,
146
+ 0, 0, 64 | 0
147
+ ];
148
+ var DimensionsMap = 128 | 0;
149
+ var EmissionsMap = [2, n0, _EM,
150
+ 0, 0, () => exports.Emissions$
151
+ ];
152
+ exports.GetEstimatedCarbonEmissions$ = [9, n0, _GECE,
153
+ { [_h]: ["POST", "/v1/estimated-carbon-emissions", 200] }, () => exports.GetEstimatedCarbonEmissionsRequest$, () => exports.GetEstimatedCarbonEmissionsResponse$
154
+ ];
155
+ exports.GetEstimatedCarbonEmissionsDimensionValues$ = [9, n0, _GECEDV,
156
+ { [_h]: ["POST", "/v1/estimated-carbon-emissions-dimension-values", 200] }, () => exports.GetEstimatedCarbonEmissionsDimensionValuesRequest$, () => exports.GetEstimatedCarbonEmissionsDimensionValuesResponse$
157
+ ];
@@ -0,0 +1,17 @@
1
+ import { createAggregatedClient } from "@smithy/smithy-client";
2
+ import { GetEstimatedCarbonEmissionsCommand, } from "./commands/GetEstimatedCarbonEmissionsCommand";
3
+ import { GetEstimatedCarbonEmissionsDimensionValuesCommand, } from "./commands/GetEstimatedCarbonEmissionsDimensionValuesCommand";
4
+ import { paginateGetEstimatedCarbonEmissionsDimensionValues, } from "./pagination/GetEstimatedCarbonEmissionsDimensionValuesPaginator";
5
+ import { paginateGetEstimatedCarbonEmissions } from "./pagination/GetEstimatedCarbonEmissionsPaginator";
6
+ import { SustainabilityClient } from "./SustainabilityClient";
7
+ const commands = {
8
+ GetEstimatedCarbonEmissionsCommand,
9
+ GetEstimatedCarbonEmissionsDimensionValuesCommand,
10
+ };
11
+ const paginators = {
12
+ paginateGetEstimatedCarbonEmissions,
13
+ paginateGetEstimatedCarbonEmissionsDimensionValues,
14
+ };
15
+ export class Sustainability extends SustainabilityClient {
16
+ }
17
+ createAggregatedClient(commands, Sustainability, { paginators });