config.d.ts 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import {ConfigurationServicePlaceholders, ConfigurationServiceApiVersions} from './config_service_placeholders';
  2. import {ConfigBase, ConfigurationOptions} from './config-base';
  3. export class Config extends ConfigBase {
  4. /**
  5. * Creates a new configuration object.
  6. * This is the object that passes option data along to service requests, including credentials, security, region information, and some service specific settings.
  7. */
  8. constructor(options?: ConfigurationOptions & ConfigurationServicePlaceholders & APIVersions);
  9. /**
  10. * Loads configuration data from a JSON file into this config object.
  11. * Loading configuration will reset all existing configuration on the object.
  12. * This feature is not supported in the browser environment of the SDK.
  13. *
  14. * @param {string} path - the path relative to your process's current working directory to load configuration from.
  15. */
  16. loadFromPath(path: string): Config & ConfigurationServicePlaceholders & APIVersions;
  17. /**
  18. * Updates the current configuration object with new options.
  19. *
  20. * @param {ConfigurationOptions} options - a map of option keys and values.
  21. * @param {boolean} allowUnknownKeys - Whether unknown keys can be set on the configuration object.
  22. */
  23. update(options: ConfigurationOptions & ConfigurationServicePlaceholders & APIVersions & {[key: string]: any}, allowUnknownKeys: true): void;
  24. /**
  25. * Updates the current configuration object with new options.
  26. *
  27. * @param {ConfigurationOptions} options - a map of option keys and values.
  28. * @param {boolean} allowUnknownKeys - Defaults to false. Whether unknown keys can be set on the configuration object.
  29. */
  30. update(options: ConfigurationOptions & ConfigurationServicePlaceholders & APIVersions, allowUnknownKeys?: false): void;
  31. }
  32. export type GlobalConfigInstance = Config & ConfigurationServicePlaceholders & APIVersions;
  33. export interface APIVersions {
  34. /**
  35. * A string in YYYY-MM-DD format that represents the latest possible API version that can be used in all services (unless overridden by apiVersions). Specify \'latest\' to use the latest possible version.
  36. */
  37. apiVersion?: "latest"|string;
  38. /**
  39. * A map of service identifiers (the lowercase service class name) with the API version to use when instantiating a service. Specify 'latest' for each individual that can use the latest available version.
  40. */
  41. apiVersions?: ConfigurationServiceApiVersions;
  42. }
  43. // for backwards compatible client generation
  44. export { ConfigBase } from "./config-base";