UNPKG

4.12 kBTypeScriptView Raw
1import { IConfigurable } from 'pip-services3-commons-node';
2import { IReferenceable } from 'pip-services3-commons-node';
3import { IReferences } from 'pip-services3-commons-node';
4import { ConfigParams } from 'pip-services3-commons-node';
5import { ConnectionResolver } from 'pip-services3-components-node';
6import { CredentialResolver } from 'pip-services3-components-node';
7import { AwsConnectionParams } from './AwsConnectionParams';
8/**
9 * Helper class to retrieve AWS connection and credential parameters,
10 * validate them and compose a [[AwsConnectionParams]] value.
11 *
12 * ### Configuration parameters ###
13 *
14 * - connections:
15 * - discovery_key: (optional) a key to retrieve the connection from [[https://pip-services3-node.github.io/pip-services3-components-node/interfaces/connect.idiscovery.html IDiscovery]]
16 * - region: (optional) AWS region
17 * - partition: (optional) AWS partition
18 * - service: (optional) AWS service
19 * - resource_type: (optional) AWS resource type
20 * - resource: (optional) AWS resource id
21 * - arn: (optional) AWS resource ARN
22 * - credentials:
23 * - store_key: (optional) a key to retrieve the credentials from [[https://pip-services3-node.github.io/pip-services3-components-node/interfaces/auth.icredentialstore.html ICredentialStore]]
24 * - access_id: AWS access/client id
25 * - access_key: AWS access/client id
26 *
27 * ### References ###
28 *
29 * - <code>\*:discovery:\*:\*:1.0</code> (optional) [[https://pip-services3-node.github.io/pip-services3-components-node/interfaces/connect.idiscovery.html IDiscovery]] services to resolve connections
30 * - <code>\*:credential-store:\*:\*:1.0</code> (optional) Credential stores to resolve credentials
31 *
32 * @see [[https://pip-services3-node.github.io/pip-services3-components-node/classes/connect.connectionparams.html ConnectionParams]] (in the Pip.Services components package)
33 * @see [[https://pip-services3-node.github.io/pip-services3-components-node/interfaces/connect.idiscovery.html IDiscovery]] (in the Pip.Services components package)
34 *
35 * ### Example ###
36 *
37 * let config = ConfigParams.fromTuples(
38 * "connection.region", "us-east1",
39 * "connection.service", "s3",
40 * "connection.bucket", "mybucket",
41 * "credential.access_id", "XXXXXXXXXX",
42 * "credential.access_key", "XXXXXXXXXX"
43 * );
44 *
45 * let connectionResolver = new AwsConnectionResolver();
46 * connectionResolver.configure(config);
47 * connectionResolver.setReferences(references);
48 *
49 * connectionResolver.resolve("123", (err, connection) => {
50 * // Now use connection...
51 * });
52 */
53export declare class AwsConnectionResolver implements IConfigurable, IReferenceable {
54 /**
55 * The connection resolver.
56 */
57 protected _connectionResolver: ConnectionResolver;
58 /**
59 * The credential resolver.
60 */
61 protected _credentialResolver: CredentialResolver;
62 /**
63 * Configures component by passing configuration parameters.
64 *
65 * @param config configuration parameters to be set.
66 */
67 configure(config: ConfigParams): void;
68 /**
69 * Sets references to dependent components.
70 *
71 * @param references references to locate the component dependencies.
72 */
73 setReferences(references: IReferences): void;
74 /**
75 * Resolves connection and credental parameters and generates a single
76 * AWSConnectionParams value.
77 *
78 * @param correlationId (optional) transaction id to trace execution through call chain.
79 * @param callback callback function that receives AWSConnectionParams value or error.
80 *
81 * @see [[https://pip-services3-node.github.io/pip-services3-components-node/interfaces/connect.idiscovery.html IDiscovery]] (in the Pip.Services components package)
82 */
83 resolve(correlationId: string, callback: (err: any, connection: AwsConnectionParams) => void): void;
84}