forked from jquatier/eureka-js-client
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.d.ts
executable file
·115 lines (111 loc) · 4.46 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// Type definitions for eureka-js-client 4.5
// Project: https://github.com/jquatier/eureka-js-client
// Definitions by: Karl O. <https://github.com/karl-run>
// Tom Barton <https://github.com/tombarton>
// Josh Sullivan <https://github.com/jpsullivan>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export class Eureka {
constructor(config: EurekaClient.EurekaConfig | EurekaClient.EurekaYmlConfig | EurekaClient.EurekaMiddlewareConfig);
start(cb?: (err: Error, ...rest: any[]) => void): void;
stop(cb?: (err: Error, ...rest: any[]) => void): void;
setStatus(status: EurekaClient.InstanceStatus, cb?: (err: Error, ...rest: any[]) => void): void;
getInstancesByAppId(appId: string): EurekaClient.EurekaInstanceConfig[];
getInstancesByVipAddress(vidAddress: string): EurekaClient.EurekaInstanceConfig[];
}
export namespace EurekaClient {
type InstanceStatus = 'UP' | 'DOWN' | 'STARTING' | 'OUT_OF_SERVICE' | 'UNKNOWN';
type ActionType = 'ADDED' | 'MODIFIED' | 'DELETED';
type DataCenterName = 'Netflix' | 'Amazon' | 'MyOwn';
interface EurekaConfig {
requestMiddleware?: ((requestOpts: any, done: (opts: any) => void) => void) | undefined;
instance: EurekaInstanceConfig;
eureka: EurekaClientConfig;
shouldUseDelta?: boolean | undefined;
logger?: {
warn: (...args: any[]) => void;
info: (...args: any[]) => void;
debug: (...args: any[]) => void;
error: (...args: any[]) => void;
} | undefined;
}
interface EurekaInstanceConfig {
app: string;
hostName: string;
ipAddr: string;
vipAddress: string;
dataCenterInfo: DataCenterInfo;
port?: PortWrapper | LegacyPortWrapper | undefined;
instanceId?: string | undefined;
appGroupName?: string | undefined;
sid?: string | undefined;
securePort?: PortWrapper | LegacyPortWrapper | undefined;
homePageUrl?: string | undefined;
statusPageUrl?: string | undefined;
healthCheckUrl?: string | undefined;
secureHealthCheckUrl?: string | undefined;
secureVipAddress?: string | undefined;
countryId?: number | undefined;
status: InstanceStatus;
overriddenstatus?: InstanceStatus | undefined;
leaseInfo?: LeaseInfo | undefined;
isCoordinatingDiscoveryServer?: boolean | undefined;
lastUpdatedTimestamp?: number | undefined;
lastDirtyTimestamp?: number | undefined;
actionType?: ActionType | undefined;
metadata?: {
[index: string]: string;
} | undefined;
}
interface EurekaClientConfig {
host?: string | undefined;
port?: number | undefined;
ec2Region: string | undefined;
heartbeatInterval?: number | undefined;
registryFetchInterval?: number | undefined;
maxRetries?: number | undefined;
requestRetryDelay?: number | undefined;
fetchRegistry?: boolean | undefined;
filterUpInstances?: boolean | undefined;
servicePath?: string | undefined;
ssl?: boolean | undefined;
useDns?: boolean | undefined;
preferSameZone?: boolean | undefined;
clusterRefreshInterval?: boolean | undefined;
fetchMetadata?: boolean | undefined;
registerWithEureka?: boolean | undefined;
useLocalMetadata?: boolean | undefined;
preferIpAddress?: boolean | undefined;
serviceUrls?: {
[index: string]: string[];
} | undefined;
keepOriginalHostnameAndIpAddress? : boolean | undefined;
}
interface EurekaYmlConfig {
cwd: string;
filename?: string | undefined;
}
interface EurekaMiddlewareConfig {
requestMiddleware: (requestOpts: any, done: (opts: any) => void) => void;
}
interface LegacyPortWrapper {
$: number;
'@enabled': boolean;
}
interface PortWrapper {
enabled: boolean;
port: number;
}
interface LeaseInfo {
renewalIntervalInSecs?: number | undefined;
durationInSecs?: number | undefined;
registrationTimestamp?: number | undefined;
lastRenewalTimestamp?: number | undefined;
evictionTimestamp?: number | undefined;
serviceUpTimestamp?: number | undefined;
}
interface DataCenterInfo {
name: DataCenterName;
'@class'?: string | undefined;
metadata?: Record<string, string>;
}
}