UNPKG

failure-lambda

Version:

Failure injection for AWS Lambda - chaos engineering made simple

580 lines (565 loc) 21.5 kB
#!/usr/bin/env node import { awsEndpointFunctions, package_default } from "./chunk-UQQPU6QH.js"; import { createAggregatedClient } from "./chunk-V4BSKZG7.js"; import { AwsRestJsonProtocol } from "./chunk-ZJL5KTIU.js"; import { AwsSdkSigV4Signer, Client, Command, DEFAULT_RETRY_MODE, DefaultIdentityProviderConfig, EndpointCache, Hash, NODE_APP_ID_CONFIG_OPTIONS, NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS, NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, NoAuthSigner, NoOpLogger, ServiceException, TypeRegistry, calculateBodyLength, createDefaultUserAgentProvider, customEndpointFunctions, emitWarningIfUnsupportedVersion, emitWarningIfUnsupportedVersion2, getAwsRegionExtensionConfiguration, getContentLengthPlugin, getDefaultExtensionConfiguration, getEndpointPlugin, getHostHeaderPlugin, getHttpAuthSchemeEndpointRuleSetPlugin, getHttpHandlerExtensionConfiguration, getHttpSigningPlugin, getLoggerPlugin, getRecursionDetectionPlugin, getRetryPlugin, getSchemaSerdePlugin, getSmithyContext, getUserAgentPlugin, loadConfigsForDefaultMode, normalizeProvider, resolveAwsRegionExtensionConfiguration, resolveAwsSdkSigV4Config, resolveDefaultRuntimeConfig, resolveDefaultsModeConfig, resolveEndpoint, resolveEndpointConfig, resolveHostHeaderConfig, resolveHttpHandlerRuntimeConfig, resolveRegionConfig, resolveRetryConfig, resolveUserAgentConfig } from "./chunk-762XZWE7.js"; import { loadConfig, parseUrl } from "./chunk-2345QE66.js"; import "./chunk-LILC4PLL.js"; import "./chunk-52D4AVIU.js"; import "./chunk-VSWURCYJ.js"; import { NodeHttpHandler, fromBase64, streamCollector, toBase64 } from "./chunk-W3M6RT2M.js"; import "./chunk-XDZ73E2B.js"; import { fromUtf8, toUtf8 } from "./chunk-VACN7GDP.js"; import "./chunk-S6KKH4HA.js"; import "./chunk-M4AFYEP7.js"; import "./chunk-UT3JLF3M.js"; // node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/auth/httpAuthSchemeProvider.js var defaultSigninHttpAuthSchemeParametersProvider = async (config, context, input) => { return { operation: getSmithyContext(context).operation, region: await normalizeProvider(config.region)() || (() => { throw new Error("expected `region` to be configured for `aws.auth#sigv4`"); })() }; }; function createAwsAuthSigv4HttpAuthOption(authParameters) { return { schemeId: "aws.auth#sigv4", signingProperties: { name: "signin", region: authParameters.region }, propertiesExtractor: (config, context) => ({ signingProperties: { config, context } }) }; } function createSmithyApiNoAuthHttpAuthOption(authParameters) { return { schemeId: "smithy.api#noAuth" }; } var defaultSigninHttpAuthSchemeProvider = (authParameters) => { const options = []; switch (authParameters.operation) { case "CreateOAuth2Token": { options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); break; } default: { options.push(createAwsAuthSigv4HttpAuthOption(authParameters)); } } return options; }; var resolveHttpAuthSchemeConfig = (config) => { const config_0 = resolveAwsSdkSigV4Config(config); return Object.assign(config_0, { authSchemePreference: normalizeProvider(config.authSchemePreference ?? []) }); }; // node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/endpoint/EndpointParameters.js var resolveClientEndpointParameters = (options) => { return Object.assign(options, { useDualstackEndpoint: options.useDualstackEndpoint ?? false, useFipsEndpoint: options.useFipsEndpoint ?? false, defaultSigningName: "signin" }); }; var commonParams = { UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, Endpoint: { type: "builtInParams", name: "endpoint" }, Region: { type: "builtInParams", name: "region" }, UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } }; // node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/endpoint/ruleset.js var u = "required"; var v = "fn"; var w = "argv"; var x = "ref"; var a = true; var b = "isSet"; var c = "booleanEquals"; var d = "error"; var e = "endpoint"; var f = "tree"; var g = "PartitionResult"; var h = "stringEquals"; var i = { [u]: true, "default": false, "type": "boolean" }; var j = { [u]: false, "type": "string" }; var k = { [x]: "Endpoint" }; var l = { [v]: c, [w]: [{ [x]: "UseFIPS" }, true] }; var m = { [v]: c, [w]: [{ [x]: "UseDualStack" }, true] }; var n = {}; var o = { [v]: "getAttr", [w]: [{ [x]: g }, "name"] }; var p = { [v]: c, [w]: [{ [x]: "UseFIPS" }, false] }; var q = { [v]: c, [w]: [{ [x]: "UseDualStack" }, false] }; var r = { [v]: "getAttr", [w]: [{ [x]: g }, "supportsFIPS"] }; var s = { [v]: c, [w]: [true, { [v]: "getAttr", [w]: [{ [x]: g }, "supportsDualStack"] }] }; var t = [{ [x]: "Region" }]; var _data = { version: "1.0", parameters: { UseDualStack: i, UseFIPS: i, Endpoint: j, Region: j }, rules: [{ conditions: [{ [v]: b, [w]: [k] }], rules: [{ conditions: [l], error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: d }, { rules: [{ conditions: [m], error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: d }, { endpoint: { url: k, properties: n, headers: n }, type: e }], type: f }], type: f }, { rules: [{ conditions: [{ [v]: b, [w]: t }], rules: [{ conditions: [{ [v]: "aws.partition", [w]: t, assign: g }], rules: [{ conditions: [{ [v]: h, [w]: [o, "aws"] }, p, q], endpoint: { url: "https://{Region}.signin.aws.amazon.com", properties: n, headers: n }, type: e }, { conditions: [{ [v]: h, [w]: [o, "aws-cn"] }, p, q], endpoint: { url: "https://{Region}.signin.amazonaws.cn", properties: n, headers: n }, type: e }, { conditions: [{ [v]: h, [w]: [o, "aws-us-gov"] }, p, q], endpoint: { url: "https://{Region}.signin.amazonaws-us-gov.com", properties: n, headers: n }, type: e }, { conditions: [l, m], rules: [{ conditions: [{ [v]: c, [w]: [a, r] }, s], rules: [{ endpoint: { url: "https://signin-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: d }], type: f }, { conditions: [l, q], rules: [{ conditions: [{ [v]: c, [w]: [r, a] }], rules: [{ endpoint: { url: "https://signin-fips.{Region}.{PartitionResult#dnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "FIPS is enabled but this partition does not support FIPS", type: d }], type: f }, { conditions: [p, m], rules: [{ conditions: [s], rules: [{ endpoint: { url: "https://signin.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "DualStack is enabled but this partition does not support DualStack", type: d }], type: f }, { endpoint: { url: "https://signin.{Region}.{PartitionResult#dnsSuffix}", properties: n, headers: n }, type: e }], type: f }], type: f }, { error: "Invalid Configuration: Missing Region", type: d }], type: f }] }; var ruleSet = _data; // node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/endpoint/endpointResolver.js var cache = new EndpointCache({ size: 50, params: ["Endpoint", "Region", "UseDualStack", "UseFIPS"] }); var defaultEndpointResolver = (endpointParams, context = {}) => { return cache.get(endpointParams, () => resolveEndpoint(ruleSet, { endpointParams, logger: context.logger })); }; customEndpointFunctions.aws = awsEndpointFunctions; // node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/models/SigninServiceException.js var SigninServiceException = class _SigninServiceException extends ServiceException { constructor(options) { super(options); Object.setPrototypeOf(this, _SigninServiceException.prototype); } }; // node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/models/errors.js var AccessDeniedException = class _AccessDeniedException extends SigninServiceException { name = "AccessDeniedException"; $fault = "client"; error; constructor(opts) { super({ name: "AccessDeniedException", $fault: "client", ...opts }); Object.setPrototypeOf(this, _AccessDeniedException.prototype); this.error = opts.error; } }; var InternalServerException = class _InternalServerException extends SigninServiceException { name = "InternalServerException"; $fault = "server"; error; constructor(opts) { super({ name: "InternalServerException", $fault: "server", ...opts }); Object.setPrototypeOf(this, _InternalServerException.prototype); this.error = opts.error; } }; var TooManyRequestsError = class _TooManyRequestsError extends SigninServiceException { name = "TooManyRequestsError"; $fault = "client"; error; constructor(opts) { super({ name: "TooManyRequestsError", $fault: "client", ...opts }); Object.setPrototypeOf(this, _TooManyRequestsError.prototype); this.error = opts.error; } }; var ValidationException = class _ValidationException extends SigninServiceException { name = "ValidationException"; $fault = "client"; error; constructor(opts) { super({ name: "ValidationException", $fault: "client", ...opts }); Object.setPrototypeOf(this, _ValidationException.prototype); this.error = opts.error; } }; // node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/schemas/schemas_0.js var _ADE = "AccessDeniedException"; var _AT = "AccessToken"; var _COAT = "CreateOAuth2Token"; var _COATR = "CreateOAuth2TokenRequest"; var _COATRB = "CreateOAuth2TokenRequestBody"; var _COATRBr = "CreateOAuth2TokenResponseBody"; var _COATRr = "CreateOAuth2TokenResponse"; var _ISE = "InternalServerException"; var _RT = "RefreshToken"; var _TMRE = "TooManyRequestsError"; var _VE = "ValidationException"; var _aKI = "accessKeyId"; var _aT = "accessToken"; var _c = "client"; var _cI = "clientId"; var _cV = "codeVerifier"; var _co = "code"; var _e = "error"; var _eI = "expiresIn"; var _gT = "grantType"; var _h = "http"; var _hE = "httpError"; var _iT = "idToken"; var _jN = "jsonName"; var _m = "message"; var _rT = "refreshToken"; var _rU = "redirectUri"; var _s = "smithy.ts.sdk.synthetic.com.amazonaws.signin"; var _sAK = "secretAccessKey"; var _sT = "sessionToken"; var _se = "server"; var _tI = "tokenInput"; var _tO = "tokenOutput"; var _tT = "tokenType"; var n0 = "com.amazonaws.signin"; var _s_registry = TypeRegistry.for(_s); var SigninServiceException$ = [-3, _s, "SigninServiceException", 0, [], []]; _s_registry.registerError(SigninServiceException$, SigninServiceException); var n0_registry = TypeRegistry.for(n0); var AccessDeniedException$ = [-3, n0, _ADE, { [_e]: _c }, [_e, _m], [0, 0], 2]; n0_registry.registerError(AccessDeniedException$, AccessDeniedException); var InternalServerException$ = [-3, n0, _ISE, { [_e]: _se, [_hE]: 500 }, [_e, _m], [0, 0], 2]; n0_registry.registerError(InternalServerException$, InternalServerException); var TooManyRequestsError$ = [-3, n0, _TMRE, { [_e]: _c, [_hE]: 429 }, [_e, _m], [0, 0], 2]; n0_registry.registerError(TooManyRequestsError$, TooManyRequestsError); var ValidationException$ = [-3, n0, _VE, { [_e]: _c, [_hE]: 400 }, [_e, _m], [0, 0], 2]; n0_registry.registerError(ValidationException$, ValidationException); var errorTypeRegistries = [_s_registry, n0_registry]; var RefreshToken = [0, n0, _RT, 8, 0]; var AccessToken$ = [ 3, n0, _AT, 8, [_aKI, _sAK, _sT], [ [0, { [_jN]: _aKI }], [0, { [_jN]: _sAK }], [0, { [_jN]: _sT }] ], 3 ]; var CreateOAuth2TokenRequest$ = [ 3, n0, _COATR, 0, [_tI], [[() => CreateOAuth2TokenRequestBody$, 16]], 1 ]; var CreateOAuth2TokenRequestBody$ = [ 3, n0, _COATRB, 0, [_cI, _gT, _co, _rU, _cV, _rT], [ [0, { [_jN]: _cI }], [0, { [_jN]: _gT }], 0, [0, { [_jN]: _rU }], [0, { [_jN]: _cV }], [() => RefreshToken, { [_jN]: _rT }] ], 2 ]; var CreateOAuth2TokenResponse$ = [ 3, n0, _COATRr, 0, [_tO], [[() => CreateOAuth2TokenResponseBody$, 16]], 1 ]; var CreateOAuth2TokenResponseBody$ = [ 3, n0, _COATRBr, 0, [_aT, _tT, _eI, _rT, _iT], [ [() => AccessToken$, { [_jN]: _aT }], [0, { [_jN]: _tT }], [1, { [_jN]: _eI }], [() => RefreshToken, { [_jN]: _rT }], [0, { [_jN]: _iT }] ], 4 ]; var CreateOAuth2Token$ = [ 9, n0, _COAT, { [_h]: ["POST", "/v1/token", 200] }, () => CreateOAuth2TokenRequest$, () => CreateOAuth2TokenResponse$ ]; // node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/runtimeConfig.shared.js var getRuntimeConfig = (config) => { return { apiVersion: "2023-01-01", base64Decoder: config?.base64Decoder ?? fromBase64, base64Encoder: config?.base64Encoder ?? toBase64, disableHostPrefix: config?.disableHostPrefix ?? false, endpointProvider: config?.endpointProvider ?? defaultEndpointResolver, extensions: config?.extensions ?? [], httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultSigninHttpAuthSchemeProvider, httpAuthSchemes: config?.httpAuthSchemes ?? [ { schemeId: "aws.auth#sigv4", identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"), signer: new AwsSdkSigV4Signer() }, { schemeId: "smithy.api#noAuth", identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})), signer: new NoAuthSigner() } ], logger: config?.logger ?? new NoOpLogger(), protocol: config?.protocol ?? AwsRestJsonProtocol, protocolSettings: config?.protocolSettings ?? { defaultNamespace: "com.amazonaws.signin", errorTypeRegistries, version: "2023-01-01", serviceTarget: "Signin" }, serviceId: config?.serviceId ?? "Signin", urlParser: config?.urlParser ?? parseUrl, utf8Decoder: config?.utf8Decoder ?? fromUtf8, utf8Encoder: config?.utf8Encoder ?? toUtf8 }; }; // node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/runtimeConfig.js var getRuntimeConfig2 = (config) => { emitWarningIfUnsupportedVersion2(process.version); const defaultsMode = resolveDefaultsModeConfig(config); const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode); const clientSharedValues = getRuntimeConfig(config); emitWarningIfUnsupportedVersion(process.version); const loaderConfig = { profile: config?.profile, logger: clientSharedValues.logger }; return { ...clientSharedValues, ...config, runtime: "node", defaultsMode, authSchemePreference: config?.authSchemePreference ?? loadConfig(NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig), bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, defaultUserAgentProvider: config?.defaultUserAgentProvider ?? createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: package_default.version }), maxAttempts: config?.maxAttempts ?? loadConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config), region: config?.region ?? loadConfig(NODE_REGION_CONFIG_OPTIONS, { ...NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }), requestHandler: NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider), retryMode: config?.retryMode ?? loadConfig({ ...NODE_RETRY_MODE_CONFIG_OPTIONS, default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE }, config), sha256: config?.sha256 ?? Hash.bind(null, "sha256"), streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? loadConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig), useFipsEndpoint: config?.useFipsEndpoint ?? loadConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig), userAgentAppId: config?.userAgentAppId ?? loadConfig(NODE_APP_ID_CONFIG_OPTIONS, loaderConfig) }; }; // node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/auth/httpAuthExtensionConfiguration.js var getHttpAuthExtensionConfiguration = (runtimeConfig) => { const _httpAuthSchemes = runtimeConfig.httpAuthSchemes; let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider; let _credentials = runtimeConfig.credentials; return { setHttpAuthScheme(httpAuthScheme) { const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId); if (index === -1) { _httpAuthSchemes.push(httpAuthScheme); } else { _httpAuthSchemes.splice(index, 1, httpAuthScheme); } }, httpAuthSchemes() { return _httpAuthSchemes; }, setHttpAuthSchemeProvider(httpAuthSchemeProvider) { _httpAuthSchemeProvider = httpAuthSchemeProvider; }, httpAuthSchemeProvider() { return _httpAuthSchemeProvider; }, setCredentials(credentials) { _credentials = credentials; }, credentials() { return _credentials; } }; }; var resolveHttpAuthRuntimeConfig = (config) => { return { httpAuthSchemes: config.httpAuthSchemes(), httpAuthSchemeProvider: config.httpAuthSchemeProvider(), credentials: config.credentials() }; }; // node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/runtimeExtensions.js var resolveRuntimeExtensions = (runtimeConfig, extensions) => { const extensionConfiguration = Object.assign(getAwsRegionExtensionConfiguration(runtimeConfig), getDefaultExtensionConfiguration(runtimeConfig), getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration(runtimeConfig)); extensions.forEach((extension) => extension.configure(extensionConfiguration)); return Object.assign(runtimeConfig, resolveAwsRegionExtensionConfiguration(extensionConfiguration), resolveDefaultRuntimeConfig(extensionConfiguration), resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig(extensionConfiguration)); }; // node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/SigninClient.js var SigninClient = class extends Client { config; constructor(...[configuration]) { const _config_0 = getRuntimeConfig2(configuration || {}); super(_config_0); this.initConfig = _config_0; const _config_1 = resolveClientEndpointParameters(_config_0); const _config_2 = resolveUserAgentConfig(_config_1); const _config_3 = resolveRetryConfig(_config_2); const _config_4 = resolveRegionConfig(_config_3); const _config_5 = resolveHostHeaderConfig(_config_4); const _config_6 = resolveEndpointConfig(_config_5); const _config_7 = resolveHttpAuthSchemeConfig(_config_6); const _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []); this.config = _config_8; this.middlewareStack.use(getSchemaSerdePlugin(this.config)); this.middlewareStack.use(getUserAgentPlugin(this.config)); this.middlewareStack.use(getRetryPlugin(this.config)); this.middlewareStack.use(getContentLengthPlugin(this.config)); this.middlewareStack.use(getHostHeaderPlugin(this.config)); this.middlewareStack.use(getLoggerPlugin(this.config)); this.middlewareStack.use(getRecursionDetectionPlugin(this.config)); this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin(this.config, { httpAuthSchemeParametersProvider: defaultSigninHttpAuthSchemeParametersProvider, identityProviderConfigProvider: async (config) => new DefaultIdentityProviderConfig({ "aws.auth#sigv4": config.credentials }) })); this.middlewareStack.use(getHttpSigningPlugin(this.config)); } destroy() { super.destroy(); } }; // node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/commands/CreateOAuth2TokenCommand.js var CreateOAuth2TokenCommand = class extends Command.classBuilder().ep(commonParams).m(function(Command2, cs, config, o2) { return [getEndpointPlugin(config, Command2.getEndpointParameterInstructions())]; }).s("Signin", "CreateOAuth2Token", {}).n("SigninClient", "CreateOAuth2TokenCommand").sc(CreateOAuth2Token$).build() { }; // node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/Signin.js var commands = { CreateOAuth2TokenCommand }; var Signin = class extends SigninClient { }; createAggregatedClient(commands, Signin); // node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/models/enums.js var OAuth2ErrorCode = { AUTHCODE_EXPIRED: "AUTHCODE_EXPIRED", INSUFFICIENT_PERMISSIONS: "INSUFFICIENT_PERMISSIONS", INVALID_REQUEST: "INVALID_REQUEST", SERVER_ERROR: "server_error", TOKEN_EXPIRED: "TOKEN_EXPIRED", USER_CREDENTIALS_CHANGED: "USER_CREDENTIALS_CHANGED" }; export { Command as $Command, AccessDeniedException, AccessDeniedException$, AccessToken$, CreateOAuth2Token$, CreateOAuth2TokenCommand, CreateOAuth2TokenRequest$, CreateOAuth2TokenRequestBody$, CreateOAuth2TokenResponse$, CreateOAuth2TokenResponseBody$, InternalServerException, InternalServerException$, OAuth2ErrorCode, Signin, SigninClient, SigninServiceException, SigninServiceException$, TooManyRequestsError, TooManyRequestsError$, ValidationException, ValidationException$, Client as __Client, errorTypeRegistries }; //# sourceMappingURL=signin-I7NDWTHQ.js.map