1 | export declare abstract class Expression<T extends string | number | boolean | string[]> {
|
2 |
|
3 | value(): T;
|
4 |
|
5 | toCEL(): string;
|
6 |
|
7 | toJSON(): string;
|
8 | }
|
9 |
|
10 |
|
11 |
|
12 | export declare class TernaryExpression<T extends string | number | boolean | string[]> extends Expression<T> {
|
13 | private readonly test;
|
14 | private readonly ifTrue;
|
15 | private readonly ifFalse;
|
16 | constructor(test: Expression<boolean>, ifTrue: T | Expression<T>, ifFalse: T | Expression<T>);
|
17 | toString(): string;
|
18 | }
|
19 | /**
|
20 | * A CEL expression that evaluates to boolean true or false based on a comparison
|
21 | * between the value of another expression and a literal of that same type.
|
22 | */
|
23 | export declare class CompareExpression<T extends string | number | boolean | string[]> extends Expression<boolean> {
|
24 | cmp: "==" | "!=" | ">" | ">=" | "<" | "<=";
|
25 | lhs: Expression<T>;
|
26 | rhs: T | Expression<T>;
|
27 | constructor(cmp: "==" | "!=" | ">" | ">=" | "<" | "<=", lhs: Expression<T>, rhs: T | Expression<T>);
|
28 | toString(): string;
|
29 | /** Returns a `TernaryExpression` which can resolve to one of two values, based on the resolution of this comparison. */
|
30 | thenElse<retT extends string | number | boolean | string[]>(ifTrue: retT | Expression<retT>, ifFalse: retT | Expression<retT>): TernaryExpression<retT>;
|
31 | }
|
32 | /** @hidden */
|
33 | type ParamValueType = "string" | "list" | "boolean" | "int" | "float" | "secret";
|
34 | /** Create a select input from a series of values. */
|
35 | export declare function select<T>(options: T[]): SelectInput<T>;
|
36 | /** Create a select input from a map of labels to vaues. */
|
37 | export declare function select<T>(optionsWithLabels: Record<string, T>): SelectInput<T>;
|
38 | /** Create a multi-select input from a series of values. */
|
39 | export declare function multiSelect(options: string[]): MultiSelectInput;
|
40 | /** Create a multi-select input from map of labels to values. */
|
41 | export declare function multiSelect(options: Record<string, string>): MultiSelectInput;
|
42 | type ParamInput<T> = TextInput<T> | SelectInput<T> | (T extends string[] ? MultiSelectInput : never) | (T extends string ? ResourceInput : never);
|
43 | /**
|
44 | * Specifies that a parameter's value should be determined by prompting the user
|
45 | * to type it in interactively at deploy time. Input that does not match the
|
46 | * provided validationRegex, if present, will be retried.
|
47 | */
|
48 | export interface TextInput<T = unknown> {
|
49 | text: {
|
50 | example?: string;
|
51 | |
52 |
|
53 |
|
54 |
|
55 |
|
56 | validationRegex?: string | RegExp;
|
57 | |
58 |
|
59 |
|
60 |
|
61 | validationErrorMessage?: string;
|
62 | };
|
63 | }
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 | export interface ResourceInput {
|
70 | resource: {
|
71 | type: "storage.googleapis.com/Bucket";
|
72 | };
|
73 | }
|
74 |
|
75 |
|
76 |
|
77 | export declare const BUCKET_PICKER: ResourceInput;
|
78 |
|
79 |
|
80 |
|
81 |
|
82 | export interface SelectInput<T = unknown> {
|
83 | select: {
|
84 | options: Array<SelectOptions<T>>;
|
85 | };
|
86 | }
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 | export interface MultiSelectInput {
|
93 | multiSelect: {
|
94 | options: Array<SelectOptions<string>>;
|
95 | };
|
96 | }
|
97 |
|
98 |
|
99 |
|
100 |
|
101 | export interface SelectOptions<T = unknown> {
|
102 | label?: string;
|
103 | value: T;
|
104 | }
|
105 |
|
106 | export type ParamSpec<T extends string | number | boolean | string[]> = {
|
107 |
|
108 | name: string;
|
109 |
|
110 | default?: T | Expression<T>;
|
111 |
|
112 | label?: string;
|
113 |
|
114 | description?: string;
|
115 |
|
116 | input?: ParamInput<T>;
|
117 | };
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 | export type WireParamSpec<T extends string | number | boolean | string[]> = {
|
127 | name: string;
|
128 | default?: T | string;
|
129 | label?: string;
|
130 | description?: string;
|
131 | type: ParamValueType;
|
132 | input?: ParamInput<T>;
|
133 | };
|
134 |
|
135 | export type ParamOptions<T extends string | number | boolean | string[]> = Omit<ParamSpec<T>, "name" | "type">;
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 | export declare abstract class Param<T extends string | number | boolean | string[]> extends Expression<T> {
|
142 | readonly name: string;
|
143 | readonly options: ParamOptions<T>;
|
144 | static type: ParamValueType;
|
145 | constructor(name: string, options?: ParamOptions<T>);
|
146 | /** Returns a parametrized expression of Boolean type, based on comparing the value of this parameter to a literal or a different expression. */
|
147 | cmp(cmp: "==" | "!=" | ">" | ">=" | "<" | "<=", rhs: T | Expression<T>): CompareExpression<T>;
|
148 | /** Returns a parametrized expression of Boolean type, based on comparing the value of this parameter to a literal or a different expression. */
|
149 | equals(rhs: T | Expression<T>): CompareExpression<T>;
|
150 | /** Returns a parametrized expression of Boolean type, based on comparing the value of this parameter to a literal or a different expression. */
|
151 | notEquals(rhs: T | Expression<T>): CompareExpression<T>;
|
152 | /** Returns a parametrized expression of Boolean type, based on comparing the value of this parameter to a literal or a different expression. */
|
153 | greaterThan(rhs: T | Expression<T>): CompareExpression<T>;
|
154 | /** Returns a parametrized expression of Boolean type, based on comparing the value of this parameter to a literal or a different expression. */
|
155 | greaterThanOrEqualTo(rhs: T | Expression<T>): CompareExpression<T>;
|
156 | /** Returns a parametrized expression of Boolean type, based on comparing the value of this parameter to a literal or a different expression. */
|
157 | lessThan(rhs: T | Expression<T>): CompareExpression<T>;
|
158 | /** Returns a parametrized expression of Boolean type, based on comparing the value of this parameter to a literal or a different expression. */
|
159 | lessThanOrEqualTo(rhs: T | Expression<T>): CompareExpression<T>;
|
160 | /**
|
161 | * Returns a parametrized expression of Boolean type, based on comparing the value of this parameter to a literal or a different expression.
|
162 | * @deprecated A typo. Use lessThanOrEqualTo instead.
|
163 | */
|
164 | lessThanorEqualTo(rhs: T | Expression<T>): CompareExpression<T>;
|
165 | toString(): string;
|
166 | }
|
167 | /**
|
168 | * A parametrized string whose value is stored in Cloud Secret Manager
|
169 | * instead of the local filesystem. Supply instances of SecretParams to
|
170 | * the secrets array while defining a Function to make their values accessible
|
171 | * during execution of that Function.
|
172 | */
|
173 | export declare class SecretParam {
|
174 | static type: ParamValueType;
|
175 | name: string;
|
176 | constructor(name: string);
|
177 | /** Returns the secret's value at runtime. Throws an error if accessed during deployment. */
|
178 | value(): string;
|
179 | }
|
180 | /**
|
181 | * A parametrized value of String type that will be read from .env files
|
182 | * if present, or prompted for by the CLI if missing.
|
183 | */
|
184 | export declare class StringParam extends Param<string> {
|
185 | }
|
186 |
|
187 |
|
188 |
|
189 |
|
190 | export declare class IntParam extends Param<number> {
|
191 | static type: ParamValueType;
|
192 | }
|
193 |
|
194 |
|
195 |
|
196 |
|
197 | export declare class FloatParam extends Param<number> {
|
198 | static type: ParamValueType;
|
199 | }
|
200 |
|
201 |
|
202 |
|
203 |
|
204 | export declare class BooleanParam extends Param<boolean> {
|
205 | static type: ParamValueType;
|
206 |
|
207 | then<T extends string | number | boolean>(ifTrue: T | Expression<T>, ifFalse: T | Expression<T>): TernaryExpression<T>;
|
208 | thenElse<T extends string | number | boolean>(ifTrue: T | Expression<T>, ifFalse: T | Expression<T>): TernaryExpression<T>;
|
209 | }
|
210 |
|
211 |
|
212 |
|
213 |
|
214 | export declare class ListParam extends Param<string[]> {
|
215 | static type: ParamValueType;
|
216 |
|
217 | greaterThan(rhs: string[] | Expression<string[]>): CompareExpression<string[]>;
|
218 |
|
219 | greaterThanOrEqualTo(rhs: string[] | Expression<string[]>): CompareExpression<string[]>;
|
220 |
|
221 | lessThan(rhs: string[] | Expression<string[]>): CompareExpression<string[]>;
|
222 |
|
223 | lessThanorEqualTo(rhs: string[] | Expression<string[]>): CompareExpression<string[]>;
|
224 | }
|
225 | export {};
|