1 | import { Construct } from 'constructs';
|
2 | /**
|
3 | */
|
4 | export interface GetContextKeyOptions {
|
5 | /**
|
6 | * The context provider to query.
|
7 | */
|
8 | readonly provider: string;
|
9 | /**
|
10 | * Provider-specific properties.
|
11 | */
|
12 | readonly props?: {
|
13 | [key: string]: any;
|
14 | };
|
15 | /**
|
16 | * Whether to include the stack's account and region automatically.
|
17 | *
|
18 | * @default true
|
19 | */
|
20 | readonly includeEnvironment?: boolean;
|
21 | }
|
22 | /**
|
23 | */
|
24 | export interface GetContextValueOptions extends GetContextKeyOptions {
|
25 | /**
|
26 | * The value to return if the context value was not found and a missing
|
27 | * context is reported. This should be a dummy value that should preferably
|
28 | * fail during deployment since it represents an invalid state.
|
29 | */
|
30 | readonly dummyValue: any;
|
31 | }
|
32 | /**
|
33 | */
|
34 | export interface GetContextKeyResult {
|
35 | readonly key: string;
|
36 | readonly props: {
|
37 | [key: string]: any;
|
38 | };
|
39 | }
|
40 | /**
|
41 | */
|
42 | export interface GetContextValueResult {
|
43 | readonly value?: any;
|
44 | }
|
45 | /**
|
46 | * Base class for the model side of context providers
|
47 | *
|
48 | * Instances of this class communicate with context provider plugins in the 'cdk
|
49 | * toolkit' via context variables (input), outputting specialized queries for
|
50 | * more context variables (output).
|
51 | *
|
52 | * ContextProvider needs access to a Construct to hook into the context mechanism.
|
53 | *
|
54 | */
|
55 | export declare class ContextProvider {
|
56 | /**
|
57 | * @returns the context key or undefined if a key cannot be rendered (due to tokens used in any of the props)
|
58 | */
|
59 | static getKey(scope: Construct, options: GetContextKeyOptions): GetContextKeyResult;
|
60 | static getValue(scope: Construct, options: GetContextValueOptions): GetContextValueResult;
|
61 | private constructor();
|
62 | }
|