UNPKG

serverless-vpc-discovery

Version:
29 lines (28 loc) 1.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const util_retry_1 = require("@smithy/util-retry"); const credential_providers_1 = require("@aws-sdk/credential-providers"); class Globals { static pluginName = "Serverless VPC Discovery"; static serverless; static options; static v3Utils; static currentRegion; static credentials; static defaultRegion = "us-east-1"; static getRegion() { const slsRegion = Globals.options.region || Globals.serverless.service.provider.region; return slsRegion || Globals.currentRegion || Globals.defaultRegion; } static async getProfileCreds(profile) { return await (0, credential_providers_1.fromIni)({ profile })(); } static getRetryStrategy(attempts = 3, delay = 3000, backoff = 500) { return new util_retry_1.ConfiguredRetryStrategy(attempts, // max attempts. // This example sets the backoff at 500ms plus 3s per attempt. // https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_util_retry.html#aws-sdkutil-retry (attempt) => backoff + attempt * delay // backoff function. ); } } exports.default = Globals;