mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Type definitions for npm module: alks-node (#36628)
* initial commit for alks-node type definitions * linter formatting * added moment dependency * added ts 2.2 comment under header
This commit is contained in:
parent
6f203f860a
commit
40a2808bc0
48
types/alks-node/alks-node-tests.ts
Normal file
48
types/alks-node/alks-node-tests.ts
Normal file
@ -0,0 +1,48 @@
|
||||
import {
|
||||
Auth,
|
||||
Account,
|
||||
AwsKey,
|
||||
createIamKey,
|
||||
createIamRole,
|
||||
createIamTrustRole,
|
||||
createKey,
|
||||
createLongTermKey,
|
||||
deleteIamRole,
|
||||
deleteLongTermKey,
|
||||
generateConsoleUrl,
|
||||
getAccounts,
|
||||
getDurations,
|
||||
getIamRoleTypes,
|
||||
refreshTokenToAccessToken,
|
||||
} from 'alks-node';
|
||||
|
||||
const auth: Auth = {
|
||||
password: 'pass',
|
||||
token: 'token',
|
||||
};
|
||||
|
||||
const acct: Account = {
|
||||
alksAccount: 'alksAcct',
|
||||
alksRole: 'alksRole',
|
||||
server: 'server',
|
||||
userid: 'userId',
|
||||
};
|
||||
|
||||
const awsKey: AwsKey = {
|
||||
accessKey: 'accessKey',
|
||||
secretKey: 'secretKey',
|
||||
sessionToken: 'sessionToken',
|
||||
};
|
||||
|
||||
createIamKey(acct, auth, 1, {}, () => {});
|
||||
createIamRole(acct, auth, 'roleName', 'roleType', true, {}, () => {});
|
||||
createIamTrustRole(acct, auth, 'roleName', 'roleType', 'trustArn', {}, () => {});
|
||||
createKey(acct, auth, 1, {}, () => {});
|
||||
createLongTermKey(acct, auth, 'iamUserName', {}, () => {});
|
||||
deleteIamRole(acct, auth, 'roleName', {}, () => {});
|
||||
deleteLongTermKey(acct, auth, 'iamUserName', {}, () => {});
|
||||
generateConsoleUrl(awsKey, {}, () => {});
|
||||
getAccounts('server', 'userId', auth, {}, () => {});
|
||||
getDurations(acct, auth, {}, () => {});
|
||||
getIamRoleTypes('server', 'userId', auth, {}, () => {});
|
||||
refreshTokenToAccessToken(acct, 'token', {}, () => {});
|
||||
125
types/alks-node/index.d.ts
vendored
Normal file
125
types/alks-node/index.d.ts
vendored
Normal file
@ -0,0 +1,125 @@
|
||||
// Type definitions for alks-node 0.9
|
||||
// Project: https://github.com/Cox-Automotive/alks-node#readme
|
||||
// Definitions by: Matt Hoang <https://github.com/matthoang08>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import { Moment } from 'moment';
|
||||
|
||||
export interface Auth {
|
||||
token?: string;
|
||||
password?: string;
|
||||
}
|
||||
export interface Account {
|
||||
userid: string;
|
||||
server: string;
|
||||
alksAccount: string;
|
||||
alksRole: string;
|
||||
}
|
||||
export interface AlksAccount {
|
||||
account: string;
|
||||
role: string;
|
||||
iam?: boolean;
|
||||
}
|
||||
export interface LongTermKeyData {
|
||||
accessKey: string;
|
||||
secretKey: string;
|
||||
iamUserName: string;
|
||||
iamUserArn: string;
|
||||
alksAccount: string;
|
||||
alksRole: string;
|
||||
}
|
||||
export interface KeyData {
|
||||
accessKey: string;
|
||||
secretKey: string;
|
||||
sessionToken: string;
|
||||
alksAccount: string;
|
||||
alksRole: string;
|
||||
sessionTime: string;
|
||||
expires: Moment;
|
||||
}
|
||||
export interface AwsKey {
|
||||
accessKey: string;
|
||||
secretKey: string;
|
||||
sessionToken: string;
|
||||
}
|
||||
export function getDurations(
|
||||
account: Account,
|
||||
auth: Auth,
|
||||
opts: object,
|
||||
callback: (err: Error, duration: number[]) => void
|
||||
): void;
|
||||
export function createKey(
|
||||
account: Account,
|
||||
auth: Auth,
|
||||
duration: number,
|
||||
opts: object,
|
||||
callback: (err: Error, key: KeyData) => void
|
||||
): void;
|
||||
export function createIamKey(
|
||||
account: Account,
|
||||
auth: Auth,
|
||||
duration: number,
|
||||
opts: object,
|
||||
callback: (err: Error, key: KeyData) => void
|
||||
): void;
|
||||
export function createLongTermKey(
|
||||
account: Account,
|
||||
auth: Auth,
|
||||
iamUserName: string,
|
||||
opts: object,
|
||||
callback: (err: Error, data: LongTermKeyData) => void
|
||||
): void;
|
||||
export function createIamRole(
|
||||
account: Account,
|
||||
auth: Auth,
|
||||
roleName: string,
|
||||
roleType: string,
|
||||
includeDefaultPolicies: boolean,
|
||||
opts: object,
|
||||
callback: (err: Error, body: any) => void
|
||||
): void;
|
||||
export function createIamTrustRole(
|
||||
account: Account,
|
||||
auth: Auth,
|
||||
roleName: string,
|
||||
roleType: string,
|
||||
trustArn: string,
|
||||
opts: object,
|
||||
callback: (err: Error, body: any) => void
|
||||
): void;
|
||||
export function getAccounts(
|
||||
server: string,
|
||||
userid: string,
|
||||
auth: Auth,
|
||||
opts: object,
|
||||
callback: (err: Error, accounts: AlksAccount[]) => void
|
||||
): void;
|
||||
export function getIamRoleTypes(
|
||||
server: string,
|
||||
userid: string,
|
||||
auth: Auth,
|
||||
opts: object,
|
||||
callback: (err: Error, body: any) => void
|
||||
): void;
|
||||
export function generateConsoleUrl(key: AwsKey, opts: object, callback: (err: Error, url: string) => void): void;
|
||||
export function deleteIamRole(
|
||||
account: Account,
|
||||
auth: Auth,
|
||||
roleName: string,
|
||||
opts: object,
|
||||
callback: (err: Error, body: any) => void
|
||||
): void;
|
||||
export function deleteLongTermKey(
|
||||
account: Account,
|
||||
auth: Auth,
|
||||
iamUserName: string,
|
||||
opts: object,
|
||||
callback: (err: Error, body: any) => void
|
||||
): void;
|
||||
export function refreshTokenToAccessToken(
|
||||
account: Account,
|
||||
token: string,
|
||||
opts: object,
|
||||
callback: (err: Error, body: any) => void
|
||||
): void;
|
||||
6
types/alks-node/package.json
Normal file
6
types/alks-node/package.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"moment": ">=2.15.2"
|
||||
}
|
||||
}
|
||||
23
types/alks-node/tsconfig.json
Normal file
23
types/alks-node/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"alks-node-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/alks-node/tslint.json
Normal file
1
types/alks-node/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user