From 3ceab7a9a2a3387e5b3d400a1036b36b1e413cd2 Mon Sep 17 00:00:00 2001 From: Nathan McGinn Date: Tue, 19 Nov 2019 17:53:55 -0600 Subject: [PATCH] =?UTF-8?q?[@types/vault-auth-aws]=20Add=20types=20for=20v?= =?UTF-8?q?ault-auth-aws=20NPM=20packa=E2=80=A6=20(#40509)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add vault-auth-aws * fix interface --- types/vault-auth-aws/index.d.ts | 41 ++++++++++++++++++++ types/vault-auth-aws/tsconfig.json | 23 +++++++++++ types/vault-auth-aws/tslint.json | 1 + types/vault-auth-aws/vault-auth-aws-tests.ts | 24 ++++++++++++ 4 files changed, 89 insertions(+) create mode 100644 types/vault-auth-aws/index.d.ts create mode 100644 types/vault-auth-aws/tsconfig.json create mode 100644 types/vault-auth-aws/tslint.json create mode 100644 types/vault-auth-aws/vault-auth-aws-tests.ts diff --git a/types/vault-auth-aws/index.d.ts b/types/vault-auth-aws/index.d.ts new file mode 100644 index 0000000000..f5f378122a --- /dev/null +++ b/types/vault-auth-aws/index.d.ts @@ -0,0 +1,41 @@ +// Type definitions for vault-auth-aws 0.1 +// Project: https://github.com/abdullahshahin/vault-auth-aws +// Definitions by: Nathan McGinn +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.7 +/// + +declare class vaultAuthAws { + constructor(config?: vaultAuthAws.Config); + authenticate(): Promise; + getOptions(creds: vaultAuthAws.Creds): vaultAuthAws.Options; +} + +declare namespace vaultAuthAws { + interface Config { + ssl?: boolean; + host?: string; + port?: number; + apiVersion?: string; + vaultLoginUrl?: string; + vaultAppName?: string; + followAllRedirects?: boolean; + certFilePath?: string; + sslRejectUnAuthorized?: boolean; + } + + interface Creds { + accessKeyId?: string; + secretAccessKey?: string; + sessionToken?: string; + } + + interface Options { + url: string; + followAllRedirects: boolean; + body: string; + cert?: Buffer; + } +} + +export = vaultAuthAws; diff --git a/types/vault-auth-aws/tsconfig.json b/types/vault-auth-aws/tsconfig.json new file mode 100644 index 0000000000..e362f48737 --- /dev/null +++ b/types/vault-auth-aws/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "vault-auth-aws-tests.ts" + ] +} \ No newline at end of file diff --git a/types/vault-auth-aws/tslint.json b/types/vault-auth-aws/tslint.json new file mode 100644 index 0000000000..160645963f --- /dev/null +++ b/types/vault-auth-aws/tslint.json @@ -0,0 +1 @@ +{"extends":"dtslint/dt.json"} \ No newline at end of file diff --git a/types/vault-auth-aws/vault-auth-aws-tests.ts b/types/vault-auth-aws/vault-auth-aws-tests.ts new file mode 100644 index 0000000000..b42d29cdc8 --- /dev/null +++ b/types/vault-auth-aws/vault-auth-aws-tests.ts @@ -0,0 +1,24 @@ +import vaultAuthAws = require('vault-auth-aws'); + +const config: vaultAuthAws.Config = { + ssl: false, + host: 'localhost', + port: 3000, + apiVersion: 'v1', + vaultLoginUrl: 'auth/aws/login', + vaultAppName: '', + followAllRedirects: true, + certFilePath: undefined, + sslRejectUnAuthorized: true +}; + +const creds: vaultAuthAws.Creds = { + accessKeyId: '', + secretAccessKey: '', + sessionToken: '' +}; + +const vault = new vaultAuthAws(config); + +vault.getOptions(creds); +Promise.resolve(vault.authenticate());