1 | import { CloudFunction, EventContext } from "../cloud-functions";
|
2 | /**
|
3 | * Registers a Cloud Function scoped to a specific storage bucket.
|
4 | *
|
5 | * @param bucket Name of the bucket to which this Cloud Function is
|
6 | * scoped.
|
7 | *
|
8 | * @returns Storage bucket builder interface.
|
9 | */
|
10 | export declare function bucket(bucket?: string): BucketBuilder;
|
11 | /**
|
12 | * Registers a Cloud Function scoped to the default storage bucket for the
|
13 | * project.
|
14 | *
|
15 | * @returns Storage object builder interface.
|
16 | */
|
17 | export declare function object(): ObjectBuilder;
|
18 | /**
|
19 | * The Google Cloud Storage bucket builder interface.
|
20 | *
|
21 | * Access via `functions.storage.bucket()`.
|
22 | */
|
23 | export declare class BucketBuilder {
|
24 | private triggerResource;
|
25 | private options;
|
26 | /**
|
27 | * Event handler which fires every time a Google Cloud Storage change occurs.
|
28 | *
|
29 | * @returns Storage object builder interface scoped to the specified storage
|
30 | * bucket.
|
31 | */
|
32 | object(): ObjectBuilder;
|
33 | }
|
34 | /**
|
35 | * The Google Cloud Storage object builder interface.
|
36 | *
|
37 | * Access via `functions.storage.object()`.
|
38 | */
|
39 | export declare class ObjectBuilder {
|
40 | private triggerResource;
|
41 | private options;
|
42 | /**
|
43 | * Event handler sent only when a bucket has enabled object versioning.
|
44 | * This event indicates that the live version of an object has become an
|
45 | * archived version, either because it was archived or because it was
|
46 | * overwritten by the upload of an object of the same name.
|
47 | *
|
48 | * @param handler Event handler which is run every time a Google Cloud Storage
|
49 | * archival occurs.
|
50 | *
|
51 | * @returns A function which you can export and deploy.
|
52 | */
|
53 | onArchive(handler: (object: ObjectMetadata, context: EventContext) => PromiseLike<any> | any): CloudFunction<ObjectMetadata>;
|
54 | /**
|
55 | * Event handler which fires every time a Google Cloud Storage deletion occurs.
|
56 | *
|
57 | * Sent when an object has been permanently deleted. This includes objects
|
58 | * that are overwritten or are deleted as part of the bucket's lifecycle
|
59 | * configuration. For buckets with object versioning enabled, this is not
|
60 | * sent when an object is archived, even if archival occurs
|
61 | * via the `storage.objects.delete` method.
|
62 | *
|
63 | * @param handler Event handler which is run every time a Google Cloud Storage
|
64 | * deletion occurs.
|
65 | *
|
66 | * @returns A function which you can export and deploy.
|
67 | */
|
68 | onDelete(handler: (object: ObjectMetadata, context: EventContext) => PromiseLike<any> | any): CloudFunction<ObjectMetadata>;
|
69 | /**
|
70 | * Event handler which fires every time a Google Cloud Storage object
|
71 | * creation occurs.
|
72 | *
|
73 | * Sent when a new object (or a new generation of an existing object)
|
74 | * is successfully created in the bucket. This includes copying or rewriting
|
75 | * an existing object. A failed upload does not trigger this event.
|
76 | *
|
77 | * @param handler Event handler which is run every time a Google Cloud Storage
|
78 | * object creation occurs.
|
79 | *
|
80 | * @returns A function which you can export and deploy.
|
81 | */
|
82 | onFinalize(handler: (object: ObjectMetadata, context: EventContext) => PromiseLike<any> | any): CloudFunction<ObjectMetadata>;
|
83 | /**
|
84 | * Event handler which fires every time the metadata of an existing object
|
85 | * changes.
|
86 | *
|
87 | * @param handler Event handler which is run every time a Google Cloud Storage
|
88 | * metadata update occurs.
|
89 | *
|
90 | * @returns A function which you can export and deploy.
|
91 | */
|
92 | onMetadataUpdate(handler: (object: ObjectMetadata, context: EventContext) => PromiseLike<any> | any): CloudFunction<ObjectMetadata>;
|
93 | /** @hidden */
|
94 | private onOperation;
|
95 | }
|
96 | /** Interface representing a Google Google Cloud Storage object metadata object. */
|
97 | export interface ObjectMetadata {
|
98 | /** The kind of the object, which is always `storage#object`. */
|
99 | kind: string;
|
100 | /**
|
101 | * The ID of the object, including the bucket name, object name, and
|
102 | * generation number.
|
103 | */
|
104 | id: string;
|
105 | /** Storage bucket that contains the object. */
|
106 | bucket: string;
|
107 | /** Storage class of the object. */
|
108 | storageClass: string;
|
109 | /**
|
110 | * The value of the `Content-Length` header, used to determine the length of
|
111 | * the object data in bytes.
|
112 | */
|
113 | size: string;
|
114 | /** The creation time of the object in RFC 3339 format. */
|
115 | timeCreated: string;
|
116 | /**
|
117 | * The modification time of the object metadata in RFC 3339 format.
|
118 | */
|
119 | updated: string;
|
120 | /** Link to access the object, assuming you have sufficient permissions. */
|
121 | selfLink?: string;
|
122 | /** The object's name. */
|
123 | name?: string;
|
124 | /**
|
125 | * Generation version number that changes each time the object is
|
126 | * overwritten.
|
127 | */
|
128 | generation?: string;
|
129 | /** The object's content type, also known as the MIME type. */
|
130 | contentType?: string;
|
131 | /**
|
132 | * Meta-generation version number that changes each time the object's metadata
|
133 | * is updated.
|
134 | */
|
135 | metageneration?: string;
|
136 | /**
|
137 | * The deletion time of the object in RFC 3339 format. Returned
|
138 | * only if this version of the object has been deleted.
|
139 | */
|
140 | timeDeleted?: string;
|
141 | timeStorageClassUpdated?: string;
|
142 | /**
|
143 | * MD5 hash for the object. All Google Cloud Storage objects
|
144 | * have a CRC32C hash or MD5 hash.
|
145 | */
|
146 | md5Hash?: string;
|
147 | /** Media download link. */
|
148 | mediaLink?: string;
|
149 | /**
|
150 | * Content-Encoding to indicate that an object is compressed
|
151 | * (for example, with gzip compression) while maintaining its Content-Type.
|
152 | */
|
153 | contentEncoding?: string;
|
154 | /**
|
155 | * The value of the `Content-Disposition` header, used to specify presentation
|
156 | * information about the data being transmitted.
|
157 | */
|
158 | contentDisposition?: string;
|
159 | /** ISO 639-1 language code of the content. */
|
160 | contentLanguage?: string;
|
161 | /**
|
162 | * The value of the `Cache-Control` header, used to determine whether Internet
|
163 | * caches are allowed to cache public data for an object.
|
164 | */
|
165 | cacheControl?: string;
|
166 | /** User-provided metadata. */
|
167 | metadata?: {
|
168 | [key: string]: string;
|
169 | };
|
170 | acl?: [
|
171 | {
|
172 | kind?: string;
|
173 | id?: string;
|
174 | selfLink?: string;
|
175 | bucket?: string;
|
176 | object?: string;
|
177 | generation?: string;
|
178 | entity?: string;
|
179 | role?: string;
|
180 | email?: string;
|
181 | entityId?: string;
|
182 | domain?: string;
|
183 | projectTeam?: {
|
184 | projectNumber?: string;
|
185 | team?: string;
|
186 | };
|
187 | etag?: string;
|
188 | }
|
189 | ];
|
190 | owner?: {
|
191 | entity?: string;
|
192 | entityId?: string;
|
193 | };
|
194 | /**
|
195 | * The object's CRC32C hash. All Google Cloud Storage objects
|
196 | * have a CRC32C hash or MD5 hash.
|
197 | */
|
198 | crc32c?: string;
|
199 | /**
|
200 | * Specifies the number of originally uploaded objects from which
|
201 | * a composite object was created.
|
202 | */
|
203 | componentCount?: string;
|
204 | etag?: string;
|
205 | /**
|
206 | * Customer-supplied encryption key.
|
207 | *
|
208 | * This object contains the following properties:
|
209 | * * `encryptionAlgorithm` (`string|undefined`): The encryption algorithm that
|
210 | * was used. Always contains the value `AES256`.
|
211 | * * `keySha256` (`string|undefined`): An RFC 4648 base64-encoded string of the
|
212 | * SHA256 hash of your encryption key. You can use this SHA256 hash to
|
213 | * uniquely identify the AES-256 encryption key required to decrypt the
|
214 | * object, which you must store securely.
|
215 | */
|
216 | customerEncryption?: {
|
217 | encryptionAlgorithm?: string;
|
218 | keySha256?: string;
|
219 | };
|
220 | }
|