import * as pulumi from "@pulumi/pulumi"; import { Account } from "./account"; import * as appservice from "../appservice"; /** * Data that will be passed along in the context object to the CosmosCallback. */ export interface CosmosChangeFeedContext extends appservice.Context { invocationId: string; executionContext: { invocationId: string; functionName: string; functionDirectory: string; }; bindings: { items: any[]; }; bindingData: { sys: { methodName: string; utcNow: string; }; invocationId: string; }; } /** * Signature of the callback that can receive Cosmos Change Feed notifications. */ export type CosmosChangeFeedCallback = appservice.Callback; export interface GetCosmosDBFunctionArgs extends appservice.CallbackFunctionArgs { /** * The name of the database we are subscribing to. */ databaseName: pulumi.Input; /** * The name of the collection inside the database we are subscribing to. */ collectionName: pulumi.Input; /** * When set, it customizes the maximum amount of items received per Function call. */ maxItemsPerInvocation?: pulumi.Input; /** * When set, it tells the Trigger to start reading changes from the beginning of the history of the collection instead of the current time. * This only works the first time the Trigger starts, as in subsequent runs, the checkpoints are already stored. Setting this to true when * there are leases already created has no effect. */ startFromBeginning?: pulumi.Input; /** * When set, it customizes the feed poll delay (in miliseconds) between polling a partition for new changes on the feed. Default is 5000 ms or 5 seconds. */ feedPollDelay?: number; } export interface CosmosDBFunctionArgs extends GetCosmosDBFunctionArgs { /** * CosmosDB Account. */ account: Account; } export interface CosmosChangeFeedSubscriptionArgs extends GetCosmosDBFunctionArgs, appservice.CallbackFunctionAppArgs { /** * The name of the resource group in which to create the event subscription. [resourceGroup] takes precedence over [resourceGroupName]. * If none of the two is supplied, the resource group of the Cosmos DB Account will be used. */ resourceGroupName?: pulumi.Input; } declare module "./account" { interface Account { /** * Creates a new subscription to events fired from Cosmos DB Change Feed to the handler provided, along * with options to control the behavior of the subscription. * A dedicated Function App is created behind the scenes with a single Azure Function in it. Use [getChangeFeedFunction] if you * want to compose multiple Functions into the same App manually. */ onChange(name: string, args: CosmosChangeFeedSubscriptionArgs, opts?: pulumi.ComponentResourceOptions): CosmosChangeFeedSubscription; /** * Creates a new Function triggered by messages in the given queue using the callback provided. * [getChangeFeedFunction] creates no Azure resources automatically: the returned Function should be used as * part of a [MultiCallbackFunctionApp]. Use [onChange] if you want to create a Function App with a single * Function. */ getChangeFeedFunction(name: string, args: GetCosmosDBFunctionArgs): CosmosDBFunction; } } export declare class CosmosChangeFeedSubscription extends appservice.EventSubscription { readonly account: Account; constructor(name: string, account: Account, args: CosmosChangeFeedSubscriptionArgs, opts?: pulumi.ComponentResourceOptions); } /** * Azure Function triggered by a Cosmos DB Change Feed. */ export declare class CosmosDBFunction extends appservice.Function { constructor(name: string, args: CosmosDBFunctionArgs); }