mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 19:43:20 +08:00
added types for eureka-js-client
This commit is contained in:
21
types/eureka-js-client/eureka-js-client-tests.ts
Normal file
21
types/eureka-js-client/eureka-js-client-tests.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Eureka } from 'eureka-js-client';
|
||||
|
||||
// example configuration
|
||||
let client = new Eureka({
|
||||
// application instance information
|
||||
instance: {
|
||||
app: 'jqservice',
|
||||
hostName: 'localhost',
|
||||
ipAddr: '127.0.0.1',
|
||||
port: 8080,
|
||||
vipAddress: 'jq.test.something.com',
|
||||
dataCenterInfo: {
|
||||
name: 'MyOwn',
|
||||
},
|
||||
},
|
||||
eureka: {
|
||||
// eureka server host / port
|
||||
host: '192.168.99.100',
|
||||
port: 32768,
|
||||
}
|
||||
});
|
||||
80
types/eureka-js-client/index.d.ts
vendored
Normal file
80
types/eureka-js-client/index.d.ts
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
// Type definitions for eureka-js-client 4.3.0
|
||||
// Project: https://github.com/jquatier/eureka-js-client
|
||||
// Definitions by: Ilko Hoffmann <https://github.com/Schnillz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export declare class Eureka {
|
||||
constructor(config: EurekaClient.EurekaConfig)
|
||||
start(): void;
|
||||
stop(): void;
|
||||
getInstancesByAppId(appId: string): Array<string>;
|
||||
getInstancesByVipAddress(vidAddress: string): Array<string>;
|
||||
}
|
||||
|
||||
declare namespace EurekaClient {
|
||||
|
||||
type InstanceStatus = 'UP' | 'DOWN' | 'STARTING' | 'OUT_OF_SERVICE' | 'UNKNOWN';
|
||||
type ActionType = 'ADDED' | 'MODIFIED' | 'DELETED';
|
||||
|
||||
interface EurekaConfig {
|
||||
instance: EurekaInstanceConfig,
|
||||
eureka: EurekaClientConfig
|
||||
}
|
||||
interface EurekaInstanceConfig {
|
||||
app: string,
|
||||
hostName: string,
|
||||
ipAddr: string,
|
||||
vipAddress: string,
|
||||
dataCenterInfo: DataCenterInfo,
|
||||
port?: number,
|
||||
instanceId?: string,
|
||||
appGroupName?: string,
|
||||
sid?: string,
|
||||
securePort?: PortWrapper,
|
||||
homePageUrl?: string,
|
||||
statusPageUrl?: string,
|
||||
healthCheckUrl?: string,
|
||||
secureHealthCheckUrl?: string,
|
||||
secureVipAddress?: string,
|
||||
countryId?: number,
|
||||
status?: InstanceStatus,
|
||||
overriddenstatus?: InstanceStatus,
|
||||
leaseInfo?: LeaseInfo,
|
||||
isCoordinatingDiscoveryServer?: boolean,
|
||||
metadata?: Array<[string, string]>,
|
||||
lastUpdatedTimestamp?: number,
|
||||
lastDirtyTimestamp?: number,
|
||||
actionType?: ActionType,
|
||||
asgName?: string
|
||||
}
|
||||
interface EurekaClientConfig {
|
||||
host: string,
|
||||
port: number,
|
||||
heartbeatInterval?: number,
|
||||
registryFetchInterval?: number,
|
||||
maxRetries?: number,
|
||||
requestRetryDelay?: number,
|
||||
fetchRegistry?: boolean,
|
||||
filterUpInstances?: boolean,
|
||||
servicePath?: string,
|
||||
ssl?: boolean,
|
||||
useDns?: boolean,
|
||||
preferSameZone?: boolean,
|
||||
clusterRefreshInterval?: boolean,
|
||||
fetchMetadata?: boolean,
|
||||
registerWithEureka?: boolean,
|
||||
useLocalMetadata?: boolean,
|
||||
preferIpAddress?: boolean
|
||||
}
|
||||
interface PortWrapper {
|
||||
enabled: boolean,
|
||||
port: number
|
||||
}
|
||||
interface LeaseInfo {
|
||||
renewalIntervalInSecs: number;
|
||||
durationInSecs: number;
|
||||
}
|
||||
interface DataCenterInfo {
|
||||
name: 'Netflix' | 'Amazon' | 'MyOwn';
|
||||
}
|
||||
}
|
||||
22
types/eureka-js-client/tsconfig.json
Normal file
22
types/eureka-js-client/tsconfig.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"eureka-js-client-tests.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user