mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-11-14 23:26:18 +00:00
86 lines
2.9 KiB
TypeScript
86 lines
2.9 KiB
TypeScript
|
import { CloudFunction, EventContext } from '../cloud-functions';
|
||
|
/**
|
||
|
* The optional bucket function allows you to choose which buckets' events to handle.
|
||
|
* This step can be bypassed by calling object() directly, which will use the default
|
||
|
* Cloud Storage for Firebase bucket.
|
||
|
* @param bucket Name of the Google Cloud Storage bucket to listen to.
|
||
|
*/
|
||
|
export declare function bucket(bucket?: string): BucketBuilder;
|
||
|
/**
|
||
|
* Handle events related to Cloud Storage objects.
|
||
|
*/
|
||
|
export declare function object(): ObjectBuilder;
|
||
|
export declare class BucketBuilder {
|
||
|
private triggerResource;
|
||
|
private opts;
|
||
|
/** Handle events for objects in this bucket. */
|
||
|
object(): ObjectBuilder;
|
||
|
}
|
||
|
export declare class ObjectBuilder {
|
||
|
private triggerResource;
|
||
|
private opts;
|
||
|
/** Respond to archiving of an object, this is only for buckets that enabled object versioning. */
|
||
|
onArchive(handler: (object: ObjectMetadata, context: EventContext) => PromiseLike<any> | any): CloudFunction<ObjectMetadata>;
|
||
|
/** Respond to the deletion of an object (not to archiving, if object versioning is enabled). */
|
||
|
onDelete(handler: (object: ObjectMetadata, context: EventContext) => PromiseLike<any> | any): CloudFunction<ObjectMetadata>;
|
||
|
/** Respond to the successful creation of an object. */
|
||
|
onFinalize(handler: (object: ObjectMetadata, context: EventContext) => PromiseLike<any> | any): CloudFunction<ObjectMetadata>;
|
||
|
/** Respond to metadata updates of existing objects. */
|
||
|
onMetadataUpdate(handler: (object: ObjectMetadata, context: EventContext) => PromiseLike<any> | any): CloudFunction<ObjectMetadata>;
|
||
|
private onOperation(handler, eventType);
|
||
|
}
|
||
|
export interface ObjectMetadata {
|
||
|
kind: string;
|
||
|
id: string;
|
||
|
bucket: string;
|
||
|
storageClass: string;
|
||
|
size: string;
|
||
|
timeCreated: string;
|
||
|
updated: string;
|
||
|
selfLink?: string;
|
||
|
name?: string;
|
||
|
generation?: string;
|
||
|
contentType?: string;
|
||
|
metageneration?: string;
|
||
|
timeDeleted?: string;
|
||
|
timeStorageClassUpdated?: string;
|
||
|
md5Hash?: string;
|
||
|
mediaLink?: string;
|
||
|
contentEncoding?: string;
|
||
|
contentDisposition?: string;
|
||
|
contentLanguage?: string;
|
||
|
cacheControl?: string;
|
||
|
metadata?: {
|
||
|
[key: string]: string;
|
||
|
};
|
||
|
acl?: [{
|
||
|
kind?: string;
|
||
|
id?: string;
|
||
|
selfLink?: string;
|
||
|
bucket?: string;
|
||
|
object?: string;
|
||
|
generation?: string;
|
||
|
entity?: string;
|
||
|
role?: string;
|
||
|
email?: string;
|
||
|
entityId?: string;
|
||
|
domain?: string;
|
||
|
projectTeam?: {
|
||
|
projectNumber?: string;
|
||
|
team?: string;
|
||
|
};
|
||
|
etag?: string;
|
||
|
}];
|
||
|
owner?: {
|
||
|
entity?: string;
|
||
|
entityId?: string;
|
||
|
};
|
||
|
crc32c?: string;
|
||
|
componentCount?: string;
|
||
|
etag?: string;
|
||
|
customerEncryption?: {
|
||
|
encryptionAlgorithm?: string;
|
||
|
keySha256?: string;
|
||
|
};
|
||
|
}
|