UNPKG

27.5 kBTypeScriptView Raw
1/// <reference types="node" />
2/// <reference types="node" />
3/// <reference types="node" />
4/// <reference types="node" />
5import { ApiError, BodyResponseCallback, DecorateRequestOptions, DeleteCallback, ExistsCallback, GetConfig, Metadata, MetadataCallback, ResponseBody, ServiceObject, SetMetadataResponse } from './nodejs-common';
6import * as http from 'http';
7import { Acl } from './acl';
8import { Channel } from './channel';
9import { File, FileOptions, CreateResumableUploadOptions, CreateWriteStreamOptions } from './file';
10import { Iam } from './iam';
11import { Notification } from './notification';
12import { Storage, Cors, PreconditionOptions, BucketOptions } from './storage';
13import { GetSignedUrlResponse, GetSignedUrlCallback, URLSigner, Query } from './signer';
14import { Readable } from 'stream';
15import { CRC32CValidatorGenerator } from './crc32c';
16import { URL } from 'url';
17import { SetMetadataOptions } from './nodejs-common/service-object';
18export type GetFilesResponse = [File[], {}, Metadata];
19export interface GetFilesCallback {
20 (err: Error | null, files?: File[], nextQuery?: {}, apiResponse?: Metadata): void;
21}
22interface WatchAllOptions {
23 delimiter?: string;
24 maxResults?: number;
25 pageToken?: string;
26 prefix?: string;
27 projection?: string;
28 userProject?: string;
29 versions?: boolean;
30}
31export interface AddLifecycleRuleOptions extends PreconditionOptions {
32 append?: boolean;
33}
34export interface LifecycleRule {
35 action: {
36 type: string;
37 storageClass?: string;
38 } | string;
39 condition: {
40 [key: string]: boolean | Date | number | string | string[];
41 };
42 storageClass?: string;
43}
44export interface EnableLoggingOptions extends PreconditionOptions {
45 bucket?: string | Bucket;
46 prefix: string;
47}
48export interface GetFilesOptions {
49 autoPaginate?: boolean;
50 delimiter?: string;
51 endOffset?: string;
52 includeTrailingDelimiter?: boolean;
53 prefix?: string;
54 maxApiCalls?: number;
55 maxResults?: number;
56 pageToken?: string;
57 startOffset?: string;
58 userProject?: string;
59 versions?: boolean;
60}
61export interface CombineOptions extends PreconditionOptions {
62 kmsKeyName?: string;
63 userProject?: string;
64}
65export interface CombineCallback {
66 (err: Error | null, newFile: File | null, apiResponse: Metadata): void;
67}
68export type CombineResponse = [File, Metadata];
69export interface CreateChannelConfig extends WatchAllOptions {
70 address: string;
71}
72export interface CreateChannelOptions {
73 userProject?: string;
74}
75export type CreateChannelResponse = [Channel, Metadata];
76export interface CreateChannelCallback {
77 (err: Error | null, channel: Channel | null, apiResponse: Metadata): void;
78}
79export interface CreateNotificationOptions {
80 customAttributes?: {
81 [key: string]: string;
82 };
83 eventTypes?: string[];
84 objectNamePrefix?: string;
85 payloadFormat?: string;
86 userProject?: string;
87}
88export interface CreateNotificationCallback {
89 (err: Error | null, notification: Notification | null, apiResponse: Metadata): void;
90}
91export type CreateNotificationResponse = [Notification, Metadata];
92export interface DeleteBucketOptions {
93 ignoreNotFound?: boolean;
94 userProject?: string;
95}
96export type DeleteBucketResponse = [Metadata];
97export interface DeleteBucketCallback extends DeleteCallback {
98 (err: Error | null, apiResponse: Metadata): void;
99}
100export interface DeleteFilesOptions extends GetFilesOptions, PreconditionOptions {
101 force?: boolean;
102}
103export interface DeleteFilesCallback {
104 (err: Error | Error[] | null, apiResponse?: object): void;
105}
106export type DeleteLabelsResponse = [Metadata];
107export type DeleteLabelsCallback = SetLabelsCallback;
108export type DeleteLabelsOptions = PreconditionOptions;
109export type DisableRequesterPaysOptions = PreconditionOptions;
110export type DisableRequesterPaysResponse = [Metadata];
111export interface DisableRequesterPaysCallback {
112 (err?: Error | null, apiResponse?: object): void;
113}
114export type EnableRequesterPaysResponse = [Metadata];
115export interface EnableRequesterPaysCallback {
116 (err?: Error | null, apiResponse?: Metadata): void;
117}
118export type EnableRequesterPaysOptions = PreconditionOptions;
119export interface BucketExistsOptions extends GetConfig {
120 userProject?: string;
121}
122export type BucketExistsResponse = [boolean];
123export type BucketExistsCallback = ExistsCallback;
124export interface GetBucketOptions extends GetConfig {
125 userProject?: string;
126}
127export type GetBucketResponse = [Bucket, Metadata];
128export interface GetBucketCallback {
129 (err: ApiError | null, bucket: Bucket | null, apiResponse: Metadata): void;
130}
131export interface GetLabelsOptions {
132 userProject?: string;
133}
134export type GetLabelsResponse = [Metadata];
135export interface GetLabelsCallback {
136 (err: Error | null, labels: object | null): void;
137}
138export type GetBucketMetadataResponse = [Metadata, Metadata];
139export interface GetBucketMetadataCallback {
140 (err: ApiError | null, metadata: Metadata | null, apiResponse: Metadata): void;
141}
142export interface GetBucketMetadataOptions {
143 userProject?: string;
144}
145export interface GetBucketSignedUrlConfig {
146 action: 'list';
147 version?: 'v2' | 'v4';
148 cname?: string;
149 virtualHostedStyle?: boolean;
150 expires: string | number | Date;
151 extensionHeaders?: http.OutgoingHttpHeaders;
152 queryParams?: Query;
153}
154export declare enum BucketActionToHTTPMethod {
155 list = "GET"
156}
157export declare enum AvailableServiceObjectMethods {
158 setMetadata = 0,
159 delete = 1
160}
161export interface GetNotificationsOptions {
162 userProject?: string;
163}
164export interface GetNotificationsCallback {
165 (err: Error | null, notifications: Notification[] | null, apiResponse: Metadata): void;
166}
167export type GetNotificationsResponse = [Notification[], Metadata];
168export interface MakeBucketPrivateOptions {
169 includeFiles?: boolean;
170 force?: boolean;
171 metadata?: Metadata;
172 userProject?: string;
173 preconditionOpts?: PreconditionOptions;
174}
175export type MakeBucketPrivateResponse = [File[]];
176export interface MakeBucketPrivateCallback {
177 (err?: Error | null, files?: File[]): void;
178}
179export interface MakeBucketPublicOptions {
180 includeFiles?: boolean;
181 force?: boolean;
182}
183export interface MakeBucketPublicCallback {
184 (err?: Error | null, files?: File[]): void;
185}
186export type MakeBucketPublicResponse = [File[]];
187export interface SetBucketMetadataOptions extends PreconditionOptions {
188 userProject?: string;
189}
190export type SetBucketMetadataResponse = [Metadata];
191export interface SetBucketMetadataCallback {
192 (err?: Error | null, metadata?: Metadata): void;
193}
194export interface BucketLockCallback {
195 (err?: Error | null, apiResponse?: Metadata): void;
196}
197export type BucketLockResponse = [Metadata];
198export interface Labels {
199 [key: string]: string;
200}
201export interface SetLabelsOptions extends PreconditionOptions {
202 userProject?: string;
203}
204export type SetLabelsResponse = [Metadata];
205export interface SetLabelsCallback {
206 (err?: Error | null, metadata?: Metadata): void;
207}
208export interface SetBucketStorageClassOptions extends PreconditionOptions {
209 userProject?: string;
210}
211export interface SetBucketStorageClassCallback {
212 (err?: Error | null): void;
213}
214export type UploadResponse = [File, Metadata];
215export interface UploadCallback {
216 (err: Error | null, file?: File | null, apiResponse?: Metadata): void;
217}
218export interface UploadOptions extends CreateResumableUploadOptions, CreateWriteStreamOptions {
219 destination?: string | File;
220 encryptionKey?: string | Buffer;
221 kmsKeyName?: string;
222 onUploadProgress?: (progressEvent: any) => void;
223}
224export interface MakeAllFilesPublicPrivateOptions {
225 force?: boolean;
226 private?: boolean;
227 public?: boolean;
228 userProject?: string;
229}
230interface MakeAllFilesPublicPrivateCallback {
231 (err?: Error | Error[] | null, files?: File[]): void;
232}
233type MakeAllFilesPublicPrivateResponse = [File[]];
234export declare enum BucketExceptionMessages {
235 PROVIDE_SOURCE_FILE = "You must provide at least one source file.",
236 DESTINATION_FILE_NOT_SPECIFIED = "A destination file must be specified.",
237 CHANNEL_ID_REQUIRED = "An ID is required to create a channel.",
238 CHANNEL_ADDRESS_REQUIRED = "An address is required to create a channel.",
239 TOPIC_NAME_REQUIRED = "A valid topic name is required.",
240 CONFIGURATION_OBJECT_PREFIX_REQUIRED = "A configuration object with a prefix is required.",
241 SPECIFY_FILE_NAME = "A file name must be specified.",
242 METAGENERATION_NOT_PROVIDED = "A metageneration must be provided.",
243 SUPPLY_NOTIFICATION_ID = "You must supply a notification ID."
244}
245/**
246 * @callback Crc32cGeneratorToStringCallback
247 * A method returning the CRC32C as a base64-encoded string.
248 *
249 * @returns {string}
250 *
251 * @example
252 * Hashing the string 'data' should return 'rth90Q=='
253 *
254 * ```js
255 * const buffer = Buffer.from('data');
256 * crc32c.update(buffer);
257 * crc32c.toString(); // 'rth90Q=='
258 * ```
259 **/
260/**
261 * @callback Crc32cGeneratorValidateCallback
262 * A method validating a base64-encoded CRC32C string.
263 *
264 * @param {string} [value] base64-encoded CRC32C string to validate
265 * @returns {boolean}
266 *
267 * @example
268 * Should return `true` if the value matches, `false` otherwise
269 *
270 * ```js
271 * const buffer = Buffer.from('data');
272 * crc32c.update(buffer);
273 * crc32c.validate('DkjKuA=='); // false
274 * crc32c.validate('rth90Q=='); // true
275 * ```
276 **/
277/**
278 * @callback Crc32cGeneratorUpdateCallback
279 * A method for passing `Buffer`s for CRC32C generation.
280 *
281 * @param {Buffer} [data] data to update CRC32C value with
282 * @returns {undefined}
283 *
284 * @example
285 * Hashing buffers from 'some ' and 'text\n'
286 *
287 * ```js
288 * const buffer1 = Buffer.from('some ');
289 * crc32c.update(buffer1);
290 *
291 * const buffer2 = Buffer.from('text\n');
292 * crc32c.update(buffer2);
293 *
294 * crc32c.toString(); // 'DkjKuA=='
295 * ```
296 **/
297/**
298 * @typedef {object} CRC32CValidator
299 * @property {Crc32cGeneratorToStringCallback}
300 * @property {Crc32cGeneratorValidateCallback}
301 * @property {Crc32cGeneratorUpdateCallback}
302 */
303/**
304 * A function that generates a CRC32C Validator. Defaults to {@link CRC32C}
305 *
306 * @name Bucket#crc32cGenerator
307 * @type {CRC32CValidator}
308 */
309/**
310 * Get and set IAM policies for your bucket.
311 *
312 * @name Bucket#iam
313 * @mixes Iam
314 *
315 * See {@link https://cloud.google.com/storage/docs/access-control/iam#short_title_iam_management| Cloud Storage IAM Management}
316 * See {@link https://cloud.google.com/iam/docs/granting-changing-revoking-access| Granting, Changing, and Revoking Access}
317 * See {@link https://cloud.google.com/iam/docs/understanding-roles| IAM Roles}
318 *
319 * @example
320 * ```
321 * const {Storage} = require('@google-cloud/storage');
322 * const storage = new Storage();
323 * const bucket = storage.bucket('albums');
324 *
325 * //-
326 * // Get the IAM policy for your bucket.
327 * //-
328 * bucket.iam.getPolicy(function(err, policy) {
329 * console.log(policy);
330 * });
331 *
332 * //-
333 * // If the callback is omitted, we'll return a Promise.
334 * //-
335 * bucket.iam.getPolicy().then(function(data) {
336 * const policy = data[0];
337 * const apiResponse = data[1];
338 * });
339 *
340 * ```
341 * @example <caption>include:samples/iam.js</caption>
342 * region_tag:storage_view_bucket_iam_members
343 * Example of retrieving a bucket's IAM policy:
344 *
345 * @example <caption>include:samples/iam.js</caption>
346 * region_tag:storage_add_bucket_iam_member
347 * Example of adding to a bucket's IAM policy:
348 *
349 * @example <caption>include:samples/iam.js</caption>
350 * region_tag:storage_remove_bucket_iam_member
351 * Example of removing from a bucket's IAM policy:
352 */
353/**
354 * Cloud Storage uses access control lists (ACLs) to manage object and
355 * bucket access. ACLs are the mechanism you use to share objects with other
356 * users and allow other users to access your buckets and objects.
357 *
358 * An ACL consists of one or more entries, where each entry grants permissions
359 * to an entity. Permissions define the actions that can be performed against
360 * an object or bucket (for example, `READ` or `WRITE`); the entity defines
361 * who the permission applies to (for example, a specific user or group of
362 * users).
363 *
364 * The `acl` object on a Bucket instance provides methods to get you a list of
365 * the ACLs defined on your bucket, as well as set, update, and delete them.
366 *
367 * Buckets also have
368 * {@link https://cloud.google.com/storage/docs/access-control/lists#default| default ACLs}
369 * for all created files. Default ACLs specify permissions that all new
370 * objects added to the bucket will inherit by default. You can add, delete,
371 * get, and update entities and permissions for these as well with
372 * {@link Bucket#acl.default}.
373 *
374 * See {@link http://goo.gl/6qBBPO| About Access Control Lists}
375 * See {@link https://cloud.google.com/storage/docs/access-control/lists#default| Default ACLs}
376 *
377 * @name Bucket#acl
378 * @mixes Acl
379 * @property {Acl} default Cloud Storage Buckets have
380 * {@link https://cloud.google.com/storage/docs/access-control/lists#default| default ACLs}
381 * for all created files. You can add, delete, get, and update entities and
382 * permissions for these as well. The method signatures and examples are all
383 * the same, after only prefixing the method call with `default`.
384 *
385 * @example
386 * ```
387 * const {Storage} = require('@google-cloud/storage');
388 * const storage = new Storage();
389 *
390 * //-
391 * // Make a bucket's contents publicly readable.
392 * //-
393 * const myBucket = storage.bucket('my-bucket');
394 *
395 * const options = {
396 * entity: 'allUsers',
397 * role: storage.acl.READER_ROLE
398 * };
399 *
400 * myBucket.acl.add(options, function(err, aclObject) {});
401 *
402 * //-
403 * // If the callback is omitted, we'll return a Promise.
404 * //-
405 * myBucket.acl.add(options).then(function(data) {
406 * const aclObject = data[0];
407 * const apiResponse = data[1];
408 * });
409 *
410 * ```
411 * @example <caption>include:samples/acl.js</caption>
412 * region_tag:storage_print_bucket_acl
413 * Example of printing a bucket's ACL:
414 *
415 * @example <caption>include:samples/acl.js</caption>
416 * region_tag:storage_print_bucket_acl_for_user
417 * Example of printing a bucket's ACL for a specific user:
418 *
419 * @example <caption>include:samples/acl.js</caption>
420 * region_tag:storage_add_bucket_owner
421 * Example of adding an owner to a bucket:
422 *
423 * @example <caption>include:samples/acl.js</caption>
424 * region_tag:storage_remove_bucket_owner
425 * Example of removing an owner from a bucket:
426 *
427 * @example <caption>include:samples/acl.js</caption>
428 * region_tag:storage_add_bucket_default_owner
429 * Example of adding a default owner to a bucket:
430 *
431 * @example <caption>include:samples/acl.js</caption>
432 * region_tag:storage_remove_bucket_default_owner
433 * Example of removing a default owner from a bucket:
434 */
435/**
436 * The API-formatted resource description of the bucket.
437 *
438 * Note: This is not guaranteed to be up-to-date when accessed. To get the
439 * latest record, call the `getMetadata()` method.
440 *
441 * @name Bucket#metadata
442 * @type {object}
443 */
444/**
445 * The bucket's name.
446 * @name Bucket#name
447 * @type {string}
448 */
449/**
450 * Get {@link File} objects for the files currently in the bucket as a
451 * readable object stream.
452 *
453 * @method Bucket#getFilesStream
454 * @param {GetFilesOptions} [query] Query object for listing files.
455 * @returns {ReadableStream} A readable stream that emits {@link File} instances.
456 *
457 * @example
458 * ```
459 * const {Storage} = require('@google-cloud/storage');
460 * const storage = new Storage();
461 * const bucket = storage.bucket('albums');
462 *
463 * bucket.getFilesStream()
464 * .on('error', console.error)
465 * .on('data', function(file) {
466 * // file is a File object.
467 * })
468 * .on('end', function() {
469 * // All files retrieved.
470 * });
471 *
472 * //-
473 * // If you anticipate many results, you can end a stream early to prevent
474 * // unnecessary processing and API requests.
475 * //-
476 * bucket.getFilesStream()
477 * .on('data', function(file) {
478 * this.end();
479 * });
480 *
481 * //-
482 * // If you're filtering files with a delimiter, you should use
483 * // {@link Bucket#getFiles} and set `autoPaginate: false` in order to
484 * // preserve the `apiResponse` argument.
485 * //-
486 * const prefixes = [];
487 *
488 * function callback(err, files, nextQuery, apiResponse) {
489 * prefixes = prefixes.concat(apiResponse.prefixes);
490 *
491 * if (nextQuery) {
492 * bucket.getFiles(nextQuery, callback);
493 * } else {
494 * // prefixes = The finished array of prefixes.
495 * }
496 * }
497 *
498 * bucket.getFiles({
499 * autoPaginate: false,
500 * delimiter: '/'
501 * }, callback);
502 * ```
503 */
504/**
505 * Create a Bucket object to interact with a Cloud Storage bucket.
506 *
507 * @class
508 * @hideconstructor
509 *
510 * @param {Storage} storage A {@link Storage} instance.
511 * @param {string} name The name of the bucket.
512 * @param {object} [options] Configuration object.
513 * @param {string} [options.userProject] User project.
514 *
515 * @example
516 * ```
517 * const {Storage} = require('@google-cloud/storage');
518 * const storage = new Storage();
519 * const bucket = storage.bucket('albums');
520 * ```
521 */
522declare class Bucket extends ServiceObject {
523 metadata: Metadata;
524 name: string;
525 /**
526 * A reference to the {@link Storage} associated with this {@link Bucket}
527 * instance.
528 * @name Bucket#storage
529 * @type {Storage}
530 */
531 storage: Storage;
532 /**
533 * A user project to apply to each request from this bucket.
534 * @name Bucket#userProject
535 * @type {string}
536 */
537 userProject?: string;
538 acl: Acl;
539 iam: Iam;
540 crc32cGenerator: CRC32CValidatorGenerator;
541 getFilesStream(query?: GetFilesOptions): Readable;
542 signer?: URLSigner;
543 private instanceRetryValue?;
544 instancePreconditionOpts?: PreconditionOptions;
545 constructor(storage: Storage, name: string, options?: BucketOptions);
546 /**
547 * The bucket's Cloud Storage URI (`gs://`)
548 *
549 * @example
550 * ```ts
551 * const {Storage} = require('@google-cloud/storage');
552 * const storage = new Storage();
553 * const bucket = storage.bucket('my-bucket');
554 *
555 * // `gs://my-bucket`
556 * const href = bucket.cloudStorageURI.href;
557 * ```
558 */
559 get cloudStorageURI(): URL;
560 addLifecycleRule(rule: LifecycleRule | LifecycleRule[], options?: AddLifecycleRuleOptions): Promise<SetBucketMetadataResponse>;
561 addLifecycleRule(rule: LifecycleRule | LifecycleRule[], options: AddLifecycleRuleOptions, callback: SetBucketMetadataCallback): void;
562 addLifecycleRule(rule: LifecycleRule | LifecycleRule[], callback: SetBucketMetadataCallback): void;
563 combine(sources: string[] | File[], destination: string | File, options?: CombineOptions): Promise<CombineResponse>;
564 combine(sources: string[] | File[], destination: string | File, options: CombineOptions, callback: CombineCallback): void;
565 combine(sources: string[] | File[], destination: string | File, callback: CombineCallback): void;
566 createChannel(id: string, config: CreateChannelConfig, options?: CreateChannelOptions): Promise<CreateChannelResponse>;
567 createChannel(id: string, config: CreateChannelConfig, callback: CreateChannelCallback): void;
568 createChannel(id: string, config: CreateChannelConfig, options: CreateChannelOptions, callback: CreateChannelCallback): void;
569 createNotification(topic: string, options?: CreateNotificationOptions): Promise<CreateNotificationResponse>;
570 createNotification(topic: string, options: CreateNotificationOptions, callback: CreateNotificationCallback): void;
571 createNotification(topic: string, callback: CreateNotificationCallback): void;
572 deleteFiles(query?: DeleteFilesOptions): Promise<void>;
573 deleteFiles(callback: DeleteFilesCallback): void;
574 deleteFiles(query: DeleteFilesOptions, callback: DeleteFilesCallback): void;
575 deleteLabels(labels?: string | string[]): Promise<DeleteLabelsResponse>;
576 deleteLabels(options: DeleteLabelsOptions): Promise<DeleteLabelsResponse>;
577 deleteLabels(callback: DeleteLabelsCallback): void;
578 deleteLabels(labels: string | string[], options: DeleteLabelsOptions): Promise<DeleteLabelsResponse>;
579 deleteLabels(labels: string | string[], callback: DeleteLabelsCallback): void;
580 deleteLabels(labels: string | string[], options: DeleteLabelsOptions, callback: DeleteLabelsCallback): void;
581 disableRequesterPays(options?: DisableRequesterPaysOptions): Promise<DisableRequesterPaysResponse>;
582 disableRequesterPays(callback: DisableRequesterPaysCallback): void;
583 disableRequesterPays(options: DisableRequesterPaysOptions, callback: DisableRequesterPaysCallback): void;
584 enableLogging(config: EnableLoggingOptions): Promise<SetBucketMetadataResponse>;
585 enableLogging(config: EnableLoggingOptions, callback: SetBucketMetadataCallback): void;
586 enableRequesterPays(options?: EnableRequesterPaysOptions): Promise<EnableRequesterPaysResponse>;
587 enableRequesterPays(callback: EnableRequesterPaysCallback): void;
588 enableRequesterPays(options: EnableRequesterPaysOptions, callback: EnableRequesterPaysCallback): void;
589 /**
590 * Create a {@link File} object. See {@link File} to see how to handle
591 * the different use cases you may have.
592 *
593 * @param {string} name The name of the file in this bucket.
594 * @param {FileOptions} [options] Configuration options.
595 * @param {string|number} [options.generation] Only use a specific revision of
596 * this file.
597 * @param {string} [options.encryptionKey] A custom encryption key. See
598 * {@link https://cloud.google.com/storage/docs/encryption#customer-supplied| Customer-supplied Encryption Keys}.
599 * @param {string} [options.kmsKeyName] The name of the Cloud KMS key that will
600 * be used to encrypt the object. Must be in the format:
601 * `projects/my-project/locations/location/keyRings/my-kr/cryptoKeys/my-key`.
602 * KMS key ring must use the same location as the bucket.
603 * @param {string} [options.userProject] The ID of the project which will be
604 * billed for all requests made from File object.
605 * @returns {File}
606 *
607 * @example
608 * ```
609 * const {Storage} = require('@google-cloud/storage');
610 * const storage = new Storage();
611 * const bucket = storage.bucket('albums');
612 * const file = bucket.file('my-existing-file.png');
613 * ```
614 */
615 file(name: string, options?: FileOptions): File;
616 getFiles(query?: GetFilesOptions): Promise<GetFilesResponse>;
617 getFiles(query: GetFilesOptions, callback: GetFilesCallback): void;
618 getFiles(callback: GetFilesCallback): void;
619 getLabels(options?: GetLabelsOptions): Promise<GetLabelsResponse>;
620 getLabels(callback: GetLabelsCallback): void;
621 getLabels(options: GetLabelsOptions, callback: GetLabelsCallback): void;
622 getNotifications(options?: GetNotificationsOptions): Promise<GetNotificationsResponse>;
623 getNotifications(callback: GetNotificationsCallback): void;
624 getNotifications(options: GetNotificationsOptions, callback: GetNotificationsCallback): void;
625 getSignedUrl(cfg: GetBucketSignedUrlConfig): Promise<GetSignedUrlResponse>;
626 getSignedUrl(cfg: GetBucketSignedUrlConfig, callback: GetSignedUrlCallback): void;
627 lock(metageneration: number | string): Promise<BucketLockResponse>;
628 lock(metageneration: number | string, callback: BucketLockCallback): void;
629 makePrivate(options?: MakeBucketPrivateOptions): Promise<MakeBucketPrivateResponse>;
630 makePrivate(callback: MakeBucketPrivateCallback): void;
631 makePrivate(options: MakeBucketPrivateOptions, callback: MakeBucketPrivateCallback): void;
632 makePublic(options?: MakeBucketPublicOptions): Promise<MakeBucketPublicResponse>;
633 makePublic(callback: MakeBucketPublicCallback): void;
634 makePublic(options: MakeBucketPublicOptions, callback: MakeBucketPublicCallback): void;
635 /**
636 * Get a reference to a Cloud Pub/Sub Notification.
637 *
638 * @param {string} id ID of notification.
639 * @returns {Notification}
640 * @see Notification
641 *
642 * @example
643 * ```
644 * const {Storage} = require('@google-cloud/storage');
645 * const storage = new Storage();
646 * const bucket = storage.bucket('my-bucket');
647 * const notification = bucket.notification('1');
648 * ```
649 */
650 notification(id: string): Notification;
651 removeRetentionPeriod(options?: SetBucketMetadataOptions): Promise<SetBucketMetadataResponse>;
652 removeRetentionPeriod(callback: SetBucketMetadataCallback): void;
653 removeRetentionPeriod(options: SetBucketMetadataOptions, callback: SetBucketMetadataCallback): void;
654 request(reqOpts: DecorateRequestOptions): Promise<[ResponseBody, Metadata]>;
655 request(reqOpts: DecorateRequestOptions, callback: BodyResponseCallback): void;
656 setLabels(labels: Labels, options?: SetLabelsOptions): Promise<SetLabelsResponse>;
657 setLabels(labels: Labels, callback: SetLabelsCallback): void;
658 setLabels(labels: Labels, options: SetLabelsOptions, callback: SetLabelsCallback): void;
659 setMetadata(metadata: Metadata, options?: SetMetadataOptions): Promise<SetMetadataResponse>;
660 setMetadata(metadata: Metadata, callback: MetadataCallback): void;
661 setMetadata(metadata: Metadata, options: SetMetadataOptions, callback: MetadataCallback): void;
662 setRetentionPeriod(duration: number, options?: SetBucketMetadataOptions): Promise<SetBucketMetadataResponse>;
663 setRetentionPeriod(duration: number, callback: SetBucketMetadataCallback): void;
664 setRetentionPeriod(duration: number, options: SetBucketMetadataOptions, callback: SetBucketMetadataCallback): void;
665 setCorsConfiguration(corsConfiguration: Cors[], options?: SetBucketMetadataOptions): Promise<SetBucketMetadataResponse>;
666 setCorsConfiguration(corsConfiguration: Cors[], callback: SetBucketMetadataCallback): void;
667 setCorsConfiguration(corsConfiguration: Cors[], options: SetBucketMetadataOptions, callback: SetBucketMetadataCallback): void;
668 setStorageClass(storageClass: string, options?: SetBucketStorageClassOptions): Promise<SetBucketMetadataResponse>;
669 setStorageClass(storageClass: string, callback: SetBucketStorageClassCallback): void;
670 setStorageClass(storageClass: string, options: SetBucketStorageClassOptions, callback: SetBucketStorageClassCallback): void;
671 /**
672 * Set a user project to be billed for all requests made from this Bucket
673 * object and any files referenced from this Bucket object.
674 *
675 * @param {string} userProject The user project.
676 *
677 * @example
678 * ```
679 * const {Storage} = require('@google-cloud/storage');
680 * const storage = new Storage();
681 * const bucket = storage.bucket('albums');
682 *
683 * bucket.setUserProject('grape-spaceship-123');
684 * ```
685 */
686 setUserProject(userProject: string): void;
687 upload(pathString: string, options?: UploadOptions): Promise<UploadResponse>;
688 upload(pathString: string, options: UploadOptions, callback: UploadCallback): void;
689 upload(pathString: string, callback: UploadCallback): void;
690 makeAllFilesPublicPrivate_(options?: MakeAllFilesPublicPrivateOptions): Promise<MakeAllFilesPublicPrivateResponse>;
691 makeAllFilesPublicPrivate_(callback: MakeAllFilesPublicPrivateCallback): void;
692 makeAllFilesPublicPrivate_(options: MakeAllFilesPublicPrivateOptions, callback: MakeAllFilesPublicPrivateCallback): void;
693 getId(): string;
694 disableAutoRetryConditionallyIdempotent_(coreOpts: any, methodType: AvailableServiceObjectMethods, localPreconditionOptions?: PreconditionOptions): void;
695}
696/**
697 * Reference to the {@link Bucket} class.
698 * @name module:@google-cloud/storage.Bucket
699 * @see Bucket
700 */
701export { Bucket };
702
\No newline at end of file