metadata_service.d.ts 1.9 KB

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