[@types/vault-auth-aws] Add types for vault-auth-aws NPM packa… (#40509)

* add vault-auth-aws

* fix interface
This commit is contained in:
Nathan McGinn 2019-11-19 17:53:55 -06:00 committed by Sheetal Nandi
parent f7da07be7b
commit 3ceab7a9a2
4 changed files with 89 additions and 0 deletions

41
types/vault-auth-aws/index.d.ts vendored Normal file
View File

@ -0,0 +1,41 @@
// Type definitions for vault-auth-aws 0.1
// Project: https://github.com/abdullahshahin/vault-auth-aws
// Definitions by: Nathan McGinn <https://github.com/nmcginn>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.7
/// <reference types="node" />
declare class vaultAuthAws {
constructor(config?: vaultAuthAws.Config);
authenticate(): Promise<any>;
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;

View File

@ -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"
]
}

View File

@ -0,0 +1 @@
{"extends":"dtslint/dt.json"}

View File

@ -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());