1 | /// <reference types="node" />
|
2 | import { URL } from 'url';
|
3 | import { AsyncOptionalCreatable, Duration } from '@salesforce/kit';
|
4 | /**
|
5 | * A class used to resolve MyDomains. After a ScratchOrg is created its host name my not be propagated to the
|
6 | * Salesforce DNS service. This service is not exclusive to Salesforce My Domain URL and could be used for any hostname.
|
7 | *
|
8 | * ```
|
9 | * (async () => {
|
10 | * const options: MyDomainResolver.Options = {
|
11 | * url: new URL('http://mydomain.salesforce.com'),
|
12 | * timeout: Duration.minutes(5),
|
13 | * frequency: Duration.seconds(10)
|
14 | * };
|
15 | * const resolver: MyDomainResolver = await MyDomainResolver.create(options);
|
16 | * const ipAddress: AnyJson = await resolver.resolve();
|
17 | * console.log(`Successfully resolved host: ${options.url} to address: ${ipAddress}`);
|
18 | * })();
|
19 | * ```
|
20 | */
|
21 | export declare class MyDomainResolver extends AsyncOptionalCreatable<MyDomainResolver.Options> {
|
22 | static DEFAULT_DOMAIN: URL;
|
23 | private logger;
|
24 | private options;
|
25 | /**
|
26 | * Constructor
|
27 | * **Do not directly construct instances of this class -- use {@link MyDomainResolver.create} instead.**
|
28 | *
|
29 | * @param options The options for the class instance
|
30 | */
|
31 | constructor(options?: MyDomainResolver.Options);
|
32 | getTimeout(): Duration;
|
33 | getFrequency(): Duration;
|
34 | /**
|
35 | * Method that performs the dns lookup of the host. If the lookup fails the internal polling client will try again
|
36 | * given the optional interval. Returns the resolved ip address.
|
37 | *
|
38 | * If SFDX_DISABLE_DNS_CHECK environment variable is set to true, it will immediately return the host without
|
39 | * executing the dns loookup.
|
40 | */
|
41 | resolve(): Promise<string>;
|
42 | getCnames(): Promise<string[]>;
|
43 | /**
|
44 | * Used to initialize asynchronous components.
|
45 | */
|
46 | protected init(): Promise<void>;
|
47 | }
|
48 | export declare namespace MyDomainResolver {
|
49 | /**
|
50 | * Options for the MyDomain DNS resolver.
|
51 | */
|
52 | interface Options {
|
53 | /**
|
54 | * The host to resolve.
|
55 | */
|
56 | url: URL;
|
57 | /**
|
58 | * The retry interval.
|
59 | */
|
60 | timeout?: Duration;
|
61 | /**
|
62 | * The retry timeout.
|
63 | */
|
64 | frequency?: Duration;
|
65 | }
|
66 | }
|