1 | import { Cluster } from './cluster';
|
2 | import { QueryScanConsistency } from './querytypes';
|
3 | import { NodeCallback } from './utilities';
|
4 | import { CppManagementEventingFunction, CppManagementEventingFunctionBucketBinding, CppManagementEventingFunctionConstantBinding, CppManagementEventingFunctionSettings, CppManagementEventingFunctionUrlBinding, CppManagementEventingStatus, CppManagementEventingFunctionState } from './binding';
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | export declare enum EventingFunctionDcpBoundary {
|
11 | |
12 |
|
13 |
|
14 | Everything = "everything",
|
15 | |
16 |
|
17 |
|
18 |
|
19 | FromNow = "from_now"
|
20 | }
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | export declare enum EventingFunctionDeploymentStatus {
|
27 | |
28 |
|
29 |
|
30 | Deployed = "deployed",
|
31 | |
32 |
|
33 |
|
34 | Undeployed = "undeployed"
|
35 | }
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 | export declare enum EventingFunctionProcessingStatus {
|
42 | |
43 |
|
44 |
|
45 | Running = "running",
|
46 | |
47 |
|
48 |
|
49 | Paused = "paused"
|
50 | }
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 | export declare enum EventingFunctionStatus {
|
57 | |
58 |
|
59 |
|
60 | Undeployed = "undeployed",
|
61 | |
62 |
|
63 |
|
64 | Deploying = "deploying",
|
65 | |
66 |
|
67 |
|
68 | Deployed = "deployed",
|
69 | |
70 |
|
71 |
|
72 | Undeploying = "undeploying",
|
73 | |
74 |
|
75 |
|
76 | Paused = "paused",
|
77 | |
78 |
|
79 |
|
80 | Pausing = "pausing"
|
81 | }
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 | export declare enum EventingFunctionLanguageCompatibility {
|
88 | |
89 |
|
90 |
|
91 |
|
92 | Version_6_0_0 = "6.0.0",
|
93 | |
94 |
|
95 |
|
96 |
|
97 | Version_6_5_0 = "6.5.0",
|
98 | |
99 |
|
100 |
|
101 |
|
102 | Version_6_6_2 = "6.6.2",
|
103 | |
104 |
|
105 |
|
106 |
|
107 | Version_7_2_0 = "7.2.0"
|
108 | }
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 | export declare enum EventingFunctionLogLevel {
|
115 | |
116 |
|
117 |
|
118 | Info = "INFO",
|
119 | |
120 |
|
121 |
|
122 | Error = "ERROR",
|
123 | |
124 |
|
125 |
|
126 | Warning = "WARNING",
|
127 | |
128 |
|
129 |
|
130 | Debug = "DEBUG",
|
131 | |
132 |
|
133 |
|
134 | Trace = "TRACE"
|
135 | }
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 | export declare enum EventingFunctionBucketAccess {
|
142 | |
143 |
|
144 |
|
145 | ReadOnly = "r",
|
146 | |
147 |
|
148 |
|
149 | ReadWrite = "rw"
|
150 | }
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 | export declare enum EventingFunctionUrlAuthMethod {
|
157 | |
158 |
|
159 |
|
160 | None = "no-auth",
|
161 | |
162 |
|
163 |
|
164 | Basic = "basic",
|
165 | |
166 |
|
167 |
|
168 | Digest = "digest",
|
169 | |
170 |
|
171 |
|
172 | Bearer = "bearer"
|
173 | }
|
174 |
|
175 |
|
176 |
|
177 |
|
178 |
|
179 | export declare class EventingFunctionKeyspace {
|
180 | constructor(v: EventingFunctionKeyspace);
|
181 | /**
|
182 | * The bucket to use.
|
183 | */
|
184 | bucket: string;
|
185 | /**
|
186 | * The scope to use.
|
187 | */
|
188 | scope?: string;
|
189 | /**
|
190 | * The collection to use.
|
191 | */
|
192 | collection?: string;
|
193 | }
|
194 | /**
|
195 | * Specifies a bucket binding for an eventing function.
|
196 | *
|
197 | * @category Management
|
198 | */
|
199 | export declare class EventingFunctionBucketBinding {
|
200 | constructor(v: EventingFunctionBucketBinding);
|
201 | /**
|
202 | * The alias to use for referring to this binding.
|
203 | */
|
204 | alias: string;
|
205 | /**
|
206 | * The keyspace that this binding refers to.
|
207 | */
|
208 | name: EventingFunctionKeyspace;
|
209 | /**
|
210 | * The level of access configured for this binding.
|
211 | */
|
212 | access: EventingFunctionBucketAccess;
|
213 | /**
|
214 | * @internal
|
215 | */
|
216 | static _fromCppData(data: CppManagementEventingFunctionBucketBinding): EventingFunctionBucketBinding;
|
217 | /**
|
218 | * @internal
|
219 | */
|
220 | static _toCppData(data: EventingFunctionBucketBinding): CppManagementEventingFunctionBucketBinding;
|
221 | }
|
222 | /**
|
223 | * Specifies a type of url authentication to use.
|
224 | *
|
225 | * @category Management
|
226 | */
|
227 | export interface EventingFunctionUrlAuth {
|
228 | |
229 |
|
230 |
|
231 | method: EventingFunctionUrlAuthMethod;
|
232 | }
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 | export declare class EventingFunctionUrlAuthBasic implements EventingFunctionUrlAuth {
|
239 | |
240 |
|
241 |
|
242 | method: EventingFunctionUrlAuthMethod;
|
243 | constructor(v: Omit<EventingFunctionUrlAuthBasic, 'method'>);
|
244 | /**
|
245 | * Specifies the username to use for authentication.
|
246 | */
|
247 | username: string;
|
248 | /**
|
249 | * Specifies the password to use for authentication.
|
250 | */
|
251 | password: string;
|
252 | }
|
253 | /**
|
254 | * Specifies that Digest authentication should be used for the URL.
|
255 | *
|
256 | * @category Management
|
257 | */
|
258 | export declare class EventingFunctionUrlAuthDigest implements EventingFunctionUrlAuth {
|
259 | |
260 |
|
261 |
|
262 | method: EventingFunctionUrlAuthMethod;
|
263 | constructor(v: Omit<EventingFunctionUrlAuthDigest, 'method'>);
|
264 | /**
|
265 | * Specifies the username to use for authentication.
|
266 | */
|
267 | username: string;
|
268 | /**
|
269 | * Specifies the password to use for authentication.
|
270 | */
|
271 | password: string;
|
272 | }
|
273 | /**
|
274 | * Specifies that Bearer authentication should be used for the URL.
|
275 | *
|
276 | * @category Management
|
277 | */
|
278 | export declare class EventingFunctionUrlAuthBearer implements EventingFunctionUrlAuth {
|
279 | |
280 |
|
281 |
|
282 | method: EventingFunctionUrlAuthMethod;
|
283 | constructor(v: Omit<EventingFunctionUrlAuthBearer, 'method'>);
|
284 | /**
|
285 | * Specifies the bearer token to use.
|
286 | */
|
287 | key: string;
|
288 | }
|
289 | /**
|
290 | * Specifies a url binding for an eventing function.
|
291 | *
|
292 | * @category Management
|
293 | */
|
294 | export declare class EventingFunctionUrlBinding {
|
295 | constructor(v: EventingFunctionUrlBinding);
|
296 | /**
|
297 | * The alias to use for referring to this binding.
|
298 | */
|
299 | alias: string;
|
300 | /**
|
301 | * The hostname this url binding should refer to.
|
302 | */
|
303 | hostname: string;
|
304 | /**
|
305 | * The authentication that should be used.
|
306 | */
|
307 | auth?: EventingFunctionUrlAuth;
|
308 | /**
|
309 | * Whether or not cookies should be allowed.
|
310 | */
|
311 | allowCookies: boolean;
|
312 | /**
|
313 | * Whether the SSL certificate should be validated.
|
314 | */
|
315 | validateSslCertificate: boolean;
|
316 | /**
|
317 | * @internal
|
318 | */
|
319 | static _fromCppData(data: CppManagementEventingFunctionUrlBinding): EventingFunctionUrlBinding;
|
320 | /**
|
321 | * @internal
|
322 | */
|
323 | static _toCppData(data: EventingFunctionUrlBinding): CppManagementEventingFunctionUrlBinding;
|
324 | }
|
325 | /**
|
326 | * Specifies a constant binding for an eventing function.
|
327 | *
|
328 | * @category Management
|
329 | */
|
330 | export declare class EventingFunctionConstantBinding {
|
331 | constructor(v: EventingFunctionConstantBinding);
|
332 | /**
|
333 | * The alias to use for referring to this binding.
|
334 | */
|
335 | alias: string;
|
336 | /**
|
337 | * The literal value for this binding.
|
338 | */
|
339 | literal: string;
|
340 | /**
|
341 | * @internal
|
342 | */
|
343 | static _fromCppData(data: CppManagementEventingFunctionConstantBinding): EventingFunctionConstantBinding;
|
344 | /**
|
345 | * @internal
|
346 | */
|
347 | static _toCppData(data: EventingFunctionConstantBinding): CppManagementEventingFunctionConstantBinding;
|
348 | }
|
349 | /**
|
350 | * Specifies a number of options which can be used when updating or creating
|
351 | * a eventing function.
|
352 | *
|
353 | * @category Management
|
354 | */
|
355 | export declare class EventingFunctionSettings {
|
356 | constructor(v: EventingFunctionSettings);
|
357 | /**
|
358 | * The number of worker threads to use for the function.
|
359 | */
|
360 | cppWorkerThreadCount?: number;
|
361 | /**
|
362 | * The DCP stream boundary to use.
|
363 | */
|
364 | dcpStreamBoundary?: EventingFunctionDcpBoundary;
|
365 | /**
|
366 | * A description of this eventing function.
|
367 | */
|
368 | description?: string;
|
369 | /**
|
370 | * The current deployment status of the function.
|
371 | */
|
372 | deploymentStatus?: EventingFunctionDeploymentStatus;
|
373 | /**
|
374 | * The current processing status of the function.
|
375 | */
|
376 | processingStatus?: EventingFunctionProcessingStatus;
|
377 | /**
|
378 | * The active compatibility mode for the function.
|
379 | */
|
380 | languageCompatibility?: EventingFunctionLanguageCompatibility;
|
381 | /**
|
382 | * The level of logging that should be captured for the function.
|
383 | */
|
384 | logLevel?: EventingFunctionLogLevel;
|
385 | /**
|
386 | * The maximum period of time the function can execute on a document
|
387 | * before timing out.
|
388 | */
|
389 | executionTimeout?: number;
|
390 | /**
|
391 | * The maximum number of internal clients that the function should
|
392 | * maintain for KV operations.
|
393 | */
|
394 | lcbInstCapacity?: number;
|
395 | /**
|
396 | * The maximum number of times to retry a KV operation before failing
|
397 | * the function.
|
398 | */
|
399 | lcbRetryCount?: number;
|
400 | /**
|
401 | * The maximum period of time a KV operation within the function can
|
402 | * operate before timing out.
|
403 | */
|
404 | lcbTimeout?: number;
|
405 | /**
|
406 | * The level of consistency to use when performing queries in the function.
|
407 | */
|
408 | queryConsistency?: QueryScanConsistency;
|
409 | /**
|
410 | * The number of partitions that should be used for timer tracking.
|
411 | */
|
412 | numTimerPartitions?: number;
|
413 | /**
|
414 | * The batch size for messages from producer to consumer.
|
415 | */
|
416 | sockBatchSize?: number;
|
417 | /**
|
418 | * The duration to log stats from this handler, in milliseconds.
|
419 | */
|
420 | tickDuration?: number;
|
421 | /**
|
422 | * The size limit of timer context object.
|
423 | */
|
424 | timerContextSize?: number;
|
425 | /**
|
426 | * The key prefix for all data stored in metadata by this handler.
|
427 | */
|
428 | userPrefix?: string;
|
429 | /**
|
430 | * The maximum size in bytes the bucket cache can grow to.
|
431 | */
|
432 | bucketCacheSize?: number;
|
433 | /**
|
434 | * The time in milliseconds after which a cached bucket object is considered stale.
|
435 | */
|
436 | bucketCacheAge?: number;
|
437 | /**
|
438 | * The maximum allowable curl call response in 'MegaBytes'. Setting the value to 0
|
439 | * lifts the upper limit off. This parameters affects v8 engine stability since it
|
440 | * defines the maximum amount of heap space acquired by a curl call.
|
441 | */
|
442 | curlMaxAllowedRespSize?: number;
|
443 | /**
|
444 | * Whether to automatically prepare all query statements in the handler.
|
445 | */
|
446 | queryPrepareAll?: boolean;
|
447 | /**
|
448 | * The number of worker processes handler utilizes on each eventing node.
|
449 | */
|
450 | workerCount?: number;
|
451 | /**
|
452 | * The code to automatically prepend to top of handler code.
|
453 | */
|
454 | handlerHeaders?: string[];
|
455 | /**
|
456 | * The code to automatically append to bottom of handler code.
|
457 | */
|
458 | handlerFooters?: string[];
|
459 | /**
|
460 | * Whether to enable rotating this handlers log() message files.
|
461 | */
|
462 | enableAppLogRotation?: boolean;
|
463 | /**
|
464 | * The directory to write content of log() message files.
|
465 | */
|
466 | appLogDir?: string;
|
467 | /**
|
468 | * The size in bytes of the log file when the file should be rotated.
|
469 | */
|
470 | appLogMaxSize?: number;
|
471 | /**
|
472 | * The number of log() message files to retain when rotating.
|
473 | */
|
474 | appLogMaxFiles?: number;
|
475 | /**
|
476 | * The number of seconds before writing a progress checkpoint.
|
477 | */
|
478 | checkpointInterval?: number;
|
479 | /**
|
480 | * @internal
|
481 | */
|
482 | static _fromCppData(data: CppManagementEventingFunctionSettings): EventingFunctionSettings;
|
483 | /**
|
484 | * @internal
|
485 | */
|
486 | static _toCppData(data: EventingFunctionSettings): CppManagementEventingFunctionSettings;
|
487 | }
|
488 | /**
|
489 | * Describes an eventing function.
|
490 | *
|
491 | * @category Management
|
492 | */
|
493 | export declare class EventingFunction {
|
494 | constructor(v: EventingFunction);
|
495 | /**
|
496 | * The name of the eventing function.
|
497 | */
|
498 | name: string;
|
499 | /**
|
500 | * The code for this eventing function.
|
501 | */
|
502 | code: string;
|
503 | /**
|
504 | * The authoring version of this eventing function.
|
505 | */
|
506 | version?: string;
|
507 | /**
|
508 | * Whether to enable stricter validation of settings and configuration.
|
509 | */
|
510 | enforceSchema?: boolean;
|
511 | /**
|
512 | * The unique ID for this eventing function.
|
513 | */
|
514 | handlerUuid?: number;
|
515 | /**
|
516 | * The unique id for the deployment of the handler.
|
517 | */
|
518 | functionInstanceId?: string;
|
519 | /**
|
520 | * The keyspace to store the functions metadata.
|
521 | */
|
522 | metadataKeyspace: EventingFunctionKeyspace;
|
523 | /**
|
524 | * The keyspace that the function should operate on.
|
525 | */
|
526 | sourceKeyspace: EventingFunctionKeyspace;
|
527 | /**
|
528 | * The buckets to bind to the function.
|
529 | */
|
530 | bucketBindings: EventingFunctionBucketBinding[];
|
531 | /**
|
532 | * The URLs to bind to the function.
|
533 | */
|
534 | urlBindings: EventingFunctionUrlBinding[];
|
535 | /**
|
536 | * The constants to bind to the function.
|
537 | */
|
538 | constantBindings: EventingFunctionConstantBinding[];
|
539 | /**
|
540 | * The settings for this function.
|
541 | */
|
542 | settings: EventingFunctionSettings;
|
543 | /**
|
544 | * @internal
|
545 | */
|
546 | static _fromCppData(data: CppManagementEventingFunction): EventingFunction;
|
547 | /**
|
548 | * @internal
|
549 | */
|
550 | static _toCppData(data: EventingFunction): CppManagementEventingFunction;
|
551 | }
|
552 | /**
|
553 | * Describes the current state of an eventing function.
|
554 | *
|
555 | * @category Management
|
556 | */
|
557 | export declare class EventingFunctionState {
|
558 | constructor(v: EventingFunctionState);
|
559 | /**
|
560 | * The name of the eventing function.
|
561 | */
|
562 | name: string;
|
563 | /**
|
564 | * The current overall state of this eventing function.
|
565 | */
|
566 | status: EventingFunctionStatus;
|
567 | /**
|
568 | * The number of nodes where this eventing function is bootstrapping.
|
569 | */
|
570 | numBootstrappingNodes: number;
|
571 | /**
|
572 | * The number of nodes where this eventing function is deployed.
|
573 | */
|
574 | numDeployedNodes: number;
|
575 | /**
|
576 | * The current deployment status of this eventing function.
|
577 | */
|
578 | deploymentStatus: EventingFunctionDeploymentStatus;
|
579 | /**
|
580 | * The current processing status of this eventing function.
|
581 | */
|
582 | processingStatus: EventingFunctionProcessingStatus;
|
583 | /**
|
584 | * @internal
|
585 | */
|
586 | static _fromCppData(data: CppManagementEventingFunctionState): EventingFunctionState;
|
587 | }
|
588 | /**
|
589 | * Describes the current state of all eventing function.
|
590 | *
|
591 | * @category Management
|
592 | */
|
593 | export declare class EventingState {
|
594 | constructor(v: EventingState);
|
595 | /**
|
596 | * The number of eventing nodes that are currently active.
|
597 | */
|
598 | numEventingNodes: number;
|
599 | /**
|
600 | * The states of all registered eventing functions.
|
601 | */
|
602 | functions: EventingFunctionState[];
|
603 | /**
|
604 | * @internal
|
605 | */
|
606 | static _fromCppData(data: CppManagementEventingStatus): EventingState;
|
607 | }
|
608 | /**
|
609 | * @category Management
|
610 | */
|
611 | export interface UpsertFunctionOptions {
|
612 | |
613 |
|
614 |
|
615 | timeout?: number;
|
616 | }
|
617 |
|
618 |
|
619 |
|
620 | export interface DropFunctionOptions {
|
621 | |
622 |
|
623 |
|
624 | timeout?: number;
|
625 | }
|
626 |
|
627 |
|
628 |
|
629 | export interface GetAllFunctionsOptions {
|
630 | |
631 |
|
632 |
|
633 | timeout?: number;
|
634 | }
|
635 |
|
636 |
|
637 |
|
638 | export interface GetFunctionOptions {
|
639 | |
640 |
|
641 |
|
642 | timeout?: number;
|
643 | }
|
644 |
|
645 |
|
646 |
|
647 | export interface DeployFunctionOptions {
|
648 | |
649 |
|
650 |
|
651 | timeout?: number;
|
652 | }
|
653 |
|
654 |
|
655 |
|
656 | export interface UndeployFunctionOptions {
|
657 | |
658 |
|
659 |
|
660 | timeout?: number;
|
661 | }
|
662 |
|
663 |
|
664 |
|
665 | export interface PauseFunctionOptions {
|
666 | |
667 |
|
668 |
|
669 | timeout?: number;
|
670 | }
|
671 |
|
672 |
|
673 |
|
674 | export interface ResumeFunctionOptions {
|
675 | |
676 |
|
677 |
|
678 | timeout?: number;
|
679 | }
|
680 |
|
681 |
|
682 |
|
683 | export interface FunctionsStatusOptions {
|
684 | |
685 |
|
686 |
|
687 | timeout?: number;
|
688 | }
|
689 |
|
690 |
|
691 |
|
692 |
|
693 |
|
694 |
|
695 |
|
696 | export declare class EventingFunctionManager {
|
697 | private _cluster;
|
698 | |
699 |
|
700 |
|
701 | constructor(cluster: Cluster);
|
702 | /**
|
703 | * Creates or updates an eventing function.
|
704 | *
|
705 | * @param functionDefinition The description of the eventing function to upsert.
|
706 | * @param options Optional parameters for this operation.
|
707 | * @param callback A node-style callback to be invoked after execution.
|
708 | */
|
709 | upsertFunction(functionDefinition: EventingFunction, options?: UpsertFunctionOptions, callback?: NodeCallback<void>): Promise<void>;
|
710 | /**
|
711 | * Deletes an eventing function.
|
712 | *
|
713 | * @param name The name of the eventing function to delete.
|
714 | * @param options Optional parameters for this operation.
|
715 | * @param callback A node-style callback to be invoked after execution.
|
716 | */
|
717 | dropFunction(name: string, options?: DropFunctionOptions, callback?: NodeCallback<void>): Promise<void>;
|
718 | /**
|
719 | * Fetches all eventing functions.
|
720 | *
|
721 | * @param options Optional parameters for this operation.
|
722 | * @param callback A node-style callback to be invoked after execution.
|
723 | */
|
724 | getAllFunctions(options?: GetAllFunctionsOptions, callback?: NodeCallback<EventingFunction[]>): Promise<EventingFunction[]>;
|
725 | /**
|
726 | * Fetches a specific eventing function.
|
727 | *
|
728 | * @param name The name of the eventing function to fetch.
|
729 | * @param options Optional parameters for this operation.
|
730 | * @param callback A node-style callback to be invoked after execution.
|
731 | */
|
732 | getFunction(name: string, options?: GetFunctionOptions, callback?: NodeCallback<EventingFunction>): Promise<EventingFunction>;
|
733 | /**
|
734 | * Deploys an eventing function.
|
735 | *
|
736 | * @param name The name of the eventing function to deploy.
|
737 | * @param options Optional parameters for this operation.
|
738 | * @param callback A node-style callback to be invoked after execution.
|
739 | */
|
740 | deployFunction(name: string, options?: DeployFunctionOptions, callback?: NodeCallback<void>): Promise<void>;
|
741 | /**
|
742 | * Undeploys an eventing function.
|
743 | *
|
744 | * @param name The name of the eventing function to undeploy.
|
745 | * @param options Optional parameters for this operation.
|
746 | * @param callback A node-style callback to be invoked after execution.
|
747 | */
|
748 | undeployFunction(name: string, options?: DeployFunctionOptions, callback?: NodeCallback<void>): Promise<void>;
|
749 | /**
|
750 | * Pauses an eventing function.
|
751 | *
|
752 | * @param name The name of the eventing function to pause.
|
753 | * @param options Optional parameters for this operation.
|
754 | * @param callback A node-style callback to be invoked after execution.
|
755 | */
|
756 | pauseFunction(name: string, options?: PauseFunctionOptions, callback?: NodeCallback<void>): Promise<void>;
|
757 | /**
|
758 | * Resumes an eventing function.
|
759 | *
|
760 | * @param name The name of the eventing function to resume.
|
761 | * @param options Optional parameters for this operation.
|
762 | * @param callback A node-style callback to be invoked after execution.
|
763 | */
|
764 | resumeFunction(name: string, options?: ResumeFunctionOptions, callback?: NodeCallback<void>): Promise<void>;
|
765 | /**
|
766 | * Fetches the status of all eventing functions.
|
767 | *
|
768 | * @param options Optional parameters for this operation.
|
769 | * @param callback A node-style callback to be invoked after execution.
|
770 | */
|
771 | functionsStatus(options?: FunctionsStatusOptions, callback?: NodeCallback<EventingState>): Promise<EventingState>;
|
772 | }
|