@aws-sdk/client-inspector-scan 3.456.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 (75) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +213 -0
  3. package/dist-cjs/InspectorScan.js +13 -0
  4. package/dist-cjs/InspectorScanClient.js +43 -0
  5. package/dist-cjs/commands/ScanSbomCommand.js +51 -0
  6. package/dist-cjs/commands/index.js +4 -0
  7. package/dist-cjs/endpoint/EndpointParameters.js +12 -0
  8. package/dist-cjs/endpoint/endpointResolver.js +12 -0
  9. package/dist-cjs/endpoint/ruleset.js +7 -0
  10. package/dist-cjs/extensionConfiguration.js +2 -0
  11. package/dist-cjs/index.js +11 -0
  12. package/dist-cjs/models/InspectorScanServiceException.js +12 -0
  13. package/dist-cjs/models/index.js +4 -0
  14. package/dist-cjs/models/models_0.js +80 -0
  15. package/dist-cjs/protocols/Aws_restJson1.js +196 -0
  16. package/dist-cjs/runtimeConfig.browser.js +39 -0
  17. package/dist-cjs/runtimeConfig.js +50 -0
  18. package/dist-cjs/runtimeConfig.native.js +15 -0
  19. package/dist-cjs/runtimeConfig.shared.js +24 -0
  20. package/dist-cjs/runtimeExtensions.js +22 -0
  21. package/dist-es/InspectorScan.js +9 -0
  22. package/dist-es/InspectorScanClient.js +39 -0
  23. package/dist-es/commands/ScanSbomCommand.js +47 -0
  24. package/dist-es/commands/index.js +1 -0
  25. package/dist-es/endpoint/EndpointParameters.js +8 -0
  26. package/dist-es/endpoint/endpointResolver.js +8 -0
  27. package/dist-es/endpoint/ruleset.js +4 -0
  28. package/dist-es/extensionConfiguration.js +1 -0
  29. package/dist-es/index.js +6 -0
  30. package/dist-es/models/InspectorScanServiceException.js +8 -0
  31. package/dist-es/models/index.js +1 -0
  32. package/dist-es/models/models_0.js +73 -0
  33. package/dist-es/protocols/Aws_restJson1.js +191 -0
  34. package/dist-es/runtimeConfig.browser.js +34 -0
  35. package/dist-es/runtimeConfig.js +45 -0
  36. package/dist-es/runtimeConfig.native.js +11 -0
  37. package/dist-es/runtimeConfig.shared.js +20 -0
  38. package/dist-es/runtimeExtensions.js +18 -0
  39. package/dist-types/InspectorScan.d.ts +17 -0
  40. package/dist-types/InspectorScanClient.d.ts +170 -0
  41. package/dist-types/commands/ScanSbomCommand.d.ts +91 -0
  42. package/dist-types/commands/index.d.ts +1 -0
  43. package/dist-types/endpoint/EndpointParameters.d.ts +22 -0
  44. package/dist-types/endpoint/endpointResolver.d.ts +5 -0
  45. package/dist-types/endpoint/ruleset.d.ts +2 -0
  46. package/dist-types/extensionConfiguration.d.ts +8 -0
  47. package/dist-types/index.d.ts +14 -0
  48. package/dist-types/models/InspectorScanServiceException.d.ts +13 -0
  49. package/dist-types/models/index.d.ts +1 -0
  50. package/dist-types/models/models_0.d.ts +169 -0
  51. package/dist-types/protocols/Aws_restJson1.d.ts +11 -0
  52. package/dist-types/runtimeConfig.browser.d.ts +46 -0
  53. package/dist-types/runtimeConfig.d.ts +46 -0
  54. package/dist-types/runtimeConfig.native.d.ts +45 -0
  55. package/dist-types/runtimeConfig.shared.d.ts +19 -0
  56. package/dist-types/runtimeExtensions.d.ts +17 -0
  57. package/dist-types/ts3.4/InspectorScan.d.ts +24 -0
  58. package/dist-types/ts3.4/InspectorScanClient.d.ts +123 -0
  59. package/dist-types/ts3.4/commands/ScanSbomCommand.d.ts +35 -0
  60. package/dist-types/ts3.4/commands/index.d.ts +1 -0
  61. package/dist-types/ts3.4/endpoint/EndpointParameters.d.ts +33 -0
  62. package/dist-types/ts3.4/endpoint/endpointResolver.d.ts +8 -0
  63. package/dist-types/ts3.4/endpoint/ruleset.d.ts +2 -0
  64. package/dist-types/ts3.4/extensionConfiguration.d.ts +7 -0
  65. package/dist-types/ts3.4/index.d.ts +9 -0
  66. package/dist-types/ts3.4/models/InspectorScanServiceException.d.ts +8 -0
  67. package/dist-types/ts3.4/models/index.d.ts +1 -0
  68. package/dist-types/ts3.4/models/models_0.d.ts +71 -0
  69. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +17 -0
  70. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +97 -0
  71. package/dist-types/ts3.4/runtimeConfig.d.ts +97 -0
  72. package/dist-types/ts3.4/runtimeConfig.native.d.ts +88 -0
  73. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +19 -0
  74. package/dist-types/ts3.4/runtimeExtensions.d.ts +11 -0
  75. package/package.json +102 -0
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ValidationException = exports.ValidationExceptionReason = exports.ThrottlingException = exports.OutputFormat = exports.InternalServerException = exports.InternalServerExceptionReason = exports.AccessDeniedException = void 0;
4
+ const InspectorScanServiceException_1 = require("./InspectorScanServiceException");
5
+ class AccessDeniedException extends InspectorScanServiceException_1.InspectorScanServiceException {
6
+ constructor(opts) {
7
+ super({
8
+ name: "AccessDeniedException",
9
+ $fault: "client",
10
+ ...opts,
11
+ });
12
+ this.name = "AccessDeniedException";
13
+ this.$fault = "client";
14
+ Object.setPrototypeOf(this, AccessDeniedException.prototype);
15
+ }
16
+ }
17
+ exports.AccessDeniedException = AccessDeniedException;
18
+ exports.InternalServerExceptionReason = {
19
+ FAILED_TO_GENERATE_SBOM: "FAILED_TO_GENERATE_SBOM",
20
+ OTHER: "OTHER",
21
+ };
22
+ class InternalServerException extends InspectorScanServiceException_1.InspectorScanServiceException {
23
+ constructor(opts) {
24
+ super({
25
+ name: "InternalServerException",
26
+ $fault: "server",
27
+ ...opts,
28
+ });
29
+ this.name = "InternalServerException";
30
+ this.$fault = "server";
31
+ this.$retryable = {};
32
+ Object.setPrototypeOf(this, InternalServerException.prototype);
33
+ this.reason = opts.reason;
34
+ this.retryAfterSeconds = opts.retryAfterSeconds;
35
+ }
36
+ }
37
+ exports.InternalServerException = InternalServerException;
38
+ exports.OutputFormat = {
39
+ CYCLONE_DX_1_5: "CYCLONE_DX_1_5",
40
+ INSPECTOR: "INSPECTOR",
41
+ };
42
+ class ThrottlingException extends InspectorScanServiceException_1.InspectorScanServiceException {
43
+ constructor(opts) {
44
+ super({
45
+ name: "ThrottlingException",
46
+ $fault: "client",
47
+ ...opts,
48
+ });
49
+ this.name = "ThrottlingException";
50
+ this.$fault = "client";
51
+ this.$retryable = {
52
+ throttling: true,
53
+ };
54
+ Object.setPrototypeOf(this, ThrottlingException.prototype);
55
+ this.retryAfterSeconds = opts.retryAfterSeconds;
56
+ }
57
+ }
58
+ exports.ThrottlingException = ThrottlingException;
59
+ exports.ValidationExceptionReason = {
60
+ CANNOT_PARSE: "CANNOT_PARSE",
61
+ FIELD_VALIDATION_FAILED: "FIELD_VALIDATION_FAILED",
62
+ OTHER: "OTHER",
63
+ UNKNOWN_OPERATION: "UNKNOWN_OPERATION",
64
+ UNSUPPORTED_SBOM_TYPE: "UNSUPPORTED_SBOM_TYPE",
65
+ };
66
+ class ValidationException extends InspectorScanServiceException_1.InspectorScanServiceException {
67
+ constructor(opts) {
68
+ super({
69
+ name: "ValidationException",
70
+ $fault: "client",
71
+ ...opts,
72
+ });
73
+ this.name = "ValidationException";
74
+ this.$fault = "client";
75
+ Object.setPrototypeOf(this, ValidationException.prototype);
76
+ this.reason = opts.reason;
77
+ this.fields = opts.fields;
78
+ }
79
+ }
80
+ exports.ValidationException = ValidationException;
@@ -0,0 +1,196 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.de_ScanSbomCommand = exports.se_ScanSbomCommand = void 0;
4
+ const protocol_http_1 = require("@smithy/protocol-http");
5
+ const smithy_client_1 = require("@smithy/smithy-client");
6
+ const InspectorScanServiceException_1 = require("../models/InspectorScanServiceException");
7
+ const models_0_1 = require("../models/models_0");
8
+ const se_ScanSbomCommand = async (input, context) => {
9
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
10
+ const headers = {
11
+ "content-type": "application/json",
12
+ };
13
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/scan/sbom";
14
+ let body;
15
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
16
+ outputFormat: [],
17
+ sbom: (_) => se_Sbom(_, context),
18
+ }));
19
+ return new protocol_http_1.HttpRequest({
20
+ protocol,
21
+ hostname,
22
+ port,
23
+ method: "POST",
24
+ headers,
25
+ path: resolvedPath,
26
+ body,
27
+ });
28
+ };
29
+ exports.se_ScanSbomCommand = se_ScanSbomCommand;
30
+ const de_ScanSbomCommand = async (output, context) => {
31
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
32
+ return de_ScanSbomCommandError(output, context);
33
+ }
34
+ const contents = (0, smithy_client_1.map)({
35
+ $metadata: deserializeMetadata(output),
36
+ });
37
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
38
+ const doc = (0, smithy_client_1.take)(data, {
39
+ sbom: (_) => de_Sbom(_, context),
40
+ });
41
+ Object.assign(contents, doc);
42
+ return contents;
43
+ };
44
+ exports.de_ScanSbomCommand = de_ScanSbomCommand;
45
+ const de_ScanSbomCommandError = async (output, context) => {
46
+ const parsedOutput = {
47
+ ...output,
48
+ body: await parseErrorBody(output.body, context),
49
+ };
50
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
51
+ switch (errorCode) {
52
+ case "AccessDeniedException":
53
+ case "com.amazonaws.inspectorscan#AccessDeniedException":
54
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
55
+ case "InternalServerException":
56
+ case "com.amazonaws.inspectorscan#InternalServerException":
57
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
58
+ case "ThrottlingException":
59
+ case "com.amazonaws.inspectorscan#ThrottlingException":
60
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
61
+ case "ValidationException":
62
+ case "com.amazonaws.inspectorscan#ValidationException":
63
+ throw await de_ValidationExceptionRes(parsedOutput, context);
64
+ default:
65
+ const parsedBody = parsedOutput.body;
66
+ return throwDefaultError({
67
+ output,
68
+ parsedBody,
69
+ errorCode,
70
+ });
71
+ }
72
+ };
73
+ const throwDefaultError = (0, smithy_client_1.withBaseException)(InspectorScanServiceException_1.InspectorScanServiceException);
74
+ const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
75
+ const contents = (0, smithy_client_1.map)({});
76
+ const data = parsedOutput.body;
77
+ const doc = (0, smithy_client_1.take)(data, {
78
+ message: smithy_client_1.expectString,
79
+ });
80
+ Object.assign(contents, doc);
81
+ const exception = new models_0_1.AccessDeniedException({
82
+ $metadata: deserializeMetadata(parsedOutput),
83
+ ...contents,
84
+ });
85
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
86
+ };
87
+ const de_InternalServerExceptionRes = async (parsedOutput, context) => {
88
+ const contents = (0, smithy_client_1.map)({
89
+ retryAfterSeconds: [
90
+ () => void 0 !== parsedOutput.headers["retry-after"],
91
+ () => (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]),
92
+ ],
93
+ });
94
+ const data = parsedOutput.body;
95
+ const doc = (0, smithy_client_1.take)(data, {
96
+ message: smithy_client_1.expectString,
97
+ reason: smithy_client_1.expectString,
98
+ });
99
+ Object.assign(contents, doc);
100
+ const exception = new models_0_1.InternalServerException({
101
+ $metadata: deserializeMetadata(parsedOutput),
102
+ ...contents,
103
+ });
104
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
105
+ };
106
+ const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
107
+ const contents = (0, smithy_client_1.map)({
108
+ retryAfterSeconds: [
109
+ () => void 0 !== parsedOutput.headers["retry-after"],
110
+ () => (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]),
111
+ ],
112
+ });
113
+ const data = parsedOutput.body;
114
+ const doc = (0, smithy_client_1.take)(data, {
115
+ message: smithy_client_1.expectString,
116
+ });
117
+ Object.assign(contents, doc);
118
+ const exception = new models_0_1.ThrottlingException({
119
+ $metadata: deserializeMetadata(parsedOutput),
120
+ ...contents,
121
+ });
122
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
123
+ };
124
+ const de_ValidationExceptionRes = async (parsedOutput, context) => {
125
+ const contents = (0, smithy_client_1.map)({});
126
+ const data = parsedOutput.body;
127
+ const doc = (0, smithy_client_1.take)(data, {
128
+ fields: smithy_client_1._json,
129
+ message: smithy_client_1.expectString,
130
+ reason: smithy_client_1.expectString,
131
+ });
132
+ Object.assign(contents, doc);
133
+ const exception = new models_0_1.ValidationException({
134
+ $metadata: deserializeMetadata(parsedOutput),
135
+ ...contents,
136
+ });
137
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
138
+ };
139
+ const se_Sbom = (input, context) => {
140
+ return input;
141
+ };
142
+ const de_Sbom = (output, context) => {
143
+ return output;
144
+ };
145
+ const deserializeMetadata = (output) => ({
146
+ httpStatusCode: output.statusCode,
147
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
148
+ extendedRequestId: output.headers["x-amz-id-2"],
149
+ cfId: output.headers["x-amz-cf-id"],
150
+ });
151
+ const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body));
152
+ const isSerializableHeaderValue = (value) => value !== undefined &&
153
+ value !== null &&
154
+ value !== "" &&
155
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
156
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
157
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
158
+ if (encoded.length) {
159
+ return JSON.parse(encoded);
160
+ }
161
+ return {};
162
+ });
163
+ const parseErrorBody = async (errorBody, context) => {
164
+ const value = await parseBody(errorBody, context);
165
+ value.message = value.message ?? value.Message;
166
+ return value;
167
+ };
168
+ const loadRestJsonErrorCode = (output, data) => {
169
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
170
+ const sanitizeErrorCode = (rawValue) => {
171
+ let cleanValue = rawValue;
172
+ if (typeof cleanValue === "number") {
173
+ cleanValue = cleanValue.toString();
174
+ }
175
+ if (cleanValue.indexOf(",") >= 0) {
176
+ cleanValue = cleanValue.split(",")[0];
177
+ }
178
+ if (cleanValue.indexOf(":") >= 0) {
179
+ cleanValue = cleanValue.split(":")[0];
180
+ }
181
+ if (cleanValue.indexOf("#") >= 0) {
182
+ cleanValue = cleanValue.split("#")[1];
183
+ }
184
+ return cleanValue;
185
+ };
186
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
187
+ if (headerKey !== undefined) {
188
+ return sanitizeErrorCode(output.headers[headerKey]);
189
+ }
190
+ if (data.code !== undefined) {
191
+ return sanitizeErrorCode(data.code);
192
+ }
193
+ if (data["__type"] !== undefined) {
194
+ return sanitizeErrorCode(data["__type"]);
195
+ }
196
+ };
@@ -0,0 +1,39 @@
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 util_body_length_browser_1 = require("@smithy/util-body-length-browser");
12
+ const util_retry_1 = require("@smithy/util-retry");
13
+ const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
14
+ const smithy_client_1 = require("@smithy/smithy-client");
15
+ const util_defaults_mode_browser_1 = require("@smithy/util-defaults-mode-browser");
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 ??
28
+ (0, util_user_agent_browser_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }),
29
+ maxAttempts: config?.maxAttempts ?? util_retry_1.DEFAULT_MAX_ATTEMPTS,
30
+ region: config?.region ?? (0, invalid_dependency_1.invalidProvider)("Region is missing"),
31
+ requestHandler: config?.requestHandler ?? new fetch_http_handler_1.FetchHttpHandler(defaultConfigProvider),
32
+ retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE),
33
+ sha256: config?.sha256 ?? sha256_browser_1.Sha256,
34
+ streamCollector: config?.streamCollector ?? fetch_http_handler_1.streamCollector,
35
+ useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(config_resolver_1.DEFAULT_USE_DUALSTACK_ENDPOINT)),
36
+ useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(config_resolver_1.DEFAULT_USE_FIPS_ENDPOINT)),
37
+ };
38
+ };
39
+ exports.getRuntimeConfig = getRuntimeConfig;
@@ -0,0 +1,50 @@
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_sts_1 = require("@aws-sdk/client-sts");
7
+ const core_1 = require("@aws-sdk/core");
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 util_body_length_node_1 = require("@smithy/util-body-length-node");
16
+ const util_retry_1 = require("@smithy/util-retry");
17
+ const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
18
+ const smithy_client_1 = require("@smithy/smithy-client");
19
+ const util_defaults_mode_node_1 = require("@smithy/util-defaults-mode-node");
20
+ const smithy_client_2 = require("@smithy/smithy-client");
21
+ const getRuntimeConfig = (config) => {
22
+ (0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version);
23
+ const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config);
24
+ const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode);
25
+ const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config);
26
+ (0, core_1.emitWarningIfUnsupportedVersion)(process.version);
27
+ return {
28
+ ...clientSharedValues,
29
+ ...config,
30
+ runtime: "node",
31
+ defaultsMode,
32
+ bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength,
33
+ credentialDefaultProvider: config?.credentialDefaultProvider ?? (0, client_sts_1.decorateDefaultCredentialProvider)(credential_provider_node_1.defaultProvider),
34
+ defaultUserAgentProvider: config?.defaultUserAgentProvider ??
35
+ (0, util_user_agent_node_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }),
36
+ maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
37
+ region: config?.region ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS),
38
+ requestHandler: config?.requestHandler ?? new node_http_handler_1.NodeHttpHandler(defaultConfigProvider),
39
+ retryMode: config?.retryMode ??
40
+ (0, node_config_provider_1.loadConfig)({
41
+ ...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS,
42
+ default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE,
43
+ }),
44
+ sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"),
45
+ streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector,
46
+ useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS),
47
+ useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS),
48
+ };
49
+ };
50
+ 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,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRuntimeConfig = void 0;
4
+ const smithy_client_1 = require("@smithy/smithy-client");
5
+ const url_parser_1 = require("@smithy/url-parser");
6
+ const util_base64_1 = require("@smithy/util-base64");
7
+ const util_utf8_1 = require("@smithy/util-utf8");
8
+ const endpointResolver_1 = require("./endpoint/endpointResolver");
9
+ const getRuntimeConfig = (config) => {
10
+ return {
11
+ apiVersion: "2023-08-08",
12
+ base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64,
13
+ base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64,
14
+ disableHostPrefix: config?.disableHostPrefix ?? false,
15
+ endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver,
16
+ extensions: config?.extensions ?? [],
17
+ logger: config?.logger ?? new smithy_client_1.NoOpLogger(),
18
+ serviceId: config?.serviceId ?? "Inspector Scan",
19
+ urlParser: config?.urlParser ?? url_parser_1.parseUrl,
20
+ utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8,
21
+ utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8,
22
+ };
23
+ };
24
+ exports.getRuntimeConfig = getRuntimeConfig;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveRuntimeExtensions = void 0;
4
+ const region_config_resolver_1 = require("@aws-sdk/region-config-resolver");
5
+ const protocol_http_1 = require("@smithy/protocol-http");
6
+ const smithy_client_1 = require("@smithy/smithy-client");
7
+ const asPartial = (t) => t;
8
+ const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
9
+ const extensionConfiguration = {
10
+ ...asPartial((0, region_config_resolver_1.getAwsRegionExtensionConfiguration)(runtimeConfig)),
11
+ ...asPartial((0, smithy_client_1.getDefaultExtensionConfiguration)(runtimeConfig)),
12
+ ...asPartial((0, protocol_http_1.getHttpHandlerExtensionConfiguration)(runtimeConfig)),
13
+ };
14
+ extensions.forEach((extension) => extension.configure(extensionConfiguration));
15
+ return {
16
+ ...runtimeConfig,
17
+ ...(0, region_config_resolver_1.resolveAwsRegionExtensionConfiguration)(extensionConfiguration),
18
+ ...(0, smithy_client_1.resolveDefaultRuntimeConfig)(extensionConfiguration),
19
+ ...(0, protocol_http_1.resolveHttpHandlerRuntimeConfig)(extensionConfiguration),
20
+ };
21
+ };
22
+ exports.resolveRuntimeExtensions = resolveRuntimeExtensions;
@@ -0,0 +1,9 @@
1
+ import { createAggregatedClient } from "@smithy/smithy-client";
2
+ import { ScanSbomCommand } from "./commands/ScanSbomCommand";
3
+ import { InspectorScanClient } from "./InspectorScanClient";
4
+ const commands = {
5
+ ScanSbomCommand,
6
+ };
7
+ export class InspectorScan extends InspectorScanClient {
8
+ }
9
+ createAggregatedClient(commands, InspectorScan);
@@ -0,0 +1,39 @@
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 { getAwsAuthPlugin, resolveAwsAuthConfig, } from "@aws-sdk/middleware-signing";
5
+ import { getUserAgentPlugin, resolveUserAgentConfig, } from "@aws-sdk/middleware-user-agent";
6
+ import { resolveRegionConfig } from "@smithy/config-resolver";
7
+ import { getContentLengthPlugin } from "@smithy/middleware-content-length";
8
+ import { resolveEndpointConfig } from "@smithy/middleware-endpoint";
9
+ import { getRetryPlugin, resolveRetryConfig } from "@smithy/middleware-retry";
10
+ import { Client as __Client, } from "@smithy/smithy-client";
11
+ import { resolveClientEndpointParameters, } from "./endpoint/EndpointParameters";
12
+ import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
13
+ import { resolveRuntimeExtensions } from "./runtimeExtensions";
14
+ export { __Client };
15
+ export class InspectorScanClient extends __Client {
16
+ constructor(...[configuration]) {
17
+ const _config_0 = __getRuntimeConfig(configuration || {});
18
+ const _config_1 = resolveClientEndpointParameters(_config_0);
19
+ const _config_2 = resolveRegionConfig(_config_1);
20
+ const _config_3 = resolveEndpointConfig(_config_2);
21
+ const _config_4 = resolveRetryConfig(_config_3);
22
+ const _config_5 = resolveHostHeaderConfig(_config_4);
23
+ const _config_6 = resolveAwsAuthConfig(_config_5);
24
+ const _config_7 = resolveUserAgentConfig(_config_6);
25
+ const _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []);
26
+ super(_config_8);
27
+ this.config = _config_8;
28
+ this.middlewareStack.use(getRetryPlugin(this.config));
29
+ this.middlewareStack.use(getContentLengthPlugin(this.config));
30
+ this.middlewareStack.use(getHostHeaderPlugin(this.config));
31
+ this.middlewareStack.use(getLoggerPlugin(this.config));
32
+ this.middlewareStack.use(getRecursionDetectionPlugin(this.config));
33
+ this.middlewareStack.use(getAwsAuthPlugin(this.config));
34
+ this.middlewareStack.use(getUserAgentPlugin(this.config));
35
+ }
36
+ destroy() {
37
+ super.destroy();
38
+ }
39
+ }
@@ -0,0 +1,47 @@
1
+ import { getEndpointPlugin } from "@smithy/middleware-endpoint";
2
+ import { getSerdePlugin } from "@smithy/middleware-serde";
3
+ import { Command as $Command } from "@smithy/smithy-client";
4
+ import { SMITHY_CONTEXT_KEY, } from "@smithy/types";
5
+ import { de_ScanSbomCommand, se_ScanSbomCommand } from "../protocols/Aws_restJson1";
6
+ export { $Command };
7
+ export class ScanSbomCommand extends $Command {
8
+ static getEndpointParameterInstructions() {
9
+ return {
10
+ UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
11
+ Endpoint: { type: "builtInParams", name: "endpoint" },
12
+ Region: { type: "builtInParams", name: "region" },
13
+ UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
14
+ };
15
+ }
16
+ constructor(input) {
17
+ super();
18
+ this.input = input;
19
+ }
20
+ resolveMiddleware(clientStack, configuration, options) {
21
+ this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
22
+ this.middlewareStack.use(getEndpointPlugin(configuration, ScanSbomCommand.getEndpointParameterInstructions()));
23
+ const stack = clientStack.concat(this.middlewareStack);
24
+ const { logger } = configuration;
25
+ const clientName = "InspectorScanClient";
26
+ const commandName = "ScanSbomCommand";
27
+ const handlerExecutionContext = {
28
+ logger,
29
+ clientName,
30
+ commandName,
31
+ inputFilterSensitiveLog: (_) => _,
32
+ outputFilterSensitiveLog: (_) => _,
33
+ [SMITHY_CONTEXT_KEY]: {
34
+ service: "InspectorScan",
35
+ operation: "ScanSbom",
36
+ },
37
+ };
38
+ const { requestHandler } = configuration;
39
+ return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
40
+ }
41
+ serialize(input, context) {
42
+ return se_ScanSbomCommand(input, context);
43
+ }
44
+ deserialize(output, context) {
45
+ return de_ScanSbomCommand(output, context);
46
+ }
47
+ }
@@ -0,0 +1 @@
1
+ export * from "./ScanSbomCommand";
@@ -0,0 +1,8 @@
1
+ export const resolveClientEndpointParameters = (options) => {
2
+ return {
3
+ ...options,
4
+ useDualstackEndpoint: options.useDualstackEndpoint ?? false,
5
+ useFipsEndpoint: options.useFipsEndpoint ?? false,
6
+ defaultSigningName: "inspector-scan",
7
+ };
8
+ };
@@ -0,0 +1,8 @@
1
+ import { resolveEndpoint } from "@smithy/util-endpoints";
2
+ import { ruleSet } from "./ruleset";
3
+ export const defaultEndpointResolver = (endpointParams, context = {}) => {
4
+ return resolveEndpoint(ruleSet, {
5
+ endpointParams: endpointParams,
6
+ logger: context.logger,
7
+ });
8
+ };
@@ -0,0 +1,4 @@
1
+ const s = "required", t = "fn", u = "argv", v = "ref";
2
+ const a = true, b = "isSet", c = "booleanEquals", d = "error", e = "endpoint", f = "tree", g = "PartitionResult", h = { [s]: false, "type": "String" }, i = { [s]: true, "default": false, "type": "Boolean" }, j = { [v]: "Endpoint" }, k = { [t]: c, [u]: [{ [v]: "UseFIPS" }, true] }, l = { [t]: c, [u]: [{ [v]: "UseDualStack" }, true] }, m = {}, n = { [t]: "getAttr", [u]: [{ [v]: g }, "supportsFIPS"] }, o = { [t]: c, [u]: [true, { [t]: "getAttr", [u]: [{ [v]: g }, "supportsDualStack"] }] }, p = [k], q = [l], r = [{ [v]: "Region" }];
3
+ const _data = { version: "1.0", parameters: { Region: h, UseDualStack: i, UseFIPS: i, Endpoint: h }, rules: [{ conditions: [{ [t]: b, [u]: [j] }], rules: [{ conditions: p, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: d }, { rules: [{ conditions: q, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: d }, { endpoint: { url: j, properties: m, headers: m }, type: e }], type: f }], type: f }, { rules: [{ conditions: [{ [t]: b, [u]: r }], rules: [{ conditions: [{ [t]: "aws.partition", [u]: r, assign: g }], rules: [{ conditions: [k, l], rules: [{ conditions: [{ [t]: c, [u]: [a, n] }, o], rules: [{ rules: [{ endpoint: { url: "https://inspector-scan-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: m, headers: m }, type: e }], type: f }], type: f }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: d }], type: f }, { conditions: p, rules: [{ conditions: [{ [t]: c, [u]: [n, a] }], rules: [{ rules: [{ endpoint: { url: "https://inspector-scan-fips.{Region}.{PartitionResult#dnsSuffix}", properties: m, headers: m }, type: e }], type: f }], type: f }, { error: "FIPS is enabled but this partition does not support FIPS", type: d }], type: f }, { conditions: q, rules: [{ conditions: [o], rules: [{ rules: [{ endpoint: { url: "https://inspector-scan.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: m, headers: m }, type: e }], type: f }], type: f }, { error: "DualStack is enabled but this partition does not support DualStack", type: d }], type: f }, { rules: [{ endpoint: { url: "https://inspector-scan.{Region}.{PartitionResult#dnsSuffix}", properties: m, headers: m }, type: e }], type: f }], type: f }], type: f }, { error: "Invalid Configuration: Missing Region", type: d }], type: f }] };
4
+ export const ruleSet = _data;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export * from "./InspectorScanClient";
2
+ export * from "./InspectorScan";
3
+ export * from "./commands";
4
+ export * from "./models";
5
+ import "@aws-sdk/util-endpoints";
6
+ export { InspectorScanServiceException } from "./models/InspectorScanServiceException";
@@ -0,0 +1,8 @@
1
+ import { ServiceException as __ServiceException, } from "@smithy/smithy-client";
2
+ export { __ServiceException };
3
+ export class InspectorScanServiceException extends __ServiceException {
4
+ constructor(options) {
5
+ super(options);
6
+ Object.setPrototypeOf(this, InspectorScanServiceException.prototype);
7
+ }
8
+ }
@@ -0,0 +1 @@
1
+ export * from "./models_0";
@@ -0,0 +1,73 @@
1
+ import { InspectorScanServiceException as __BaseException } from "./InspectorScanServiceException";
2
+ export class AccessDeniedException extends __BaseException {
3
+ constructor(opts) {
4
+ super({
5
+ name: "AccessDeniedException",
6
+ $fault: "client",
7
+ ...opts,
8
+ });
9
+ this.name = "AccessDeniedException";
10
+ this.$fault = "client";
11
+ Object.setPrototypeOf(this, AccessDeniedException.prototype);
12
+ }
13
+ }
14
+ export const InternalServerExceptionReason = {
15
+ FAILED_TO_GENERATE_SBOM: "FAILED_TO_GENERATE_SBOM",
16
+ OTHER: "OTHER",
17
+ };
18
+ export class InternalServerException extends __BaseException {
19
+ constructor(opts) {
20
+ super({
21
+ name: "InternalServerException",
22
+ $fault: "server",
23
+ ...opts,
24
+ });
25
+ this.name = "InternalServerException";
26
+ this.$fault = "server";
27
+ this.$retryable = {};
28
+ Object.setPrototypeOf(this, InternalServerException.prototype);
29
+ this.reason = opts.reason;
30
+ this.retryAfterSeconds = opts.retryAfterSeconds;
31
+ }
32
+ }
33
+ export const OutputFormat = {
34
+ CYCLONE_DX_1_5: "CYCLONE_DX_1_5",
35
+ INSPECTOR: "INSPECTOR",
36
+ };
37
+ export class ThrottlingException extends __BaseException {
38
+ constructor(opts) {
39
+ super({
40
+ name: "ThrottlingException",
41
+ $fault: "client",
42
+ ...opts,
43
+ });
44
+ this.name = "ThrottlingException";
45
+ this.$fault = "client";
46
+ this.$retryable = {
47
+ throttling: true,
48
+ };
49
+ Object.setPrototypeOf(this, ThrottlingException.prototype);
50
+ this.retryAfterSeconds = opts.retryAfterSeconds;
51
+ }
52
+ }
53
+ export const ValidationExceptionReason = {
54
+ CANNOT_PARSE: "CANNOT_PARSE",
55
+ FIELD_VALIDATION_FAILED: "FIELD_VALIDATION_FAILED",
56
+ OTHER: "OTHER",
57
+ UNKNOWN_OPERATION: "UNKNOWN_OPERATION",
58
+ UNSUPPORTED_SBOM_TYPE: "UNSUPPORTED_SBOM_TYPE",
59
+ };
60
+ export class ValidationException extends __BaseException {
61
+ constructor(opts) {
62
+ super({
63
+ name: "ValidationException",
64
+ $fault: "client",
65
+ ...opts,
66
+ });
67
+ this.name = "ValidationException";
68
+ this.$fault = "client";
69
+ Object.setPrototypeOf(this, ValidationException.prototype);
70
+ this.reason = opts.reason;
71
+ this.fields = opts.fields;
72
+ }
73
+ }