UNPKG

1.71 kBTypeScriptView Raw
1
2import {AWSError} from './error';
3/**
4 * Represents a metadata service available on EC2 instances. Using the request() method, you can receieve metadata about any available resource on the metadata service.
5 */
6export class MetadataService {
7 /**
8 * Creates a new MetadataService object with a given set of options.
9 */
10 constructor(options?: MetadataServiceOptions);
11 /**
12 * Sends a request to the instance metadata service for a given resource.
13 */
14 request(path: string, callback: (err: AWSError, data: string) => void): void;
15 request(
16 path: string,
17 options: {method?: string, headers?: {[key: string]: String} },
18 callback: (err: AWSError, data: string) => void
19 ): void;
20 /**
21 * 169.254.169.254
22 */
23 static host: string
24 /**
25 * A map of options to pass to the underlying HTTP request.
26 */
27 httpOptions: {
28 /**
29 * a timeout value in milliseconds to wait before aborting the connection. Set to 0 for no timeout.
30 */
31 timeout: number;
32 }
33}
34
35interface MetadataServiceOptions {
36 /**
37 * the hostname of the instance metadata service.
38 */
39 host?: string;
40 /**
41 * a map of options to pass to the underlying HTTP request.
42 */
43 httpOptions?: {
44 /**
45 * a timeout value in milliseconds to wait before aborting the connection. Set to 0 for no timeout.
46 */
47 timeout?: number;
48 }
49 /**
50 * the maximum number of retries to perform for timeout errors.
51 */
52 maxRetries?: number;
53 /**
54 * A set of options to configure the retry delay on retryable errors. See AWS.Config for details.
55 */
56 retryDelayOptions?: any
57}
\No newline at end of file