// Copyright 2022 Luca Casonato. All rights reserved. MIT license. /** * Cloud Storage JSON API Client for Deno * ====================================== * * Stores and retrieves potentially large, immutable data objects. * * Docs: https://developers.google.com/storage/docs/json_api/ * Source: https://googleapis.deno.dev/v1/storage:v1.ts */ import { auth, CredentialsClient, GoogleAuth, request } from "/_/base@v1/mod.ts"; export { auth, GoogleAuth }; export type { CredentialsClient }; /** * Stores and retrieves potentially large, immutable data objects. */ export class Storage { #client: CredentialsClient | undefined; #baseUrl: string; constructor(client?: CredentialsClient, baseUrl: string = "https://storage.googleapis.com/storage/v1/") { this.#client = client; this.#baseUrl = baseUrl; } /** * Disables an Anywhere Cache instance. * * @param anywhereCacheId The ID of requested Anywhere Cache instance. * @param bucket Name of the parent bucket. */ async anywhereCachesDisable(anywhereCacheId: string, bucket: string): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/anywhereCaches/${ anywhereCacheId }/disable`); const data = await request(url.href, { client: this.#client, method: "POST", }); return deserializeAnywhereCache(data); } /** * Returns the metadata of an Anywhere Cache instance. * * @param anywhereCacheId The ID of requested Anywhere Cache instance. * @param bucket Name of the parent bucket. */ async anywhereCachesGet(anywhereCacheId: string, bucket: string): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/anywhereCaches/${ anywhereCacheId }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeAnywhereCache(data); } /** * Creates an Anywhere Cache instance. * * @param bucket Name of the parent bucket. */ async anywhereCachesInsert(bucket: string, req: AnywhereCache): Promise { req = serializeAnywhereCache(req); const url = new URL(`${this.#baseUrl}b/${ bucket }/anywhereCaches`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as GoogleLongrunningOperation; } /** * Returns a list of Anywhere Cache instances of the bucket matching the * criteria. * * @param bucket Name of the parent bucket. */ async anywhereCachesList(bucket: string, opts: AnywhereCachesListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/anywhereCaches`); if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeAnywhereCaches(data); } /** * Pauses an Anywhere Cache instance. * * @param anywhereCacheId The ID of requested Anywhere Cache instance. * @param bucket Name of the parent bucket. */ async anywhereCachesPause(anywhereCacheId: string, bucket: string): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/anywhereCaches/${ anywhereCacheId }/pause`); const data = await request(url.href, { client: this.#client, method: "POST", }); return deserializeAnywhereCache(data); } /** * Resumes a paused or disabled Anywhere Cache instance. * * @param anywhereCacheId The ID of requested Anywhere Cache instance. * @param bucket Name of the parent bucket. */ async anywhereCachesResume(anywhereCacheId: string, bucket: string): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/anywhereCaches/${ anywhereCacheId }/resume`); const data = await request(url.href, { client: this.#client, method: "POST", }); return deserializeAnywhereCache(data); } /** * Updates the config(ttl and admissionPolicy) of an Anywhere Cache instance. * * @param anywhereCacheId The ID of requested Anywhere Cache instance. * @param bucket Name of the parent bucket. */ async anywhereCachesUpdate(anywhereCacheId: string, bucket: string, req: AnywhereCache): Promise { req = serializeAnywhereCache(req); const url = new URL(`${this.#baseUrl}b/${ bucket }/anywhereCaches/${ anywhereCacheId }`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PATCH", body, }); return data as GoogleLongrunningOperation; } /** * Permanently deletes the ACL entry for the specified entity on the * specified bucket. * * @param bucket Name of a bucket. * @param entity The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers. */ async bucketAccessControlsDelete(bucket: string, entity: string, opts: BucketAccessControlsDeleteOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/acl/${ entity }`); if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "DELETE", }); } /** * Returns the ACL entry for the specified entity on the specified bucket. * * @param bucket Name of a bucket. * @param entity The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers. */ async bucketAccessControlsGet(bucket: string, entity: string, opts: BucketAccessControlsGetOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/acl/${ entity }`); if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as BucketAccessControl; } /** * Creates a new ACL entry on the specified bucket. * * @param bucket Name of a bucket. */ async bucketAccessControlsInsert(bucket: string, req: BucketAccessControl, opts: BucketAccessControlsInsertOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/acl`); if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as BucketAccessControl; } /** * Retrieves ACL entries on the specified bucket. * * @param bucket Name of a bucket. */ async bucketAccessControlsList(bucket: string, opts: BucketAccessControlsListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/acl`); if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as BucketAccessControls; } /** * Patches an ACL entry on the specified bucket. * * @param bucket Name of a bucket. * @param entity The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers. */ async bucketAccessControlsPatch(bucket: string, entity: string, req: BucketAccessControl, opts: BucketAccessControlsPatchOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/acl/${ entity }`); if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PATCH", body, }); return data as BucketAccessControl; } /** * Updates an ACL entry on the specified bucket. * * @param bucket Name of a bucket. * @param entity The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers. */ async bucketAccessControlsUpdate(bucket: string, entity: string, req: BucketAccessControl, opts: BucketAccessControlsUpdateOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/acl/${ entity }`); if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PUT", body, }); return data as BucketAccessControl; } /** * Deletes an empty bucket. Deletions are permanent unless soft delete is * enabled on the bucket. * * @param bucket Name of a bucket. */ async bucketsDelete(bucket: string, opts: BucketsDeleteOptions = {}): Promise { opts = serializeBucketsDeleteOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }`); if (opts.ifMetagenerationMatch !== undefined) { url.searchParams.append("ifMetagenerationMatch", String(opts.ifMetagenerationMatch)); } if (opts.ifMetagenerationNotMatch !== undefined) { url.searchParams.append("ifMetagenerationNotMatch", String(opts.ifMetagenerationNotMatch)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "DELETE", }); } /** * Returns metadata for the specified bucket. * * @param bucket Name of a bucket. */ async bucketsGet(bucket: string, opts: BucketsGetOptions = {}): Promise { opts = serializeBucketsGetOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }`); if (opts.generation !== undefined) { url.searchParams.append("generation", String(opts.generation)); } if (opts.ifMetagenerationMatch !== undefined) { url.searchParams.append("ifMetagenerationMatch", String(opts.ifMetagenerationMatch)); } if (opts.ifMetagenerationNotMatch !== undefined) { url.searchParams.append("ifMetagenerationNotMatch", String(opts.ifMetagenerationNotMatch)); } if (opts.projection !== undefined) { url.searchParams.append("projection", String(opts.projection)); } if (opts.softDeleted !== undefined) { url.searchParams.append("softDeleted", String(opts.softDeleted)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeBucket(data); } /** * Returns an IAM policy for the specified bucket. * * @param bucket Name of a bucket. */ async bucketsGetIamPolicy(bucket: string, opts: BucketsGetIamPolicyOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/iam`); if (opts.optionsRequestedPolicyVersion !== undefined) { url.searchParams.append("optionsRequestedPolicyVersion", String(opts.optionsRequestedPolicyVersion)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializePolicy(data); } /** * Returns the storage layout configuration for the specified bucket. Note * that this operation requires storage.objects.list permission. * * @param bucket Name of a bucket. */ async bucketsGetStorageLayout(bucket: string, opts: BucketsGetStorageLayoutOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/storageLayout`); if (opts.prefix !== undefined) { url.searchParams.append("prefix", String(opts.prefix)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as BucketStorageLayout; } /** * Creates a new bucket. * */ async bucketsInsert(req: Bucket, opts: BucketsInsertOptions = {}): Promise { req = serializeBucket(req); const url = new URL(`${this.#baseUrl}b`); if (opts.enableObjectRetention !== undefined) { url.searchParams.append("enableObjectRetention", String(opts.enableObjectRetention)); } if (opts.predefinedAcl !== undefined) { url.searchParams.append("predefinedAcl", String(opts.predefinedAcl)); } if (opts.predefinedDefaultObjectAcl !== undefined) { url.searchParams.append("predefinedDefaultObjectAcl", String(opts.predefinedDefaultObjectAcl)); } if (opts.project !== undefined) { url.searchParams.append("project", String(opts.project)); } if (opts.projection !== undefined) { url.searchParams.append("projection", String(opts.projection)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeBucket(data); } /** * Retrieves a list of buckets for a given project. * */ async bucketsList(opts: BucketsListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b`); if (opts.maxResults !== undefined) { url.searchParams.append("maxResults", String(opts.maxResults)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } if (opts.prefix !== undefined) { url.searchParams.append("prefix", String(opts.prefix)); } if (opts.project !== undefined) { url.searchParams.append("project", String(opts.project)); } if (opts.projection !== undefined) { url.searchParams.append("projection", String(opts.projection)); } if (opts.softDeleted !== undefined) { url.searchParams.append("softDeleted", String(opts.softDeleted)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeBuckets(data); } /** * Locks retention policy on a bucket. * * @param bucket Name of a bucket. */ async bucketsLockRetentionPolicy(bucket: string, opts: BucketsLockRetentionPolicyOptions = {}): Promise { opts = serializeBucketsLockRetentionPolicyOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/lockRetentionPolicy`); if (opts.ifMetagenerationMatch !== undefined) { url.searchParams.append("ifMetagenerationMatch", String(opts.ifMetagenerationMatch)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "POST", }); return deserializeBucket(data); } /** * Patches a bucket. Changes to the bucket will be readable immediately after * writing, but configuration changes may take time to propagate. * * @param bucket Name of a bucket. */ async bucketsPatch(bucket: string, req: Bucket, opts: BucketsPatchOptions = {}): Promise { req = serializeBucket(req); opts = serializeBucketsPatchOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }`); if (opts.ifMetagenerationMatch !== undefined) { url.searchParams.append("ifMetagenerationMatch", String(opts.ifMetagenerationMatch)); } if (opts.ifMetagenerationNotMatch !== undefined) { url.searchParams.append("ifMetagenerationNotMatch", String(opts.ifMetagenerationNotMatch)); } if (opts.predefinedAcl !== undefined) { url.searchParams.append("predefinedAcl", String(opts.predefinedAcl)); } if (opts.predefinedDefaultObjectAcl !== undefined) { url.searchParams.append("predefinedDefaultObjectAcl", String(opts.predefinedDefaultObjectAcl)); } if (opts.projection !== undefined) { url.searchParams.append("projection", String(opts.projection)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PATCH", body, }); return deserializeBucket(data); } /** * Initiates a long-running Relocate Bucket operation on the specified * bucket. * * @param bucket Name of the bucket to be moved. */ async bucketsRelocate(bucket: string, req: RelocateBucketRequest): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/relocate`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as GoogleLongrunningOperation; } /** * Restores a soft-deleted bucket. * * @param bucket Name of a bucket. */ async bucketsRestore(bucket: string, opts: BucketsRestoreOptions = {}): Promise { opts = serializeBucketsRestoreOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/restore`); if (opts.generation !== undefined) { url.searchParams.append("generation", String(opts.generation)); } if (opts.projection !== undefined) { url.searchParams.append("projection", String(opts.projection)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "POST", }); return deserializeBucket(data); } /** * Updates an IAM policy for the specified bucket. * * @param bucket Name of a bucket. */ async bucketsSetIamPolicy(bucket: string, req: Policy, opts: BucketsSetIamPolicyOptions = {}): Promise { req = serializePolicy(req); const url = new URL(`${this.#baseUrl}b/${ bucket }/iam`); if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PUT", body, }); return deserializePolicy(data); } /** * Tests a set of permissions on the given bucket to see which, if any, are * held by the caller. * * @param bucket Name of a bucket. */ async bucketsTestIamPermissions(bucket: string, opts: BucketsTestIamPermissionsOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/iam/testPermissions`); if (opts.permissions !== undefined) { url.searchParams.append("permissions", String(opts.permissions)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as TestIamPermissionsResponse; } /** * Updates a bucket. Changes to the bucket will be readable immediately after * writing, but configuration changes may take time to propagate. * * @param bucket Name of a bucket. */ async bucketsUpdate(bucket: string, req: Bucket, opts: BucketsUpdateOptions = {}): Promise { req = serializeBucket(req); opts = serializeBucketsUpdateOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }`); if (opts.ifMetagenerationMatch !== undefined) { url.searchParams.append("ifMetagenerationMatch", String(opts.ifMetagenerationMatch)); } if (opts.ifMetagenerationNotMatch !== undefined) { url.searchParams.append("ifMetagenerationNotMatch", String(opts.ifMetagenerationNotMatch)); } if (opts.predefinedAcl !== undefined) { url.searchParams.append("predefinedAcl", String(opts.predefinedAcl)); } if (opts.predefinedDefaultObjectAcl !== undefined) { url.searchParams.append("predefinedDefaultObjectAcl", String(opts.predefinedDefaultObjectAcl)); } if (opts.projection !== undefined) { url.searchParams.append("projection", String(opts.projection)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PUT", body, }); return deserializeBucket(data); } /** * Stop watching resources through this channel * */ async channelsStop(req: Channel): Promise { req = serializeChannel(req); const url = new URL(`${this.#baseUrl}channels/stop`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); } /** * Permanently deletes the default object ACL entry for the specified entity * on the specified bucket. * * @param bucket Name of a bucket. * @param entity The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers. */ async defaultObjectAccessControlsDelete(bucket: string, entity: string, opts: DefaultObjectAccessControlsDeleteOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/defaultObjectAcl/${ entity }`); if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "DELETE", }); } /** * Returns the default object ACL entry for the specified entity on the * specified bucket. * * @param bucket Name of a bucket. * @param entity The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers. */ async defaultObjectAccessControlsGet(bucket: string, entity: string, opts: DefaultObjectAccessControlsGetOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/defaultObjectAcl/${ entity }`); if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeObjectAccessControl(data); } /** * Creates a new default object ACL entry on the specified bucket. * * @param bucket Name of a bucket. */ async defaultObjectAccessControlsInsert(bucket: string, req: ObjectAccessControl, opts: DefaultObjectAccessControlsInsertOptions = {}): Promise { req = serializeObjectAccessControl(req); const url = new URL(`${this.#baseUrl}b/${ bucket }/defaultObjectAcl`); if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeObjectAccessControl(data); } /** * Retrieves default object ACL entries on the specified bucket. * * @param bucket Name of a bucket. */ async defaultObjectAccessControlsList(bucket: string, opts: DefaultObjectAccessControlsListOptions = {}): Promise { opts = serializeDefaultObjectAccessControlsListOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/defaultObjectAcl`); if (opts.ifMetagenerationMatch !== undefined) { url.searchParams.append("ifMetagenerationMatch", String(opts.ifMetagenerationMatch)); } if (opts.ifMetagenerationNotMatch !== undefined) { url.searchParams.append("ifMetagenerationNotMatch", String(opts.ifMetagenerationNotMatch)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeObjectAccessControls(data); } /** * Patches a default object ACL entry on the specified bucket. * * @param bucket Name of a bucket. * @param entity The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers. */ async defaultObjectAccessControlsPatch(bucket: string, entity: string, req: ObjectAccessControl, opts: DefaultObjectAccessControlsPatchOptions = {}): Promise { req = serializeObjectAccessControl(req); const url = new URL(`${this.#baseUrl}b/${ bucket }/defaultObjectAcl/${ entity }`); if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PATCH", body, }); return deserializeObjectAccessControl(data); } /** * Updates a default object ACL entry on the specified bucket. * * @param bucket Name of a bucket. * @param entity The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers. */ async defaultObjectAccessControlsUpdate(bucket: string, entity: string, req: ObjectAccessControl, opts: DefaultObjectAccessControlsUpdateOptions = {}): Promise { req = serializeObjectAccessControl(req); const url = new URL(`${this.#baseUrl}b/${ bucket }/defaultObjectAcl/${ entity }`); if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PUT", body, }); return deserializeObjectAccessControl(data); } /** * Permanently deletes a folder. Only applicable to buckets with hierarchical * namespace enabled. * * @param bucket Name of the bucket in which the folder resides. * @param folder Name of a folder. */ async foldersDelete(bucket: string, folder: string, opts: FoldersDeleteOptions = {}): Promise { opts = serializeFoldersDeleteOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/folders/${ folder }`); if (opts.ifMetagenerationMatch !== undefined) { url.searchParams.append("ifMetagenerationMatch", String(opts.ifMetagenerationMatch)); } if (opts.ifMetagenerationNotMatch !== undefined) { url.searchParams.append("ifMetagenerationNotMatch", String(opts.ifMetagenerationNotMatch)); } const data = await request(url.href, { client: this.#client, method: "DELETE", }); } /** * Returns metadata for the specified folder. Only applicable to buckets with * hierarchical namespace enabled. * * @param bucket Name of the bucket in which the folder resides. * @param folder Name of a folder. */ async foldersGet(bucket: string, folder: string, opts: FoldersGetOptions = {}): Promise { opts = serializeFoldersGetOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/folders/${ folder }`); if (opts.ifMetagenerationMatch !== undefined) { url.searchParams.append("ifMetagenerationMatch", String(opts.ifMetagenerationMatch)); } if (opts.ifMetagenerationNotMatch !== undefined) { url.searchParams.append("ifMetagenerationNotMatch", String(opts.ifMetagenerationNotMatch)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeFolder(data); } /** * Creates a new folder. Only applicable to buckets with hierarchical * namespace enabled. * * @param bucket Name of the bucket in which the folder resides. */ async foldersInsert(bucket: string, req: Folder, opts: FoldersInsertOptions = {}): Promise { req = serializeFolder(req); const url = new URL(`${this.#baseUrl}b/${ bucket }/folders`); if (opts.recursive !== undefined) { url.searchParams.append("recursive", String(opts.recursive)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeFolder(data); } /** * Retrieves a list of folders matching the criteria. Only applicable to * buckets with hierarchical namespace enabled. * * @param bucket Name of the bucket in which to look for folders. */ async foldersList(bucket: string, opts: FoldersListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/folders`); if (opts.delimiter !== undefined) { url.searchParams.append("delimiter", String(opts.delimiter)); } if (opts.endOffset !== undefined) { url.searchParams.append("endOffset", String(opts.endOffset)); } if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } if (opts.prefix !== undefined) { url.searchParams.append("prefix", String(opts.prefix)); } if (opts.startOffset !== undefined) { url.searchParams.append("startOffset", String(opts.startOffset)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeFolders(data); } /** * Renames a source folder to a destination folder. Only applicable to * buckets with hierarchical namespace enabled. * * @param bucket Name of the bucket in which the folders are in. * @param destinationFolder Name of the destination folder. * @param sourceFolder Name of the source folder. */ async foldersRename(bucket: string, destinationFolder: string, sourceFolder: string, opts: FoldersRenameOptions = {}): Promise { opts = serializeFoldersRenameOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/folders/${ sourceFolder }/renameTo/folders/${ destinationFolder }`); if (opts.ifSourceMetagenerationMatch !== undefined) { url.searchParams.append("ifSourceMetagenerationMatch", String(opts.ifSourceMetagenerationMatch)); } if (opts.ifSourceMetagenerationNotMatch !== undefined) { url.searchParams.append("ifSourceMetagenerationNotMatch", String(opts.ifSourceMetagenerationNotMatch)); } const data = await request(url.href, { client: this.#client, method: "POST", }); return data as GoogleLongrunningOperation; } /** * Permanently deletes a managed folder. * * @param bucket Name of the bucket containing the managed folder. * @param managedFolder The managed folder name/path. */ async managedFoldersDelete(bucket: string, managedFolder: string, opts: ManagedFoldersDeleteOptions = {}): Promise { opts = serializeManagedFoldersDeleteOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/managedFolders/${ managedFolder }`); if (opts.allowNonEmpty !== undefined) { url.searchParams.append("allowNonEmpty", String(opts.allowNonEmpty)); } if (opts.ifMetagenerationMatch !== undefined) { url.searchParams.append("ifMetagenerationMatch", String(opts.ifMetagenerationMatch)); } if (opts.ifMetagenerationNotMatch !== undefined) { url.searchParams.append("ifMetagenerationNotMatch", String(opts.ifMetagenerationNotMatch)); } const data = await request(url.href, { client: this.#client, method: "DELETE", }); } /** * Returns metadata of the specified managed folder. * * @param bucket Name of the bucket containing the managed folder. * @param managedFolder The managed folder name/path. */ async managedFoldersGet(bucket: string, managedFolder: string, opts: ManagedFoldersGetOptions = {}): Promise { opts = serializeManagedFoldersGetOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/managedFolders/${ managedFolder }`); if (opts.ifMetagenerationMatch !== undefined) { url.searchParams.append("ifMetagenerationMatch", String(opts.ifMetagenerationMatch)); } if (opts.ifMetagenerationNotMatch !== undefined) { url.searchParams.append("ifMetagenerationNotMatch", String(opts.ifMetagenerationNotMatch)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeManagedFolder(data); } /** * Returns an IAM policy for the specified managed folder. * * @param bucket Name of the bucket containing the managed folder. * @param managedFolder The managed folder name/path. */ async managedFoldersGetIamPolicy(bucket: string, managedFolder: string, opts: ManagedFoldersGetIamPolicyOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/managedFolders/${ managedFolder }/iam`); if (opts.optionsRequestedPolicyVersion !== undefined) { url.searchParams.append("optionsRequestedPolicyVersion", String(opts.optionsRequestedPolicyVersion)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializePolicy(data); } /** * Creates a new managed folder. * * @param bucket Name of the bucket containing the managed folder. */ async managedFoldersInsert(bucket: string, req: ManagedFolder): Promise { req = serializeManagedFolder(req); const url = new URL(`${this.#baseUrl}b/${ bucket }/managedFolders`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeManagedFolder(data); } /** * Lists managed folders in the given bucket. * * @param bucket Name of the bucket containing the managed folder. */ async managedFoldersList(bucket: string, opts: ManagedFoldersListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/managedFolders`); if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } if (opts.prefix !== undefined) { url.searchParams.append("prefix", String(opts.prefix)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeManagedFolders(data); } /** * Updates an IAM policy for the specified managed folder. * * @param bucket Name of the bucket containing the managed folder. * @param managedFolder The managed folder name/path. */ async managedFoldersSetIamPolicy(bucket: string, managedFolder: string, req: Policy, opts: ManagedFoldersSetIamPolicyOptions = {}): Promise { req = serializePolicy(req); const url = new URL(`${this.#baseUrl}b/${ bucket }/managedFolders/${ managedFolder }/iam`); if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PUT", body, }); return deserializePolicy(data); } /** * Tests a set of permissions on the given managed folder to see which, if * any, are held by the caller. * * @param bucket Name of the bucket containing the managed folder. * @param managedFolder The managed folder name/path. */ async managedFoldersTestIamPermissions(bucket: string, managedFolder: string, opts: ManagedFoldersTestIamPermissionsOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/managedFolders/${ managedFolder }/iam/testPermissions`); if (opts.permissions !== undefined) { url.searchParams.append("permissions", String(opts.permissions)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as TestIamPermissionsResponse; } /** * Permanently deletes a notification subscription. * * @param bucket The parent bucket of the notification. * @param notification ID of the notification to delete. */ async notificationsDelete(bucket: string, notification: string, opts: NotificationsDeleteOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/notificationConfigs/${ notification }`); if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "DELETE", }); } /** * View a notification configuration. * * @param bucket The parent bucket of the notification. * @param notification Notification ID */ async notificationsGet(bucket: string, notification: string, opts: NotificationsGetOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/notificationConfigs/${ notification }`); if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as Notification; } /** * Creates a notification subscription for a given bucket. * * @param bucket The parent bucket of the notification. */ async notificationsInsert(bucket: string, req: Notification, opts: NotificationsInsertOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/notificationConfigs`); if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as Notification; } /** * Retrieves a list of notification subscriptions for a given bucket. * * @param bucket Name of a Google Cloud Storage bucket. */ async notificationsList(bucket: string, opts: NotificationsListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/notificationConfigs`); if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as Notifications; } /** * Permanently deletes the ACL entry for the specified entity on the * specified object. * * @param bucket Name of a bucket. * @param entity The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers. * @param object Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding). */ async objectAccessControlsDelete(bucket: string, entity: string, object: string, opts: ObjectAccessControlsDeleteOptions = {}): Promise { opts = serializeObjectAccessControlsDeleteOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/o/${ object }/acl/${ entity }`); if (opts.generation !== undefined) { url.searchParams.append("generation", String(opts.generation)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "DELETE", }); } /** * Returns the ACL entry for the specified entity on the specified object. * * @param bucket Name of a bucket. * @param entity The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers. * @param object Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding). */ async objectAccessControlsGet(bucket: string, entity: string, object: string, opts: ObjectAccessControlsGetOptions = {}): Promise { opts = serializeObjectAccessControlsGetOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/o/${ object }/acl/${ entity }`); if (opts.generation !== undefined) { url.searchParams.append("generation", String(opts.generation)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeObjectAccessControl(data); } /** * Creates a new ACL entry on the specified object. * * @param bucket Name of a bucket. * @param object Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding). */ async objectAccessControlsInsert(bucket: string, object: string, req: ObjectAccessControl, opts: ObjectAccessControlsInsertOptions = {}): Promise { req = serializeObjectAccessControl(req); opts = serializeObjectAccessControlsInsertOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/o/${ object }/acl`); if (opts.generation !== undefined) { url.searchParams.append("generation", String(opts.generation)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeObjectAccessControl(data); } /** * Retrieves ACL entries on the specified object. * * @param bucket Name of a bucket. * @param object Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding). */ async objectAccessControlsList(bucket: string, object: string, opts: ObjectAccessControlsListOptions = {}): Promise { opts = serializeObjectAccessControlsListOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/o/${ object }/acl`); if (opts.generation !== undefined) { url.searchParams.append("generation", String(opts.generation)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeObjectAccessControls(data); } /** * Patches an ACL entry on the specified object. * * @param bucket Name of a bucket. * @param entity The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers. * @param object Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding). */ async objectAccessControlsPatch(bucket: string, entity: string, object: string, req: ObjectAccessControl, opts: ObjectAccessControlsPatchOptions = {}): Promise { req = serializeObjectAccessControl(req); opts = serializeObjectAccessControlsPatchOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/o/${ object }/acl/${ entity }`); if (opts.generation !== undefined) { url.searchParams.append("generation", String(opts.generation)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PATCH", body, }); return deserializeObjectAccessControl(data); } /** * Updates an ACL entry on the specified object. * * @param bucket Name of a bucket. * @param entity The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers. * @param object Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding). */ async objectAccessControlsUpdate(bucket: string, entity: string, object: string, req: ObjectAccessControl, opts: ObjectAccessControlsUpdateOptions = {}): Promise { req = serializeObjectAccessControl(req); opts = serializeObjectAccessControlsUpdateOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/o/${ object }/acl/${ entity }`); if (opts.generation !== undefined) { url.searchParams.append("generation", String(opts.generation)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PUT", body, }); return deserializeObjectAccessControl(data); } /** * Initiates a long-running bulk restore operation on the specified bucket. * * @param bucket Name of the bucket in which the object resides. */ async objectsBulkRestore(bucket: string, req: BulkRestoreObjectsRequest): Promise { req = serializeBulkRestoreObjectsRequest(req); const url = new URL(`${this.#baseUrl}b/${ bucket }/o/bulkRestore`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as GoogleLongrunningOperation; } /** * Concatenates a list of existing objects into a new object in the same * bucket. * * @param destinationBucket Name of the bucket containing the source objects. The destination object is stored in this bucket. * @param destinationObject Name of the new object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding). */ async objectsCompose(destinationBucket: string, destinationObject: string, req: ComposeRequest, opts: ObjectsComposeOptions = {}): Promise { req = serializeComposeRequest(req); opts = serializeObjectsComposeOptions(opts); const url = new URL(`${this.#baseUrl}b/${ destinationBucket }/o/${ destinationObject }/compose`); if (opts.destinationPredefinedAcl !== undefined) { url.searchParams.append("destinationPredefinedAcl", String(opts.destinationPredefinedAcl)); } if (opts.ifGenerationMatch !== undefined) { url.searchParams.append("ifGenerationMatch", String(opts.ifGenerationMatch)); } if (opts.ifMetagenerationMatch !== undefined) { url.searchParams.append("ifMetagenerationMatch", String(opts.ifMetagenerationMatch)); } if (opts.kmsKeyName !== undefined) { url.searchParams.append("kmsKeyName", String(opts.kmsKeyName)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeObject(data); } /** * Copies a source object to a destination object. Optionally overrides * metadata. * * @param destinationBucket Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding). * @param destinationObject Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any. * @param sourceBucket Name of the bucket in which to find the source object. * @param sourceObject Name of the source object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding). */ async objectsCopy(destinationBucket: string, destinationObject: string, sourceBucket: string, sourceObject: string, req: Object, opts: ObjectsCopyOptions = {}): Promise { req = serializeObject(req); opts = serializeObjectsCopyOptions(opts); const url = new URL(`${this.#baseUrl}b/${ sourceBucket }/o/${ sourceObject }/copyTo/b/${ destinationBucket }/o/${ destinationObject }`); if (opts.destinationKmsKeyName !== undefined) { url.searchParams.append("destinationKmsKeyName", String(opts.destinationKmsKeyName)); } if (opts.destinationPredefinedAcl !== undefined) { url.searchParams.append("destinationPredefinedAcl", String(opts.destinationPredefinedAcl)); } if (opts.ifGenerationMatch !== undefined) { url.searchParams.append("ifGenerationMatch", String(opts.ifGenerationMatch)); } if (opts.ifGenerationNotMatch !== undefined) { url.searchParams.append("ifGenerationNotMatch", String(opts.ifGenerationNotMatch)); } if (opts.ifMetagenerationMatch !== undefined) { url.searchParams.append("ifMetagenerationMatch", String(opts.ifMetagenerationMatch)); } if (opts.ifMetagenerationNotMatch !== undefined) { url.searchParams.append("ifMetagenerationNotMatch", String(opts.ifMetagenerationNotMatch)); } if (opts.ifSourceGenerationMatch !== undefined) { url.searchParams.append("ifSourceGenerationMatch", String(opts.ifSourceGenerationMatch)); } if (opts.ifSourceGenerationNotMatch !== undefined) { url.searchParams.append("ifSourceGenerationNotMatch", String(opts.ifSourceGenerationNotMatch)); } if (opts.ifSourceMetagenerationMatch !== undefined) { url.searchParams.append("ifSourceMetagenerationMatch", String(opts.ifSourceMetagenerationMatch)); } if (opts.ifSourceMetagenerationNotMatch !== undefined) { url.searchParams.append("ifSourceMetagenerationNotMatch", String(opts.ifSourceMetagenerationNotMatch)); } if (opts.projection !== undefined) { url.searchParams.append("projection", String(opts.projection)); } if (opts.sourceGeneration !== undefined) { url.searchParams.append("sourceGeneration", String(opts.sourceGeneration)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeObject(data); } /** * Deletes an object and its metadata. Deletions are permanent if versioning * is not enabled for the bucket, or if the generation parameter is used. * * @param bucket Name of the bucket in which the object resides. * @param object Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding). */ async objectsDelete(bucket: string, object: string, opts: ObjectsDeleteOptions = {}): Promise { opts = serializeObjectsDeleteOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/o/${ object }`); if (opts.generation !== undefined) { url.searchParams.append("generation", String(opts.generation)); } if (opts.ifGenerationMatch !== undefined) { url.searchParams.append("ifGenerationMatch", String(opts.ifGenerationMatch)); } if (opts.ifGenerationNotMatch !== undefined) { url.searchParams.append("ifGenerationNotMatch", String(opts.ifGenerationNotMatch)); } if (opts.ifMetagenerationMatch !== undefined) { url.searchParams.append("ifMetagenerationMatch", String(opts.ifMetagenerationMatch)); } if (opts.ifMetagenerationNotMatch !== undefined) { url.searchParams.append("ifMetagenerationNotMatch", String(opts.ifMetagenerationNotMatch)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "DELETE", }); } /** * Retrieves an object or its metadata. * * @param bucket Name of the bucket in which the object resides. * @param object Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding). */ async objectsGet(bucket: string, object: string, opts: ObjectsGetOptions = {}): Promise { opts = serializeObjectsGetOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/o/${ object }`); if (opts.generation !== undefined) { url.searchParams.append("generation", String(opts.generation)); } if (opts.ifGenerationMatch !== undefined) { url.searchParams.append("ifGenerationMatch", String(opts.ifGenerationMatch)); } if (opts.ifGenerationNotMatch !== undefined) { url.searchParams.append("ifGenerationNotMatch", String(opts.ifGenerationNotMatch)); } if (opts.ifMetagenerationMatch !== undefined) { url.searchParams.append("ifMetagenerationMatch", String(opts.ifMetagenerationMatch)); } if (opts.ifMetagenerationNotMatch !== undefined) { url.searchParams.append("ifMetagenerationNotMatch", String(opts.ifMetagenerationNotMatch)); } if (opts.projection !== undefined) { url.searchParams.append("projection", String(opts.projection)); } if (opts.restoreToken !== undefined) { url.searchParams.append("restoreToken", String(opts.restoreToken)); } if (opts.softDeleted !== undefined) { url.searchParams.append("softDeleted", String(opts.softDeleted)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeObject(data); } /** * Returns an IAM policy for the specified object. * * @param bucket Name of the bucket in which the object resides. * @param object Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding). */ async objectsGetIamPolicy(bucket: string, object: string, opts: ObjectsGetIamPolicyOptions = {}): Promise { opts = serializeObjectsGetIamPolicyOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/o/${ object }/iam`); if (opts.generation !== undefined) { url.searchParams.append("generation", String(opts.generation)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializePolicy(data); } /** * Stores a new object and metadata. * * @param bucket Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any. */ async objectsInsert(bucket: string, req: Object, opts: ObjectsInsertOptions = {}): Promise { req = serializeObject(req); opts = serializeObjectsInsertOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/o`); if (opts.contentEncoding !== undefined) { url.searchParams.append("contentEncoding", String(opts.contentEncoding)); } if (opts.ifGenerationMatch !== undefined) { url.searchParams.append("ifGenerationMatch", String(opts.ifGenerationMatch)); } if (opts.ifGenerationNotMatch !== undefined) { url.searchParams.append("ifGenerationNotMatch", String(opts.ifGenerationNotMatch)); } if (opts.ifMetagenerationMatch !== undefined) { url.searchParams.append("ifMetagenerationMatch", String(opts.ifMetagenerationMatch)); } if (opts.ifMetagenerationNotMatch !== undefined) { url.searchParams.append("ifMetagenerationNotMatch", String(opts.ifMetagenerationNotMatch)); } if (opts.kmsKeyName !== undefined) { url.searchParams.append("kmsKeyName", String(opts.kmsKeyName)); } if (opts.name !== undefined) { url.searchParams.append("name", String(opts.name)); } if (opts.predefinedAcl !== undefined) { url.searchParams.append("predefinedAcl", String(opts.predefinedAcl)); } if (opts.projection !== undefined) { url.searchParams.append("projection", String(opts.projection)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeObject(data); } /** * Retrieves a list of objects matching the criteria. * * @param bucket Name of the bucket in which to look for objects. */ async objectsList(bucket: string, opts: ObjectsListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/o`); if (opts.delimiter !== undefined) { url.searchParams.append("delimiter", String(opts.delimiter)); } if (opts.endOffset !== undefined) { url.searchParams.append("endOffset", String(opts.endOffset)); } if (opts.includeFoldersAsPrefixes !== undefined) { url.searchParams.append("includeFoldersAsPrefixes", String(opts.includeFoldersAsPrefixes)); } if (opts.includeTrailingDelimiter !== undefined) { url.searchParams.append("includeTrailingDelimiter", String(opts.includeTrailingDelimiter)); } if (opts.matchGlob !== undefined) { url.searchParams.append("matchGlob", String(opts.matchGlob)); } if (opts.maxResults !== undefined) { url.searchParams.append("maxResults", String(opts.maxResults)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } if (opts.prefix !== undefined) { url.searchParams.append("prefix", String(opts.prefix)); } if (opts.projection !== undefined) { url.searchParams.append("projection", String(opts.projection)); } if (opts.softDeleted !== undefined) { url.searchParams.append("softDeleted", String(opts.softDeleted)); } if (opts.startOffset !== undefined) { url.searchParams.append("startOffset", String(opts.startOffset)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } if (opts.versions !== undefined) { url.searchParams.append("versions", String(opts.versions)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeObjects(data); } /** * Patches an object's metadata. * * @param bucket Name of the bucket in which the object resides. * @param object Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding). */ async objectsPatch(bucket: string, object: string, req: Object, opts: ObjectsPatchOptions = {}): Promise { req = serializeObject(req); opts = serializeObjectsPatchOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/o/${ object }`); if (opts.generation !== undefined) { url.searchParams.append("generation", String(opts.generation)); } if (opts.ifGenerationMatch !== undefined) { url.searchParams.append("ifGenerationMatch", String(opts.ifGenerationMatch)); } if (opts.ifGenerationNotMatch !== undefined) { url.searchParams.append("ifGenerationNotMatch", String(opts.ifGenerationNotMatch)); } if (opts.ifMetagenerationMatch !== undefined) { url.searchParams.append("ifMetagenerationMatch", String(opts.ifMetagenerationMatch)); } if (opts.ifMetagenerationNotMatch !== undefined) { url.searchParams.append("ifMetagenerationNotMatch", String(opts.ifMetagenerationNotMatch)); } if (opts.overrideUnlockedRetention !== undefined) { url.searchParams.append("overrideUnlockedRetention", String(opts.overrideUnlockedRetention)); } if (opts.predefinedAcl !== undefined) { url.searchParams.append("predefinedAcl", String(opts.predefinedAcl)); } if (opts.projection !== undefined) { url.searchParams.append("projection", String(opts.projection)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PATCH", body, }); return deserializeObject(data); } /** * Restores a soft-deleted object. * * @param bucket Name of the bucket in which the object resides. * @param object Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding). */ async objectsRestore(bucket: string, object: string, opts: ObjectsRestoreOptions = {}): Promise { opts = serializeObjectsRestoreOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/o/${ object }/restore`); if (opts.copySourceAcl !== undefined) { url.searchParams.append("copySourceAcl", String(opts.copySourceAcl)); } if (opts.generation !== undefined) { url.searchParams.append("generation", String(opts.generation)); } if (opts.ifGenerationMatch !== undefined) { url.searchParams.append("ifGenerationMatch", String(opts.ifGenerationMatch)); } if (opts.ifGenerationNotMatch !== undefined) { url.searchParams.append("ifGenerationNotMatch", String(opts.ifGenerationNotMatch)); } if (opts.ifMetagenerationMatch !== undefined) { url.searchParams.append("ifMetagenerationMatch", String(opts.ifMetagenerationMatch)); } if (opts.ifMetagenerationNotMatch !== undefined) { url.searchParams.append("ifMetagenerationNotMatch", String(opts.ifMetagenerationNotMatch)); } if (opts.projection !== undefined) { url.searchParams.append("projection", String(opts.projection)); } if (opts.restoreToken !== undefined) { url.searchParams.append("restoreToken", String(opts.restoreToken)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "POST", }); return deserializeObject(data); } /** * Rewrites a source object to a destination object. Optionally overrides * metadata. * * @param destinationBucket Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any. * @param destinationObject Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding). * @param sourceBucket Name of the bucket in which to find the source object. * @param sourceObject Name of the source object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding). */ async objectsRewrite(destinationBucket: string, destinationObject: string, sourceBucket: string, sourceObject: string, req: Object, opts: ObjectsRewriteOptions = {}): Promise { req = serializeObject(req); opts = serializeObjectsRewriteOptions(opts); const url = new URL(`${this.#baseUrl}b/${ sourceBucket }/o/${ sourceObject }/rewriteTo/b/${ destinationBucket }/o/${ destinationObject }`); if (opts.destinationKmsKeyName !== undefined) { url.searchParams.append("destinationKmsKeyName", String(opts.destinationKmsKeyName)); } if (opts.destinationPredefinedAcl !== undefined) { url.searchParams.append("destinationPredefinedAcl", String(opts.destinationPredefinedAcl)); } if (opts.ifGenerationMatch !== undefined) { url.searchParams.append("ifGenerationMatch", String(opts.ifGenerationMatch)); } if (opts.ifGenerationNotMatch !== undefined) { url.searchParams.append("ifGenerationNotMatch", String(opts.ifGenerationNotMatch)); } if (opts.ifMetagenerationMatch !== undefined) { url.searchParams.append("ifMetagenerationMatch", String(opts.ifMetagenerationMatch)); } if (opts.ifMetagenerationNotMatch !== undefined) { url.searchParams.append("ifMetagenerationNotMatch", String(opts.ifMetagenerationNotMatch)); } if (opts.ifSourceGenerationMatch !== undefined) { url.searchParams.append("ifSourceGenerationMatch", String(opts.ifSourceGenerationMatch)); } if (opts.ifSourceGenerationNotMatch !== undefined) { url.searchParams.append("ifSourceGenerationNotMatch", String(opts.ifSourceGenerationNotMatch)); } if (opts.ifSourceMetagenerationMatch !== undefined) { url.searchParams.append("ifSourceMetagenerationMatch", String(opts.ifSourceMetagenerationMatch)); } if (opts.ifSourceMetagenerationNotMatch !== undefined) { url.searchParams.append("ifSourceMetagenerationNotMatch", String(opts.ifSourceMetagenerationNotMatch)); } if (opts.maxBytesRewrittenPerCall !== undefined) { url.searchParams.append("maxBytesRewrittenPerCall", String(opts.maxBytesRewrittenPerCall)); } if (opts.projection !== undefined) { url.searchParams.append("projection", String(opts.projection)); } if (opts.rewriteToken !== undefined) { url.searchParams.append("rewriteToken", String(opts.rewriteToken)); } if (opts.sourceGeneration !== undefined) { url.searchParams.append("sourceGeneration", String(opts.sourceGeneration)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeRewriteResponse(data); } /** * Updates an IAM policy for the specified object. * * @param bucket Name of the bucket in which the object resides. * @param object Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding). */ async objectsSetIamPolicy(bucket: string, object: string, req: Policy, opts: ObjectsSetIamPolicyOptions = {}): Promise { req = serializePolicy(req); opts = serializeObjectsSetIamPolicyOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/o/${ object }/iam`); if (opts.generation !== undefined) { url.searchParams.append("generation", String(opts.generation)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PUT", body, }); return deserializePolicy(data); } /** * Tests a set of permissions on the given object to see which, if any, are * held by the caller. * * @param bucket Name of the bucket in which the object resides. * @param object Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding). */ async objectsTestIamPermissions(bucket: string, object: string, opts: ObjectsTestIamPermissionsOptions = {}): Promise { opts = serializeObjectsTestIamPermissionsOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/o/${ object }/iam/testPermissions`); if (opts.generation !== undefined) { url.searchParams.append("generation", String(opts.generation)); } if (opts.permissions !== undefined) { url.searchParams.append("permissions", String(opts.permissions)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as TestIamPermissionsResponse; } /** * Updates an object's metadata. * * @param bucket Name of the bucket in which the object resides. * @param object Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding). */ async objectsUpdate(bucket: string, object: string, req: Object, opts: ObjectsUpdateOptions = {}): Promise { req = serializeObject(req); opts = serializeObjectsUpdateOptions(opts); const url = new URL(`${this.#baseUrl}b/${ bucket }/o/${ object }`); if (opts.generation !== undefined) { url.searchParams.append("generation", String(opts.generation)); } if (opts.ifGenerationMatch !== undefined) { url.searchParams.append("ifGenerationMatch", String(opts.ifGenerationMatch)); } if (opts.ifGenerationNotMatch !== undefined) { url.searchParams.append("ifGenerationNotMatch", String(opts.ifGenerationNotMatch)); } if (opts.ifMetagenerationMatch !== undefined) { url.searchParams.append("ifMetagenerationMatch", String(opts.ifMetagenerationMatch)); } if (opts.ifMetagenerationNotMatch !== undefined) { url.searchParams.append("ifMetagenerationNotMatch", String(opts.ifMetagenerationNotMatch)); } if (opts.overrideUnlockedRetention !== undefined) { url.searchParams.append("overrideUnlockedRetention", String(opts.overrideUnlockedRetention)); } if (opts.predefinedAcl !== undefined) { url.searchParams.append("predefinedAcl", String(opts.predefinedAcl)); } if (opts.projection !== undefined) { url.searchParams.append("projection", String(opts.projection)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PUT", body, }); return deserializeObject(data); } /** * Watch for changes on all objects in a bucket. * * @param bucket Name of the bucket in which to look for objects. */ async objectsWatchAll(bucket: string, req: Channel, opts: ObjectsWatchAllOptions = {}): Promise { req = serializeChannel(req); const url = new URL(`${this.#baseUrl}b/${ bucket }/o/watch`); if (opts.delimiter !== undefined) { url.searchParams.append("delimiter", String(opts.delimiter)); } if (opts.endOffset !== undefined) { url.searchParams.append("endOffset", String(opts.endOffset)); } if (opts.includeTrailingDelimiter !== undefined) { url.searchParams.append("includeTrailingDelimiter", String(opts.includeTrailingDelimiter)); } if (opts.maxResults !== undefined) { url.searchParams.append("maxResults", String(opts.maxResults)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } if (opts.prefix !== undefined) { url.searchParams.append("prefix", String(opts.prefix)); } if (opts.projection !== undefined) { url.searchParams.append("projection", String(opts.projection)); } if (opts.startOffset !== undefined) { url.searchParams.append("startOffset", String(opts.startOffset)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } if (opts.versions !== undefined) { url.searchParams.append("versions", String(opts.versions)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeChannel(data); } /** * Starts asynchronous advancement of the relocate bucket operation in the * case of required write downtime, to allow it to lock the bucket at the * source location, and proceed with the bucket location swap. The server * makes a best effort to advance the relocate bucket operation, but success * is not guaranteed. * * @param bucket Name of the bucket to advance the relocate for. * @param operationId ID of the operation resource. */ async operationsAdvanceRelocateBucket(bucket: string, operationId: string, req: AdvanceRelocateBucketOperationRequest): Promise { req = serializeAdvanceRelocateBucketOperationRequest(req); const url = new URL(`${this.#baseUrl}b/${ bucket }/operations/${ operationId }/advanceRelocateBucket`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); } /** * Starts asynchronous cancellation on a long-running operation. The server * makes a best effort to cancel the operation, but success is not guaranteed. * * @param bucket The parent bucket of the operation resource. * @param operationId The ID of the operation resource. */ async operationsCancel(bucket: string, operationId: string): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/operations/${ operationId }/cancel`); const data = await request(url.href, { client: this.#client, method: "POST", }); } /** * Gets the latest state of a long-running operation. * * @param bucket The parent bucket of the operation resource. * @param operationId The ID of the operation resource. */ async operationsGet(bucket: string, operationId: string): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/operations/${ operationId }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return data as GoogleLongrunningOperation; } /** * Lists operations that match the specified filter in the request. * * @param bucket Name of the bucket in which to look for operations. */ async operationsList(bucket: string, opts: OperationsListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}b/${ bucket }/operations`); if (opts.filter !== undefined) { url.searchParams.append("filter", String(opts.filter)); } if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as GoogleLongrunningListOperationsResponse; } /** * Creates a new HMAC key for the specified service account. * * @param projectId Project ID owning the service account. */ async projectsHmacKeysCreate(projectId: string, opts: ProjectsHmacKeysCreateOptions = {}): Promise { const url = new URL(`${this.#baseUrl}projects/${ projectId }/hmacKeys`); if (opts.serviceAccountEmail !== undefined) { url.searchParams.append("serviceAccountEmail", String(opts.serviceAccountEmail)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "POST", }); return deserializeHmacKey(data); } /** * Deletes an HMAC key. * * @param accessId Name of the HMAC key to be deleted. * @param projectId Project ID owning the requested key */ async projectsHmacKeysDelete(accessId: string, projectId: string, opts: ProjectsHmacKeysDeleteOptions = {}): Promise { const url = new URL(`${this.#baseUrl}projects/${ projectId }/hmacKeys/${ accessId }`); if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "DELETE", }); } /** * Retrieves an HMAC key's metadata * * @param accessId Name of the HMAC key. * @param projectId Project ID owning the service account of the requested key. */ async projectsHmacKeysGet(accessId: string, projectId: string, opts: ProjectsHmacKeysGetOptions = {}): Promise { const url = new URL(`${this.#baseUrl}projects/${ projectId }/hmacKeys/${ accessId }`); if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeHmacKeyMetadata(data); } /** * Retrieves a list of HMAC keys matching the criteria. * * @param projectId Name of the project in which to look for HMAC keys. */ async projectsHmacKeysList(projectId: string, opts: ProjectsHmacKeysListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}projects/${ projectId }/hmacKeys`); if (opts.maxResults !== undefined) { url.searchParams.append("maxResults", String(opts.maxResults)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } if (opts.serviceAccountEmail !== undefined) { url.searchParams.append("serviceAccountEmail", String(opts.serviceAccountEmail)); } if (opts.showDeletedKeys !== undefined) { url.searchParams.append("showDeletedKeys", String(opts.showDeletedKeys)); } if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeHmacKeysMetadata(data); } /** * Updates the state of an HMAC key. See the [HMAC Key resource * descriptor](https://cloud.google.com/storage/docs/json_api/v1/projects/hmacKeys/update#request-body) * for valid states. * * @param accessId Name of the HMAC key being updated. * @param projectId Project ID owning the service account of the updated key. */ async projectsHmacKeysUpdate(accessId: string, projectId: string, req: HmacKeyMetadata, opts: ProjectsHmacKeysUpdateOptions = {}): Promise { req = serializeHmacKeyMetadata(req); const url = new URL(`${this.#baseUrl}projects/${ projectId }/hmacKeys/${ accessId }`); if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PUT", body, }); return deserializeHmacKeyMetadata(data); } /** * Get the email address of this project's Google Cloud Storage service * account. * * @param projectId Project ID */ async projectsServiceAccountGet(projectId: string, opts: ProjectsServiceAccountGetOptions = {}): Promise { const url = new URL(`${this.#baseUrl}projects/${ projectId }/serviceAccount`); if (opts.userProject !== undefined) { url.searchParams.append("userProject", String(opts.userProject)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as ServiceAccount; } } /** * An AdvanceRelocateBucketOperation request. */ export interface AdvanceRelocateBucketOperationRequest { /** * Specifies the time when the relocation will revert to the sync stage if * the relocation hasn't succeeded. */ expireTime?: Date; /** * Specifies the duration after which the relocation will revert to the sync * stage if the relocation hasn't succeeded. Optional, if not supplied, a * default value of 12h will be used. */ ttl?: number /* Duration */; } function serializeAdvanceRelocateBucketOperationRequest(data: any): AdvanceRelocateBucketOperationRequest { return { ...data, expireTime: data["expireTime"] !== undefined ? data["expireTime"].toISOString() : undefined, ttl: data["ttl"] !== undefined ? data["ttl"] : undefined, }; } function deserializeAdvanceRelocateBucketOperationRequest(data: any): AdvanceRelocateBucketOperationRequest { return { ...data, expireTime: data["expireTime"] !== undefined ? new Date(data["expireTime"]) : undefined, ttl: data["ttl"] !== undefined ? data["ttl"] : undefined, }; } /** * An Anywhere Cache instance. */ export interface AnywhereCache { /** * The cache-level entry admission policy. */ admissionPolicy?: string; /** * The ID of the Anywhere cache instance. */ anywhereCacheId?: string; /** * The name of the bucket containing this cache instance. */ bucket?: string; /** * The creation time of the cache instance in RFC 3339 format. */ createTime?: Date; /** * The ID of the resource, including the project number, bucket name and * anywhere cache ID. */ id?: string; /** * The kind of item this is. For Anywhere Cache, this is always * storage#anywhereCache. */ kind?: string; /** * True if the cache instance has an active Update long-running operation. */ pendingUpdate?: boolean; /** * The link to this cache instance. */ selfLink?: string; /** * The current state of the cache instance. */ state?: string; /** * The TTL of all cache entries in whole seconds. e.g., "7200s". */ ttl?: number /* Duration */; /** * The modification time of the cache instance metadata in RFC 3339 format. */ updateTime?: Date; /** * The zone in which the cache instance is running. For example, * us-central1-a. */ zone?: string; } function serializeAnywhereCache(data: any): AnywhereCache { return { ...data, createTime: data["createTime"] !== undefined ? data["createTime"].toISOString() : undefined, ttl: data["ttl"] !== undefined ? data["ttl"] : undefined, updateTime: data["updateTime"] !== undefined ? data["updateTime"].toISOString() : undefined, }; } function deserializeAnywhereCache(data: any): AnywhereCache { return { ...data, createTime: data["createTime"] !== undefined ? new Date(data["createTime"]) : undefined, ttl: data["ttl"] !== undefined ? data["ttl"] : undefined, updateTime: data["updateTime"] !== undefined ? new Date(data["updateTime"]) : undefined, }; } /** * A list of Anywhere Caches. */ export interface AnywhereCaches { /** * The list of items. */ items?: AnywhereCache[]; /** * The kind of item this is. For lists of Anywhere Caches, this is always * storage#anywhereCaches. */ kind?: string; /** * The continuation token, used to page through large result sets. Provide * this value in a subsequent request to return the next page of results. */ nextPageToken?: string; } function serializeAnywhereCaches(data: any): AnywhereCaches { return { ...data, items: data["items"] !== undefined ? data["items"].map((item: any) => (serializeAnywhereCache(item))) : undefined, }; } function deserializeAnywhereCaches(data: any): AnywhereCaches { return { ...data, items: data["items"] !== undefined ? data["items"].map((item: any) => (deserializeAnywhereCache(item))) : undefined, }; } /** * Additional options for Storage#anywhereCachesList. */ export interface AnywhereCachesListOptions { /** * Maximum number of items to return in a single page of responses. Maximum * 1000. */ pageSize?: number; /** * A previously-returned page token representing part of the larger set of * results to view. */ pageToken?: string; } /** * A bucket. */ export interface Bucket { /** * Access controls on the bucket. */ acl?: BucketAccessControl[]; /** * The bucket's Autoclass configuration. */ autoclass?: { enabled?: boolean; terminalStorageClass?: string; terminalStorageClassUpdateTime?: Date; toggleTime?: Date; }; /** * The bucket's billing configuration. */ billing?: { requesterPays?: boolean; }; /** * The bucket's Cross-Origin Resource Sharing (CORS) configuration. */ cors?: { maxAgeSeconds?: number; method?: string[]; origin?: string[]; responseHeader?: string[]; }[]; /** * The bucket's custom placement configuration for Custom Dual Regions. */ customPlacementConfig?: { dataLocations?: string[]; }; /** * The default value for event-based hold on newly created objects in this * bucket. Event-based hold is a way to retain objects indefinitely until an * event occurs, signified by the hold's release. After being released, such * objects will be subject to bucket-level retention (if any). One sample use * case of this flag is for banks to hold loan documents for at least 3 years * after loan is paid in full. Here, bucket-level retention is 3 years and the * event is loan being paid in full. In this example, these objects will be * held intact for any number of years until the event has occurred * (event-based hold on the object is released) and then 3 more years after * that. That means retention duration of the objects begins from the moment * event-based hold transitioned from true to false. Objects under event-based * hold cannot be deleted, overwritten or archived until the hold is removed. */ defaultEventBasedHold?: boolean; /** * Default access controls to apply to new objects when no ACL is provided. */ defaultObjectAcl?: ObjectAccessControl[]; /** * Encryption configuration for a bucket. */ encryption?: { defaultKmsKeyName?: string; }; /** * HTTP 1.1 Entity tag for the bucket. */ etag?: string; /** * The generation of this bucket. */ generation?: bigint; /** * The hard delete time of the bucket in RFC 3339 format. */ hardDeleteTime?: Date; /** * The bucket's hierarchical namespace configuration. */ hierarchicalNamespace?: { enabled?: boolean; }; /** * The bucket's IAM configuration. */ iamConfiguration?: { bucketPolicyOnly?: { enabled?: boolean; lockedTime?: Date; }; publicAccessPrevention?: string; uniformBucketLevelAccess?: { enabled?: boolean; lockedTime?: Date; }; }; /** * The ID of the bucket. For buckets, the id and name properties are the * same. */ id?: string; /** * The bucket's IP filter configuration. Specifies the network sources that * are allowed to access the operations on the bucket, as well as its * underlying objects. Only enforced when the mode is set to 'Enabled'. */ ipFilter?: { mode?: string; publicNetworkSource?: { allowedIpCidrRanges?: string[]; }; vpcNetworkSources?: { allowedIpCidrRanges?: string[]; network?: string; }[]; }; /** * The kind of item this is. For buckets, this is always storage#bucket. */ kind?: string; /** * User-provided labels, in key/value pairs. */ labels?: { [key: string]: string }; /** * The bucket's lifecycle configuration. See [Lifecycle * Management](https://cloud.google.com/storage/docs/lifecycle) for more * information. */ lifecycle?: { rule?: { action?: { storageClass?: string; type?: string; }; condition?: { age?: number; createdBefore?: Date; customTimeBefore?: Date; daysSinceCustomTime?: number; daysSinceNoncurrentTime?: number; isLive?: boolean; matchesPattern?: string; matchesPrefix?: string[]; matchesStorageClass?: string[]; matchesSuffix?: string[]; noncurrentTimeBefore?: Date; numNewerVersions?: number; }; }[]; }; /** * The location of the bucket. Object data for objects in the bucket resides * in physical storage within this region. Defaults to US. See the * [Developer's Guide](https://cloud.google.com/storage/docs/locations) for * the authoritative list. */ location?: string; /** * The type of the bucket location. */ locationType?: string; /** * The bucket's logging configuration, which defines the destination bucket * and optional name prefix for the current bucket's logs. */ logging?: { logBucket?: string; logObjectPrefix?: string; }; /** * The metadata generation of this bucket. */ metageneration?: bigint; /** * The name of the bucket. */ name?: string; /** * The bucket's object retention config. */ objectRetention?: { mode?: string; }; /** * The owner of the bucket. This is always the project team's owner group. */ owner?: { entity?: string; entityId?: string; }; /** * The project number of the project the bucket belongs to. */ projectNumber?: bigint; /** * The bucket's retention policy. The retention policy enforces a minimum * retention time for all objects contained in the bucket, based on their * creation time. Any attempt to overwrite or delete objects younger than the * retention period will result in a PERMISSION_DENIED error. An unlocked * retention policy can be modified or removed from the bucket via a * storage.buckets.update operation. A locked retention policy cannot be * removed or shortened in duration for the lifetime of the bucket. Attempting * to remove or decrease period of a locked retention policy will result in a * PERMISSION_DENIED error. */ retentionPolicy?: { effectiveTime?: Date; isLocked?: boolean; retentionPeriod?: bigint; }; /** * The Recovery Point Objective (RPO) of this bucket. Set to ASYNC_TURBO to * turn on Turbo Replication on a bucket. */ rpo?: string; /** * Reserved for future use. */ satisfiesPZI?: boolean; /** * Reserved for future use. */ satisfiesPZS?: boolean; /** * The URI of this bucket. */ selfLink?: string; /** * The bucket's soft delete policy, which defines the period of time that * soft-deleted objects will be retained, and cannot be permanently deleted. */ softDeletePolicy?: { effectiveTime?: Date; retentionDurationSeconds?: bigint; }; /** * The soft delete time of the bucket in RFC 3339 format. */ softDeleteTime?: Date; /** * The bucket's default storage class, used whenever no storageClass is * specified for a newly-created object. This defines how objects in the * bucket are stored and determines the SLA and the cost of storage. Values * include MULTI_REGIONAL, REGIONAL, STANDARD, NEARLINE, COLDLINE, ARCHIVE, * and DURABLE_REDUCED_AVAILABILITY. If this value is not specified when the * bucket is created, it will default to STANDARD. For more information, see * [Storage Classes](https://cloud.google.com/storage/docs/storage-classes). */ storageClass?: string; /** * The creation time of the bucket in RFC 3339 format. */ timeCreated?: Date; /** * The modification time of the bucket in RFC 3339 format. */ updated?: Date; /** * The bucket's versioning configuration. */ versioning?: { enabled?: boolean; }; /** * The bucket's website configuration, controlling how the service behaves * when accessing bucket contents as a web site. See the [Static Website * Examples](https://cloud.google.com/storage/docs/static-website) for more * information. */ website?: { mainPageSuffix?: string; notFoundPage?: string; }; } function serializeBucket(data: any): Bucket { return { ...data, autoclass: data["autoclass"] !== undefined ? { ...data["autoclass"], terminalStorageClassUpdateTime: data["autoclass"]["terminalStorageClassUpdateTime"] !== undefined ? data["autoclass"]["terminalStorageClassUpdateTime"].toISOString() : undefined, toggleTime: data["autoclass"]["toggleTime"] !== undefined ? data["autoclass"]["toggleTime"].toISOString() : undefined, } : undefined, defaultObjectAcl: data["defaultObjectAcl"] !== undefined ? data["defaultObjectAcl"].map((item: any) => (serializeObjectAccessControl(item))) : undefined, generation: data["generation"] !== undefined ? String(data["generation"]) : undefined, hardDeleteTime: data["hardDeleteTime"] !== undefined ? data["hardDeleteTime"].toISOString() : undefined, iamConfiguration: data["iamConfiguration"] !== undefined ? { ...data["iamConfiguration"], bucketPolicyOnly: data["iamConfiguration"]["bucketPolicyOnly"] !== undefined ? { ...data["iamConfiguration"]["bucketPolicyOnly"], lockedTime: data["iamConfiguration"]["bucketPolicyOnly"]["lockedTime"] !== undefined ? data["iamConfiguration"]["bucketPolicyOnly"]["lockedTime"].toISOString() : undefined, } : undefined, uniformBucketLevelAccess: data["iamConfiguration"]["uniformBucketLevelAccess"] !== undefined ? { ...data["iamConfiguration"]["uniformBucketLevelAccess"], lockedTime: data["iamConfiguration"]["uniformBucketLevelAccess"]["lockedTime"] !== undefined ? data["iamConfiguration"]["uniformBucketLevelAccess"]["lockedTime"].toISOString() : undefined, } : undefined, } : undefined, lifecycle: data["lifecycle"] !== undefined ? { ...data["lifecycle"], rule: data["lifecycle"]["rule"] !== undefined ? data["lifecycle"]["rule"].map((item: any) => ({ ...item, condition: item["condition"] !== undefined ? { ...item["condition"], createdBefore: item["condition"]["createdBefore"] !== undefined ? item["condition"]["createdBefore"].toISOString() : undefined, customTimeBefore: item["condition"]["customTimeBefore"] !== undefined ? item["condition"]["customTimeBefore"].toISOString() : undefined, noncurrentTimeBefore: item["condition"]["noncurrentTimeBefore"] !== undefined ? item["condition"]["noncurrentTimeBefore"].toISOString() : undefined, } : undefined, })) : undefined, } : undefined, metageneration: data["metageneration"] !== undefined ? String(data["metageneration"]) : undefined, projectNumber: data["projectNumber"] !== undefined ? String(data["projectNumber"]) : undefined, retentionPolicy: data["retentionPolicy"] !== undefined ? { ...data["retentionPolicy"], effectiveTime: data["retentionPolicy"]["effectiveTime"] !== undefined ? data["retentionPolicy"]["effectiveTime"].toISOString() : undefined, retentionPeriod: data["retentionPolicy"]["retentionPeriod"] !== undefined ? String(data["retentionPolicy"]["retentionPeriod"]) : undefined, } : undefined, softDeletePolicy: data["softDeletePolicy"] !== undefined ? { ...data["softDeletePolicy"], effectiveTime: data["softDeletePolicy"]["effectiveTime"] !== undefined ? data["softDeletePolicy"]["effectiveTime"].toISOString() : undefined, retentionDurationSeconds: data["softDeletePolicy"]["retentionDurationSeconds"] !== undefined ? String(data["softDeletePolicy"]["retentionDurationSeconds"]) : undefined, } : undefined, softDeleteTime: data["softDeleteTime"] !== undefined ? data["softDeleteTime"].toISOString() : undefined, timeCreated: data["timeCreated"] !== undefined ? data["timeCreated"].toISOString() : undefined, updated: data["updated"] !== undefined ? data["updated"].toISOString() : undefined, }; } function deserializeBucket(data: any): Bucket { return { ...data, autoclass: data["autoclass"] !== undefined ? { ...data["autoclass"], terminalStorageClassUpdateTime: data["autoclass"]["terminalStorageClassUpdateTime"] !== undefined ? new Date(data["autoclass"]["terminalStorageClassUpdateTime"]) : undefined, toggleTime: data["autoclass"]["toggleTime"] !== undefined ? new Date(data["autoclass"]["toggleTime"]) : undefined, } : undefined, defaultObjectAcl: data["defaultObjectAcl"] !== undefined ? data["defaultObjectAcl"].map((item: any) => (deserializeObjectAccessControl(item))) : undefined, generation: data["generation"] !== undefined ? BigInt(data["generation"]) : undefined, hardDeleteTime: data["hardDeleteTime"] !== undefined ? new Date(data["hardDeleteTime"]) : undefined, iamConfiguration: data["iamConfiguration"] !== undefined ? { ...data["iamConfiguration"], bucketPolicyOnly: data["iamConfiguration"]["bucketPolicyOnly"] !== undefined ? { ...data["iamConfiguration"]["bucketPolicyOnly"], lockedTime: data["iamConfiguration"]["bucketPolicyOnly"]["lockedTime"] !== undefined ? new Date(data["iamConfiguration"]["bucketPolicyOnly"]["lockedTime"]) : undefined, } : undefined, uniformBucketLevelAccess: data["iamConfiguration"]["uniformBucketLevelAccess"] !== undefined ? { ...data["iamConfiguration"]["uniformBucketLevelAccess"], lockedTime: data["iamConfiguration"]["uniformBucketLevelAccess"]["lockedTime"] !== undefined ? new Date(data["iamConfiguration"]["uniformBucketLevelAccess"]["lockedTime"]) : undefined, } : undefined, } : undefined, lifecycle: data["lifecycle"] !== undefined ? { ...data["lifecycle"], rule: data["lifecycle"]["rule"] !== undefined ? data["lifecycle"]["rule"].map((item: any) => ({ ...item, condition: item["condition"] !== undefined ? { ...item["condition"], createdBefore: item["condition"]["createdBefore"] !== undefined ? new Date(item["condition"]["createdBefore"]) : undefined, customTimeBefore: item["condition"]["customTimeBefore"] !== undefined ? new Date(item["condition"]["customTimeBefore"]) : undefined, noncurrentTimeBefore: item["condition"]["noncurrentTimeBefore"] !== undefined ? new Date(item["condition"]["noncurrentTimeBefore"]) : undefined, } : undefined, })) : undefined, } : undefined, metageneration: data["metageneration"] !== undefined ? BigInt(data["metageneration"]) : undefined, projectNumber: data["projectNumber"] !== undefined ? BigInt(data["projectNumber"]) : undefined, retentionPolicy: data["retentionPolicy"] !== undefined ? { ...data["retentionPolicy"], effectiveTime: data["retentionPolicy"]["effectiveTime"] !== undefined ? new Date(data["retentionPolicy"]["effectiveTime"]) : undefined, retentionPeriod: data["retentionPolicy"]["retentionPeriod"] !== undefined ? BigInt(data["retentionPolicy"]["retentionPeriod"]) : undefined, } : undefined, softDeletePolicy: data["softDeletePolicy"] !== undefined ? { ...data["softDeletePolicy"], effectiveTime: data["softDeletePolicy"]["effectiveTime"] !== undefined ? new Date(data["softDeletePolicy"]["effectiveTime"]) : undefined, retentionDurationSeconds: data["softDeletePolicy"]["retentionDurationSeconds"] !== undefined ? BigInt(data["softDeletePolicy"]["retentionDurationSeconds"]) : undefined, } : undefined, softDeleteTime: data["softDeleteTime"] !== undefined ? new Date(data["softDeleteTime"]) : undefined, timeCreated: data["timeCreated"] !== undefined ? new Date(data["timeCreated"]) : undefined, updated: data["updated"] !== undefined ? new Date(data["updated"]) : undefined, }; } /** * An access-control entry. */ export interface BucketAccessControl { /** * The name of the bucket. */ bucket?: string; /** * The domain associated with the entity, if any. */ domain?: string; /** * The email address associated with the entity, if any. */ email?: string; /** * The entity holding the permission, in one of the following forms: - * user-userId - user-email - group-groupId - group-email - domain-domain - * project-team-projectId - allUsers - allAuthenticatedUsers Examples: - The * user liz@example.com would be user-liz@example.com. - The group * example@googlegroups.com would be group-example@googlegroups.com. - To * refer to all members of the Google Apps for Business domain example.com, * the entity would be domain-example.com. */ entity?: string; /** * The ID for the entity, if any. */ entityId?: string; /** * HTTP 1.1 Entity tag for the access-control entry. */ etag?: string; /** * The ID of the access-control entry. */ id?: string; /** * The kind of item this is. For bucket access control entries, this is * always storage#bucketAccessControl. */ kind?: string; /** * The project team associated with the entity, if any. */ projectTeam?: { projectNumber?: string; team?: string; }; /** * The access permission for the entity. */ role?: string; /** * The link to this access-control entry. */ selfLink?: string; } /** * An access-control list. */ export interface BucketAccessControls { /** * The list of items. */ items?: BucketAccessControl[]; /** * The kind of item this is. For lists of bucket access control entries, this * is always storage#bucketAccessControls. */ kind?: string; } /** * Additional options for Storage#bucketAccessControlsDelete. */ export interface BucketAccessControlsDeleteOptions { /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } /** * Additional options for Storage#bucketAccessControlsGet. */ export interface BucketAccessControlsGetOptions { /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } /** * Additional options for Storage#bucketAccessControlsInsert. */ export interface BucketAccessControlsInsertOptions { /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } /** * Additional options for Storage#bucketAccessControlsList. */ export interface BucketAccessControlsListOptions { /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } /** * Additional options for Storage#bucketAccessControlsPatch. */ export interface BucketAccessControlsPatchOptions { /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } /** * Additional options for Storage#bucketAccessControlsUpdate. */ export interface BucketAccessControlsUpdateOptions { /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } /** * A list of buckets. */ export interface Buckets { /** * The list of items. */ items?: Bucket[]; /** * The kind of item this is. For lists of buckets, this is always * storage#buckets. */ kind?: string; /** * The continuation token, used to page through large result sets. Provide * this value in a subsequent request to return the next page of results. */ nextPageToken?: string; } function serializeBuckets(data: any): Buckets { return { ...data, items: data["items"] !== undefined ? data["items"].map((item: any) => (serializeBucket(item))) : undefined, }; } function deserializeBuckets(data: any): Buckets { return { ...data, items: data["items"] !== undefined ? data["items"].map((item: any) => (deserializeBucket(item))) : undefined, }; } /** * Additional options for Storage#bucketsDelete. */ export interface BucketsDeleteOptions { /** * If set, only deletes the bucket if its metageneration matches this value. */ ifMetagenerationMatch?: bigint; /** * If set, only deletes the bucket if its metageneration does not match this * value. */ ifMetagenerationNotMatch?: bigint; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeBucketsDeleteOptions(data: any): BucketsDeleteOptions { return { ...data, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? String(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? String(data["ifMetagenerationNotMatch"]) : undefined, }; } function deserializeBucketsDeleteOptions(data: any): BucketsDeleteOptions { return { ...data, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? BigInt(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? BigInt(data["ifMetagenerationNotMatch"]) : undefined, }; } /** * Additional options for Storage#bucketsGetIamPolicy. */ export interface BucketsGetIamPolicyOptions { /** * The IAM policy format version to be returned. If the * optionsRequestedPolicyVersion is for an older version that doesn't support * part of the requested IAM policy, the request fails. */ optionsRequestedPolicyVersion?: number; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } /** * Additional options for Storage#bucketsGet. */ export interface BucketsGetOptions { /** * If present, specifies the generation of the bucket. This is required if * softDeleted is true. */ generation?: bigint; /** * Makes the return of the bucket metadata conditional on whether the * bucket's current metageneration matches the given value. */ ifMetagenerationMatch?: bigint; /** * Makes the return of the bucket metadata conditional on whether the * bucket's current metageneration does not match the given value. */ ifMetagenerationNotMatch?: bigint; /** * Set of properties to return. Defaults to noAcl. */ projection?: | "full" | "noAcl"; /** * If true, return the soft-deleted version of this bucket. The default is * false. For more information, see [Soft * Delete](https://cloud.google.com/storage/docs/soft-delete). */ softDeleted?: boolean; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeBucketsGetOptions(data: any): BucketsGetOptions { return { ...data, generation: data["generation"] !== undefined ? String(data["generation"]) : undefined, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? String(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? String(data["ifMetagenerationNotMatch"]) : undefined, }; } function deserializeBucketsGetOptions(data: any): BucketsGetOptions { return { ...data, generation: data["generation"] !== undefined ? BigInt(data["generation"]) : undefined, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? BigInt(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? BigInt(data["ifMetagenerationNotMatch"]) : undefined, }; } /** * Additional options for Storage#bucketsGetStorageLayout. */ export interface BucketsGetStorageLayoutOptions { /** * An optional prefix used for permission check. It is useful when the caller * only has storage.objects.list permission under a specific prefix. */ prefix?: string; } /** * Additional options for Storage#bucketsInsert. */ export interface BucketsInsertOptions { /** * When set to true, object retention is enabled for this bucket. */ enableObjectRetention?: boolean; /** * Apply a predefined set of access controls to this bucket. */ predefinedAcl?: | "authenticatedRead" | "private" | "projectPrivate" | "publicRead" | "publicReadWrite"; /** * Apply a predefined set of default object access controls to this bucket. */ predefinedDefaultObjectAcl?: | "authenticatedRead" | "bucketOwnerFullControl" | "bucketOwnerRead" | "private" | "projectPrivate" | "publicRead"; /** * A valid API project identifier. */ project: string; /** * Set of properties to return. Defaults to noAcl, unless the bucket resource * specifies acl or defaultObjectAcl properties, when it defaults to full. */ projection?: | "full" | "noAcl"; /** * The project to be billed for this request. */ userProject?: string; } /** * Additional options for Storage#bucketsList. */ export interface BucketsListOptions { /** * Maximum number of buckets to return in a single response. The service will * use this parameter or 1,000 items, whichever is smaller. */ maxResults?: number; /** * A previously-returned page token representing part of the larger set of * results to view. */ pageToken?: string; /** * Filter results to buckets whose names begin with this prefix. */ prefix?: string; /** * A valid API project identifier. */ project: string; /** * Set of properties to return. Defaults to noAcl. */ projection?: | "full" | "noAcl"; /** * If true, only soft-deleted bucket versions will be returned. The default * is false. For more information, see [Soft * Delete](https://cloud.google.com/storage/docs/soft-delete). */ softDeleted?: boolean; /** * The project to be billed for this request. */ userProject?: string; } /** * Additional options for Storage#bucketsLockRetentionPolicy. */ export interface BucketsLockRetentionPolicyOptions { /** * Makes the operation conditional on whether bucket's current metageneration * matches the given value. */ ifMetagenerationMatch: bigint; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeBucketsLockRetentionPolicyOptions(data: any): BucketsLockRetentionPolicyOptions { return { ...data, ifMetagenerationMatch: String(data["ifMetagenerationMatch"]), }; } function deserializeBucketsLockRetentionPolicyOptions(data: any): BucketsLockRetentionPolicyOptions { return { ...data, ifMetagenerationMatch: BigInt(data["ifMetagenerationMatch"]), }; } /** * Additional options for Storage#bucketsPatch. */ export interface BucketsPatchOptions { /** * Makes the return of the bucket metadata conditional on whether the * bucket's current metageneration matches the given value. */ ifMetagenerationMatch?: bigint; /** * Makes the return of the bucket metadata conditional on whether the * bucket's current metageneration does not match the given value. */ ifMetagenerationNotMatch?: bigint; /** * Apply a predefined set of access controls to this bucket. */ predefinedAcl?: | "authenticatedRead" | "private" | "projectPrivate" | "publicRead" | "publicReadWrite"; /** * Apply a predefined set of default object access controls to this bucket. */ predefinedDefaultObjectAcl?: | "authenticatedRead" | "bucketOwnerFullControl" | "bucketOwnerRead" | "private" | "projectPrivate" | "publicRead"; /** * Set of properties to return. Defaults to full. */ projection?: | "full" | "noAcl"; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeBucketsPatchOptions(data: any): BucketsPatchOptions { return { ...data, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? String(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? String(data["ifMetagenerationNotMatch"]) : undefined, }; } function deserializeBucketsPatchOptions(data: any): BucketsPatchOptions { return { ...data, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? BigInt(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? BigInt(data["ifMetagenerationNotMatch"]) : undefined, }; } /** * Additional options for Storage#bucketsRestore. */ export interface BucketsRestoreOptions { /** * Generation of a bucket. */ generation: bigint; /** * Set of properties to return. Defaults to full. */ projection?: | "full" | "noAcl"; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeBucketsRestoreOptions(data: any): BucketsRestoreOptions { return { ...data, generation: String(data["generation"]), }; } function deserializeBucketsRestoreOptions(data: any): BucketsRestoreOptions { return { ...data, generation: BigInt(data["generation"]), }; } /** * Additional options for Storage#bucketsSetIamPolicy. */ export interface BucketsSetIamPolicyOptions { /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } /** * Additional options for Storage#bucketsTestIamPermissions. */ export interface BucketsTestIamPermissionsOptions { /** * Permissions to test. */ permissions: string; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } /** * The storage layout configuration of a bucket. */ export interface BucketStorageLayout { /** * The name of the bucket. */ bucket?: string; /** * The bucket's custom placement configuration for Custom Dual Regions. */ customPlacementConfig?: { dataLocations?: string[]; }; /** * The bucket's hierarchical namespace configuration. */ hierarchicalNamespace?: { enabled?: boolean; }; /** * The kind of item this is. For storage layout, this is always * storage#storageLayout. */ kind?: string; /** * The location of the bucket. */ location?: string; /** * The type of the bucket location. */ locationType?: string; } /** * Additional options for Storage#bucketsUpdate. */ export interface BucketsUpdateOptions { /** * Makes the return of the bucket metadata conditional on whether the * bucket's current metageneration matches the given value. */ ifMetagenerationMatch?: bigint; /** * Makes the return of the bucket metadata conditional on whether the * bucket's current metageneration does not match the given value. */ ifMetagenerationNotMatch?: bigint; /** * Apply a predefined set of access controls to this bucket. */ predefinedAcl?: | "authenticatedRead" | "private" | "projectPrivate" | "publicRead" | "publicReadWrite"; /** * Apply a predefined set of default object access controls to this bucket. */ predefinedDefaultObjectAcl?: | "authenticatedRead" | "bucketOwnerFullControl" | "bucketOwnerRead" | "private" | "projectPrivate" | "publicRead"; /** * Set of properties to return. Defaults to full. */ projection?: | "full" | "noAcl"; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeBucketsUpdateOptions(data: any): BucketsUpdateOptions { return { ...data, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? String(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? String(data["ifMetagenerationNotMatch"]) : undefined, }; } function deserializeBucketsUpdateOptions(data: any): BucketsUpdateOptions { return { ...data, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? BigInt(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? BigInt(data["ifMetagenerationNotMatch"]) : undefined, }; } /** * A bulk restore objects request. */ export interface BulkRestoreObjectsRequest { /** * If false (default), the restore will not overwrite live objects with the * same name at the destination. This means some deleted objects may be * skipped. If true, live objects will be overwritten resulting in a * noncurrent object (if versioning is enabled). If versioning is not enabled, * overwriting the object will result in a soft-deleted object. In either * case, if a noncurrent object already exists with the same name, a live * version can be written without issue. */ allowOverwrite?: boolean; /** * If true, copies the source object's ACL; otherwise, uses the bucket's * default object ACL. The default is false. */ copySourceAcl?: boolean; /** * Restores only the objects matching any of the specified glob(s). If this * parameter is not specified, all objects will be restored within the * specified time range. */ matchGlobs?: string[]; /** * Restores only the objects that were soft-deleted after this time. */ softDeletedAfterTime?: Date; /** * Restores only the objects that were soft-deleted before this time. */ softDeletedBeforeTime?: Date; } function serializeBulkRestoreObjectsRequest(data: any): BulkRestoreObjectsRequest { return { ...data, softDeletedAfterTime: data["softDeletedAfterTime"] !== undefined ? data["softDeletedAfterTime"].toISOString() : undefined, softDeletedBeforeTime: data["softDeletedBeforeTime"] !== undefined ? data["softDeletedBeforeTime"].toISOString() : undefined, }; } function deserializeBulkRestoreObjectsRequest(data: any): BulkRestoreObjectsRequest { return { ...data, softDeletedAfterTime: data["softDeletedAfterTime"] !== undefined ? new Date(data["softDeletedAfterTime"]) : undefined, softDeletedBeforeTime: data["softDeletedBeforeTime"] !== undefined ? new Date(data["softDeletedBeforeTime"]) : undefined, }; } /** * An notification channel used to watch for resource changes. */ export interface Channel { /** * The address where notifications are delivered for this channel. */ address?: string; /** * Date and time of notification channel expiration, expressed as a Unix * timestamp, in milliseconds. Optional. */ expiration?: bigint; /** * A UUID or similar unique string that identifies this channel. */ id?: string; /** * Identifies this as a notification channel used to watch for changes to a * resource, which is "api#channel". */ kind?: string; /** * Additional parameters controlling delivery channel behavior. Optional. */ params?: { [key: string]: string }; /** * A Boolean value to indicate whether payload is wanted. Optional. */ payload?: boolean; /** * An opaque ID that identifies the resource being watched on this channel. * Stable across different API versions. */ resourceId?: string; /** * A version-specific identifier for the watched resource. */ resourceUri?: string; /** * An arbitrary string delivered to the target address with each notification * delivered over this channel. Optional. */ token?: string; /** * The type of delivery mechanism used for this channel. */ type?: string; } function serializeChannel(data: any): Channel { return { ...data, expiration: data["expiration"] !== undefined ? String(data["expiration"]) : undefined, }; } function deserializeChannel(data: any): Channel { return { ...data, expiration: data["expiration"] !== undefined ? BigInt(data["expiration"]) : undefined, }; } /** * A Compose request. */ export interface ComposeRequest { /** * Properties of the resulting object. */ destination?: Object; /** * The kind of item this is. */ kind?: string; /** * The list of source objects that will be concatenated into a single object. */ sourceObjects?: { generation?: bigint; name?: string; objectPreconditions?: { ifGenerationMatch?: bigint; }; }[]; } function serializeComposeRequest(data: any): ComposeRequest { return { ...data, destination: data["destination"] !== undefined ? serializeObject(data["destination"]) : undefined, sourceObjects: data["sourceObjects"] !== undefined ? data["sourceObjects"].map((item: any) => ({ ...item, generation: item["generation"] !== undefined ? String(item["generation"]) : undefined, objectPreconditions: item["objectPreconditions"] !== undefined ? { ...item["objectPreconditions"], ifGenerationMatch: item["objectPreconditions"]["ifGenerationMatch"] !== undefined ? String(item["objectPreconditions"]["ifGenerationMatch"]) : undefined, } : undefined, })) : undefined, }; } function deserializeComposeRequest(data: any): ComposeRequest { return { ...data, destination: data["destination"] !== undefined ? deserializeObject(data["destination"]) : undefined, sourceObjects: data["sourceObjects"] !== undefined ? data["sourceObjects"].map((item: any) => ({ ...item, generation: item["generation"] !== undefined ? BigInt(item["generation"]) : undefined, objectPreconditions: item["objectPreconditions"] !== undefined ? { ...item["objectPreconditions"], ifGenerationMatch: item["objectPreconditions"]["ifGenerationMatch"] !== undefined ? BigInt(item["objectPreconditions"]["ifGenerationMatch"]) : undefined, } : undefined, })) : undefined, }; } /** * Additional options for Storage#defaultObjectAccessControlsDelete. */ export interface DefaultObjectAccessControlsDeleteOptions { /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } /** * Additional options for Storage#defaultObjectAccessControlsGet. */ export interface DefaultObjectAccessControlsGetOptions { /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } /** * Additional options for Storage#defaultObjectAccessControlsInsert. */ export interface DefaultObjectAccessControlsInsertOptions { /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } /** * Additional options for Storage#defaultObjectAccessControlsList. */ export interface DefaultObjectAccessControlsListOptions { /** * If present, only return default ACL listing if the bucket's current * metageneration matches this value. */ ifMetagenerationMatch?: bigint; /** * If present, only return default ACL listing if the bucket's current * metageneration does not match the given value. */ ifMetagenerationNotMatch?: bigint; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeDefaultObjectAccessControlsListOptions(data: any): DefaultObjectAccessControlsListOptions { return { ...data, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? String(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? String(data["ifMetagenerationNotMatch"]) : undefined, }; } function deserializeDefaultObjectAccessControlsListOptions(data: any): DefaultObjectAccessControlsListOptions { return { ...data, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? BigInt(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? BigInt(data["ifMetagenerationNotMatch"]) : undefined, }; } /** * Additional options for Storage#defaultObjectAccessControlsPatch. */ export interface DefaultObjectAccessControlsPatchOptions { /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } /** * Additional options for Storage#defaultObjectAccessControlsUpdate. */ export interface DefaultObjectAccessControlsUpdateOptions { /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } /** * Represents an expression text. Example: title: "User account presence" * description: "Determines whether the request has a user account" expression: * "size(request.user) > 0" */ export interface Expr { /** * An optional description of the expression. This is a longer text which * describes the expression, e.g. when hovered over it in a UI. */ description?: string; /** * Textual representation of an expression in Common Expression Language * syntax. The application context of the containing message determines which * well-known feature set of CEL is supported. */ expression?: string; /** * An optional string indicating the location of the expression for error * reporting, e.g. a file name and a position in the file. */ location?: string; /** * An optional title for the expression, i.e. a short string describing its * purpose. This can be used e.g. in UIs which allow to enter the expression. */ title?: string; } /** * A folder. Only available in buckets with hierarchical namespace enabled. */ export interface Folder { /** * The name of the bucket containing this folder. */ bucket?: string; /** * The creation time of the folder in RFC 3339 format. */ createTime?: Date; /** * The ID of the folder, including the bucket name, folder name. */ id?: string; /** * The kind of item this is. For folders, this is always storage#folder. */ kind?: string; /** * The version of the metadata for this folder. Used for preconditions and * for detecting changes in metadata. */ metageneration?: bigint; /** * The name of the folder. Required if not specified by URL parameter. */ name?: string; /** * Only present if the folder is part of an ongoing rename folder operation. * Contains information which can be used to query the operation status. */ pendingRenameInfo?: { operationId?: string; }; /** * The link to this folder. */ selfLink?: string; /** * The modification time of the folder metadata in RFC 3339 format. */ updateTime?: Date; } function serializeFolder(data: any): Folder { return { ...data, createTime: data["createTime"] !== undefined ? data["createTime"].toISOString() : undefined, metageneration: data["metageneration"] !== undefined ? String(data["metageneration"]) : undefined, updateTime: data["updateTime"] !== undefined ? data["updateTime"].toISOString() : undefined, }; } function deserializeFolder(data: any): Folder { return { ...data, createTime: data["createTime"] !== undefined ? new Date(data["createTime"]) : undefined, metageneration: data["metageneration"] !== undefined ? BigInt(data["metageneration"]) : undefined, updateTime: data["updateTime"] !== undefined ? new Date(data["updateTime"]) : undefined, }; } /** * A list of folders. */ export interface Folders { /** * The list of items. */ items?: Folder[]; /** * The kind of item this is. For lists of folders, this is always * storage#folders. */ kind?: string; /** * The continuation token, used to page through large result sets. Provide * this value in a subsequent request to return the next page of results. */ nextPageToken?: string; } function serializeFolders(data: any): Folders { return { ...data, items: data["items"] !== undefined ? data["items"].map((item: any) => (serializeFolder(item))) : undefined, }; } function deserializeFolders(data: any): Folders { return { ...data, items: data["items"] !== undefined ? data["items"].map((item: any) => (deserializeFolder(item))) : undefined, }; } /** * Additional options for Storage#foldersDelete. */ export interface FoldersDeleteOptions { /** * If set, only deletes the folder if its metageneration matches this value. */ ifMetagenerationMatch?: bigint; /** * If set, only deletes the folder if its metageneration does not match this * value. */ ifMetagenerationNotMatch?: bigint; } function serializeFoldersDeleteOptions(data: any): FoldersDeleteOptions { return { ...data, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? String(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? String(data["ifMetagenerationNotMatch"]) : undefined, }; } function deserializeFoldersDeleteOptions(data: any): FoldersDeleteOptions { return { ...data, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? BigInt(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? BigInt(data["ifMetagenerationNotMatch"]) : undefined, }; } /** * Additional options for Storage#foldersGet. */ export interface FoldersGetOptions { /** * Makes the return of the folder metadata conditional on whether the * folder's current metageneration matches the given value. */ ifMetagenerationMatch?: bigint; /** * Makes the return of the folder metadata conditional on whether the * folder's current metageneration does not match the given value. */ ifMetagenerationNotMatch?: bigint; } function serializeFoldersGetOptions(data: any): FoldersGetOptions { return { ...data, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? String(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? String(data["ifMetagenerationNotMatch"]) : undefined, }; } function deserializeFoldersGetOptions(data: any): FoldersGetOptions { return { ...data, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? BigInt(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? BigInt(data["ifMetagenerationNotMatch"]) : undefined, }; } /** * Additional options for Storage#foldersInsert. */ export interface FoldersInsertOptions { /** * If true, any parent folder which doesn’t exist will be created * automatically. */ recursive?: boolean; } /** * Additional options for Storage#foldersList. */ export interface FoldersListOptions { /** * Returns results in a directory-like mode. The only supported value is '/'. * If set, items will only contain folders that either exactly match the * prefix, or are one level below the prefix. */ delimiter?: string; /** * Filter results to folders whose names are lexicographically before * endOffset. If startOffset is also set, the folders listed will have names * between startOffset (inclusive) and endOffset (exclusive). */ endOffset?: string; /** * Maximum number of items to return in a single page of responses. */ pageSize?: number; /** * A previously-returned page token representing part of the larger set of * results to view. */ pageToken?: string; /** * Filter results to folders whose paths begin with this prefix. If set, the * value must either be an empty string or end with a '/'. */ prefix?: string; /** * Filter results to folders whose names are lexicographically equal to or * after startOffset. If endOffset is also set, the folders listed will have * names between startOffset (inclusive) and endOffset (exclusive). */ startOffset?: string; } /** * Additional options for Storage#foldersRename. */ export interface FoldersRenameOptions { /** * Makes the operation conditional on whether the source object's current * metageneration matches the given value. */ ifSourceMetagenerationMatch?: bigint; /** * Makes the operation conditional on whether the source object's current * metageneration does not match the given value. */ ifSourceMetagenerationNotMatch?: bigint; } function serializeFoldersRenameOptions(data: any): FoldersRenameOptions { return { ...data, ifSourceMetagenerationMatch: data["ifSourceMetagenerationMatch"] !== undefined ? String(data["ifSourceMetagenerationMatch"]) : undefined, ifSourceMetagenerationNotMatch: data["ifSourceMetagenerationNotMatch"] !== undefined ? String(data["ifSourceMetagenerationNotMatch"]) : undefined, }; } function deserializeFoldersRenameOptions(data: any): FoldersRenameOptions { return { ...data, ifSourceMetagenerationMatch: data["ifSourceMetagenerationMatch"] !== undefined ? BigInt(data["ifSourceMetagenerationMatch"]) : undefined, ifSourceMetagenerationNotMatch: data["ifSourceMetagenerationNotMatch"] !== undefined ? BigInt(data["ifSourceMetagenerationNotMatch"]) : undefined, }; } /** * The response message for storage.buckets.operations.list. */ export interface GoogleLongrunningListOperationsResponse { /** * The kind of item this is. For lists of operations, this is always * storage#operations. */ kind?: string; /** * The continuation token, used to page through large result sets. Provide * this value in a subsequent request to return the next page of results. */ nextPageToken?: string; /** * A list of operations that matches the specified filter in the request. */ operations?: GoogleLongrunningOperation[]; } /** * This resource represents a long-running operation that is the result of a * network API call. */ export interface GoogleLongrunningOperation { /** * If the value is "false", it means the operation is still in progress. If * "true", the operation is completed, and either "error" or "response" is * available. */ done?: boolean; /** * The error result of the operation in case of failure or cancellation. */ error?: GoogleRpcStatus; /** * The kind of item this is. For operations, this is always * storage#operation. */ kind?: string; /** * Service-specific metadata associated with the operation. It typically * contains progress information and common metadata such as create time. Some * services might not provide such metadata. Any method that returns a * long-running operation should document the metadata type, if any. */ metadata?: { [key: string]: any }; /** * The server-assigned name, which is only unique within the same service * that originally returns it. If you use the default HTTP mapping, the "name" * should be a resource name ending with "operations/{operationId}". */ name?: string; /** * The normal response of the operation in case of success. If the original * method returns no data on success, such as "Delete", the response is * google.protobuf.Empty. If the original method is standard * Get/Create/Update, the response should be the resource. For other methods, * the response should have the type "XxxResponse", where "Xxx" is the * original method name. For example, if the original method name is * "TakeSnapshot()", the inferred response type is "TakeSnapshotResponse". */ response?: { [key: string]: any }; /** * The link to this long running operation. */ selfLink?: string; } /** * The "Status" type defines a logical error model that is suitable for * different programming environments, including REST APIs and RPC APIs. It is * used by [gRPC](https://github.com/grpc). Each "Status" message contains three * pieces of data: error code, error message, and error details. You can find * out more about this error model and how to work with it in the [API Design * Guide](https://cloud.google.com/apis/design/errors). */ export interface GoogleRpcStatus { /** * The status code, which should be an enum value of google.rpc.Code. */ code?: number; /** * A list of messages that carry the error details. There is a common set of * message types for APIs to use. */ details?: { [key: string]: any }[]; /** * A developer-facing error message, which should be in English. */ message?: string; } /** * JSON template to produce a JSON-style HMAC Key resource for Create * responses. */ export interface HmacKey { /** * The kind of item this is. For HMAC keys, this is always storage#hmacKey. */ kind?: string; /** * Key metadata. */ metadata?: HmacKeyMetadata; /** * HMAC secret key material. */ secret?: string; } function serializeHmacKey(data: any): HmacKey { return { ...data, metadata: data["metadata"] !== undefined ? serializeHmacKeyMetadata(data["metadata"]) : undefined, }; } function deserializeHmacKey(data: any): HmacKey { return { ...data, metadata: data["metadata"] !== undefined ? deserializeHmacKeyMetadata(data["metadata"]) : undefined, }; } /** * JSON template to produce a JSON-style HMAC Key metadata resource. */ export interface HmacKeyMetadata { /** * The ID of the HMAC Key. */ accessId?: string; /** * HTTP 1.1 Entity tag for the HMAC key. */ etag?: string; /** * The ID of the HMAC key, including the Project ID and the Access ID. */ id?: string; /** * The kind of item this is. For HMAC Key metadata, this is always * storage#hmacKeyMetadata. */ kind?: string; /** * Project ID owning the service account to which the key authenticates. */ projectId?: string; /** * The link to this resource. */ selfLink?: string; /** * The email address of the key's associated service account. */ serviceAccountEmail?: string; /** * The state of the key. Can be one of ACTIVE, INACTIVE, or DELETED. */ state?: string; /** * The creation time of the HMAC key in RFC 3339 format. */ timeCreated?: Date; /** * The last modification time of the HMAC key metadata in RFC 3339 format. */ updated?: Date; } function serializeHmacKeyMetadata(data: any): HmacKeyMetadata { return { ...data, timeCreated: data["timeCreated"] !== undefined ? data["timeCreated"].toISOString() : undefined, updated: data["updated"] !== undefined ? data["updated"].toISOString() : undefined, }; } function deserializeHmacKeyMetadata(data: any): HmacKeyMetadata { return { ...data, timeCreated: data["timeCreated"] !== undefined ? new Date(data["timeCreated"]) : undefined, updated: data["updated"] !== undefined ? new Date(data["updated"]) : undefined, }; } /** * A list of hmacKeys. */ export interface HmacKeysMetadata { /** * The list of items. */ items?: HmacKeyMetadata[]; /** * The kind of item this is. For lists of hmacKeys, this is always * storage#hmacKeysMetadata. */ kind?: string; /** * The continuation token, used to page through large result sets. Provide * this value in a subsequent request to return the next page of results. */ nextPageToken?: string; } function serializeHmacKeysMetadata(data: any): HmacKeysMetadata { return { ...data, items: data["items"] !== undefined ? data["items"].map((item: any) => (serializeHmacKeyMetadata(item))) : undefined, }; } function deserializeHmacKeysMetadata(data: any): HmacKeysMetadata { return { ...data, items: data["items"] !== undefined ? data["items"].map((item: any) => (deserializeHmacKeyMetadata(item))) : undefined, }; } /** * A managed folder. */ export interface ManagedFolder { /** * The name of the bucket containing this managed folder. */ bucket?: string; /** * The creation time of the managed folder in RFC 3339 format. */ createTime?: Date; /** * The ID of the managed folder, including the bucket name and managed folder * name. */ id?: string; /** * The kind of item this is. For managed folders, this is always * storage#managedFolder. */ kind?: string; /** * The version of the metadata for this managed folder. Used for * preconditions and for detecting changes in metadata. */ metageneration?: bigint; /** * The name of the managed folder. Required if not specified by URL * parameter. */ name?: string; /** * The link to this managed folder. */ selfLink?: string; /** * The last update time of the managed folder metadata in RFC 3339 format. */ updateTime?: Date; } function serializeManagedFolder(data: any): ManagedFolder { return { ...data, createTime: data["createTime"] !== undefined ? data["createTime"].toISOString() : undefined, metageneration: data["metageneration"] !== undefined ? String(data["metageneration"]) : undefined, updateTime: data["updateTime"] !== undefined ? data["updateTime"].toISOString() : undefined, }; } function deserializeManagedFolder(data: any): ManagedFolder { return { ...data, createTime: data["createTime"] !== undefined ? new Date(data["createTime"]) : undefined, metageneration: data["metageneration"] !== undefined ? BigInt(data["metageneration"]) : undefined, updateTime: data["updateTime"] !== undefined ? new Date(data["updateTime"]) : undefined, }; } /** * A list of managed folders. */ export interface ManagedFolders { /** * The list of items. */ items?: ManagedFolder[]; /** * The kind of item this is. For lists of managed folders, this is always * storage#managedFolders. */ kind?: string; /** * The continuation token, used to page through large result sets. Provide * this value in a subsequent request to return the next page of results. */ nextPageToken?: string; } function serializeManagedFolders(data: any): ManagedFolders { return { ...data, items: data["items"] !== undefined ? data["items"].map((item: any) => (serializeManagedFolder(item))) : undefined, }; } function deserializeManagedFolders(data: any): ManagedFolders { return { ...data, items: data["items"] !== undefined ? data["items"].map((item: any) => (deserializeManagedFolder(item))) : undefined, }; } /** * Additional options for Storage#managedFoldersDelete. */ export interface ManagedFoldersDeleteOptions { /** * Allows the deletion of a managed folder even if it is not empty. A managed * folder is empty if there are no objects or managed folders that it applies * to. Callers must have storage.managedFolders.setIamPolicy permission. */ allowNonEmpty?: boolean; /** * If set, only deletes the managed folder if its metageneration matches this * value. */ ifMetagenerationMatch?: bigint; /** * If set, only deletes the managed folder if its metageneration does not * match this value. */ ifMetagenerationNotMatch?: bigint; } function serializeManagedFoldersDeleteOptions(data: any): ManagedFoldersDeleteOptions { return { ...data, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? String(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? String(data["ifMetagenerationNotMatch"]) : undefined, }; } function deserializeManagedFoldersDeleteOptions(data: any): ManagedFoldersDeleteOptions { return { ...data, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? BigInt(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? BigInt(data["ifMetagenerationNotMatch"]) : undefined, }; } /** * Additional options for Storage#managedFoldersGetIamPolicy. */ export interface ManagedFoldersGetIamPolicyOptions { /** * The IAM policy format version to be returned. If the * optionsRequestedPolicyVersion is for an older version that doesn't support * part of the requested IAM policy, the request fails. */ optionsRequestedPolicyVersion?: number; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } /** * Additional options for Storage#managedFoldersGet. */ export interface ManagedFoldersGetOptions { /** * Makes the return of the managed folder metadata conditional on whether the * managed folder's current metageneration matches the given value. */ ifMetagenerationMatch?: bigint; /** * Makes the return of the managed folder metadata conditional on whether the * managed folder's current metageneration does not match the given value. */ ifMetagenerationNotMatch?: bigint; } function serializeManagedFoldersGetOptions(data: any): ManagedFoldersGetOptions { return { ...data, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? String(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? String(data["ifMetagenerationNotMatch"]) : undefined, }; } function deserializeManagedFoldersGetOptions(data: any): ManagedFoldersGetOptions { return { ...data, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? BigInt(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? BigInt(data["ifMetagenerationNotMatch"]) : undefined, }; } /** * Additional options for Storage#managedFoldersList. */ export interface ManagedFoldersListOptions { /** * Maximum number of items to return in a single page of responses. */ pageSize?: number; /** * A previously-returned page token representing part of the larger set of * results to view. */ pageToken?: string; /** * The managed folder name/path prefix to filter the output list of results. */ prefix?: string; } /** * Additional options for Storage#managedFoldersSetIamPolicy. */ export interface ManagedFoldersSetIamPolicyOptions { /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } /** * Additional options for Storage#managedFoldersTestIamPermissions. */ export interface ManagedFoldersTestIamPermissionsOptions { /** * Permissions to test. */ permissions: string; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } /** * A subscription to receive Google PubSub notifications. */ export interface Notification { /** * An optional list of additional attributes to attach to each Cloud PubSub * message published for this notification subscription. */ custom_attributes?: { [key: string]: string }; /** * HTTP 1.1 Entity tag for this subscription notification. */ etag?: string; /** * If present, only send notifications about listed event types. If empty, * sent notifications for all event types. */ event_types?: string[]; /** * The ID of the notification. */ id?: string; /** * The kind of item this is. For notifications, this is always * storage#notification. */ kind?: string; /** * If present, only apply this notification configuration to object names * that begin with this prefix. */ object_name_prefix?: string; /** * The desired content of the Payload. */ payload_format?: string; /** * The canonical URL of this notification. */ selfLink?: string; /** * The Cloud PubSub topic to which this subscription publishes. Formatted as: * '//pubsub.googleapis.com/projects/{project-identifier}/topics/{my-topic}' */ topic?: string; } /** * A list of notification subscriptions. */ export interface Notifications { /** * The list of items. */ items?: Notification[]; /** * The kind of item this is. For lists of notifications, this is always * storage#notifications. */ kind?: string; } /** * Additional options for Storage#notificationsDelete. */ export interface NotificationsDeleteOptions { /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } /** * Additional options for Storage#notificationsGet. */ export interface NotificationsGetOptions { /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } /** * Additional options for Storage#notificationsInsert. */ export interface NotificationsInsertOptions { /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } /** * Additional options for Storage#notificationsList. */ export interface NotificationsListOptions { /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } /** * An object. */ export interface Object { /** * Access controls on the object. */ acl?: ObjectAccessControl[]; /** * The name of the bucket containing this object. */ bucket?: string; /** * Cache-Control directive for the object data. If omitted, and the object is * accessible to all anonymous users, the default will be public, * max-age=3600. */ cacheControl?: string; /** * Number of underlying components that make up this object. Components are * accumulated by compose operations. */ componentCount?: number; /** * Content-Disposition of the object data. */ contentDisposition?: string; /** * Content-Encoding of the object data. */ contentEncoding?: string; /** * Content-Language of the object data. */ contentLanguage?: string; /** * Content-Type of the object data. If an object is stored without a * Content-Type, it is served as application/octet-stream. */ contentType?: string; /** * CRC32c checksum, as described in RFC 4960, Appendix B; encoded using * base64 in big-endian byte order. For more information about using the * CRC32c checksum, see [Data Validation and Change * Detection](https://cloud.google.com/storage/docs/data-validation). */ crc32c?: string; /** * Metadata of customer-supplied encryption key, if the object is encrypted * by such a key. */ customerEncryption?: { encryptionAlgorithm?: string; keySha256?: string; }; /** * A timestamp in RFC 3339 format specified by the user for an object. */ customTime?: Date; /** * HTTP 1.1 Entity tag for the object. */ etag?: string; /** * Whether an object is under event-based hold. Event-based hold is a way to * retain objects until an event occurs, which is signified by the hold's * release (i.e. this value is set to false). After being released (set to * false), such objects will be subject to bucket-level retention (if any). * One sample use case of this flag is for banks to hold loan documents for at * least 3 years after loan is paid in full. Here, bucket-level retention is 3 * years and the event is the loan being paid in full. In this example, these * objects will be held intact for any number of years until the event has * occurred (event-based hold on the object is released) and then 3 more years * after that. That means retention duration of the objects begins from the * moment event-based hold transitioned from true to false. */ eventBasedHold?: boolean; /** * The content generation of this object. Used for object versioning. */ generation?: bigint; /** * This is the time (in the future) when the soft-deleted object will no * longer be restorable. It is equal to the soft delete time plus the current * soft delete retention duration of the bucket. */ hardDeleteTime?: Date; /** * The ID of the object, including the bucket name, object name, and * generation number. */ id?: string; /** * The kind of item this is. For objects, this is always storage#object. */ kind?: string; /** * Not currently supported. Specifying the parameter causes the request to * fail with status code 400 - Bad Request. */ kmsKeyName?: string; /** * MD5 hash of the data; encoded using base64. For more information about * using the MD5 hash, see [Data Validation and Change * Detection](https://cloud.google.com/storage/docs/data-validation). */ md5Hash?: string; /** * Media download link. */ mediaLink?: string; /** * User-provided metadata, in key/value pairs. */ metadata?: { [key: string]: string }; /** * The version of the metadata for this object at this generation. Used for * preconditions and for detecting changes in metadata. A metageneration * number is only meaningful in the context of a particular generation of a * particular object. */ metageneration?: bigint; /** * The name of the object. Required if not specified by URL parameter. */ name?: string; /** * The owner of the object. This will always be the uploader of the object. */ owner?: { entity?: string; entityId?: string; }; /** * Restore token used to differentiate deleted objects with the same name and * generation. This field is only returned for deleted objects in hierarchical * namespace buckets. */ restoreToken?: string; /** * A collection of object level retention parameters. */ retention?: { mode?: string; retainUntilTime?: Date; }; /** * A server-determined value that specifies the earliest time that the * object's retention period expires. This value is in RFC 3339 format. Note * 1: This field is not provided for objects with an active event-based hold, * since retention expiration is unknown until the hold is removed. Note 2: * This value can be provided even when temporary hold is set (so that the * user can reason about policy without having to first unset the temporary * hold). */ retentionExpirationTime?: Date; /** * The link to this object. */ selfLink?: string; /** * Content-Length of the data in bytes. */ size?: bigint; /** * The time at which the object became soft-deleted in RFC 3339 format. */ softDeleteTime?: Date; /** * Storage class of the object. */ storageClass?: string; /** * Whether an object is under temporary hold. While this flag is set to true, * the object is protected against deletion and overwrites. A common use case * of this flag is regulatory investigations where objects need to be retained * while the investigation is ongoing. Note that unlike event-based hold, * temporary hold does not impact retention expiration time of an object. */ temporaryHold?: boolean; /** * The creation time of the object in RFC 3339 format. */ timeCreated?: Date; /** * The time at which the object became noncurrent in RFC 3339 format. Will be * returned if and only if this version of the object has been deleted. */ timeDeleted?: Date; /** * The time when the object was finalized. */ timeFinalized?: Date; /** * The time at which the object's storage class was last changed. When the * object is initially created, it will be set to timeCreated. */ timeStorageClassUpdated?: Date; /** * The modification time of the object metadata in RFC 3339 format. Set * initially to object creation time and then updated whenever any metadata of * the object changes. This includes changes made by a requester, such as * modifying custom metadata, as well as changes made by Cloud Storage on * behalf of a requester, such as changing the storage class based on an * Object Lifecycle Configuration. */ updated?: Date; } function serializeObject(data: any): Object { return { ...data, acl: data["acl"] !== undefined ? data["acl"].map((item: any) => (serializeObjectAccessControl(item))) : undefined, customTime: data["customTime"] !== undefined ? data["customTime"].toISOString() : undefined, generation: data["generation"] !== undefined ? String(data["generation"]) : undefined, hardDeleteTime: data["hardDeleteTime"] !== undefined ? data["hardDeleteTime"].toISOString() : undefined, metageneration: data["metageneration"] !== undefined ? String(data["metageneration"]) : undefined, retention: data["retention"] !== undefined ? { ...data["retention"], retainUntilTime: data["retention"]["retainUntilTime"] !== undefined ? data["retention"]["retainUntilTime"].toISOString() : undefined, } : undefined, retentionExpirationTime: data["retentionExpirationTime"] !== undefined ? data["retentionExpirationTime"].toISOString() : undefined, size: data["size"] !== undefined ? String(data["size"]) : undefined, softDeleteTime: data["softDeleteTime"] !== undefined ? data["softDeleteTime"].toISOString() : undefined, timeCreated: data["timeCreated"] !== undefined ? data["timeCreated"].toISOString() : undefined, timeDeleted: data["timeDeleted"] !== undefined ? data["timeDeleted"].toISOString() : undefined, timeFinalized: data["timeFinalized"] !== undefined ? data["timeFinalized"].toISOString() : undefined, timeStorageClassUpdated: data["timeStorageClassUpdated"] !== undefined ? data["timeStorageClassUpdated"].toISOString() : undefined, updated: data["updated"] !== undefined ? data["updated"].toISOString() : undefined, }; } function deserializeObject(data: any): Object { return { ...data, acl: data["acl"] !== undefined ? data["acl"].map((item: any) => (deserializeObjectAccessControl(item))) : undefined, customTime: data["customTime"] !== undefined ? new Date(data["customTime"]) : undefined, generation: data["generation"] !== undefined ? BigInt(data["generation"]) : undefined, hardDeleteTime: data["hardDeleteTime"] !== undefined ? new Date(data["hardDeleteTime"]) : undefined, metageneration: data["metageneration"] !== undefined ? BigInt(data["metageneration"]) : undefined, retention: data["retention"] !== undefined ? { ...data["retention"], retainUntilTime: data["retention"]["retainUntilTime"] !== undefined ? new Date(data["retention"]["retainUntilTime"]) : undefined, } : undefined, retentionExpirationTime: data["retentionExpirationTime"] !== undefined ? new Date(data["retentionExpirationTime"]) : undefined, size: data["size"] !== undefined ? BigInt(data["size"]) : undefined, softDeleteTime: data["softDeleteTime"] !== undefined ? new Date(data["softDeleteTime"]) : undefined, timeCreated: data["timeCreated"] !== undefined ? new Date(data["timeCreated"]) : undefined, timeDeleted: data["timeDeleted"] !== undefined ? new Date(data["timeDeleted"]) : undefined, timeFinalized: data["timeFinalized"] !== undefined ? new Date(data["timeFinalized"]) : undefined, timeStorageClassUpdated: data["timeStorageClassUpdated"] !== undefined ? new Date(data["timeStorageClassUpdated"]) : undefined, updated: data["updated"] !== undefined ? new Date(data["updated"]) : undefined, }; } /** * An access-control entry. */ export interface ObjectAccessControl { /** * The name of the bucket. */ bucket?: string; /** * The domain associated with the entity, if any. */ domain?: string; /** * The email address associated with the entity, if any. */ email?: string; /** * The entity holding the permission, in one of the following forms: - * user-userId - user-email - group-groupId - group-email - domain-domain - * project-team-projectId - allUsers - allAuthenticatedUsers Examples: - The * user liz@example.com would be user-liz@example.com. - The group * example@googlegroups.com would be group-example@googlegroups.com. - To * refer to all members of the Google Apps for Business domain example.com, * the entity would be domain-example.com. */ entity?: string; /** * The ID for the entity, if any. */ entityId?: string; /** * HTTP 1.1 Entity tag for the access-control entry. */ etag?: string; /** * The content generation of the object, if applied to an object. */ generation?: bigint; /** * The ID of the access-control entry. */ id?: string; /** * The kind of item this is. For object access control entries, this is * always storage#objectAccessControl. */ kind?: string; /** * The name of the object, if applied to an object. */ object?: string; /** * The project team associated with the entity, if any. */ projectTeam?: { projectNumber?: string; team?: string; }; /** * The access permission for the entity. */ role?: string; /** * The link to this access-control entry. */ selfLink?: string; } function serializeObjectAccessControl(data: any): ObjectAccessControl { return { ...data, generation: data["generation"] !== undefined ? String(data["generation"]) : undefined, }; } function deserializeObjectAccessControl(data: any): ObjectAccessControl { return { ...data, generation: data["generation"] !== undefined ? BigInt(data["generation"]) : undefined, }; } /** * An access-control list. */ export interface ObjectAccessControls { /** * The list of items. */ items?: ObjectAccessControl[]; /** * The kind of item this is. For lists of object access control entries, this * is always storage#objectAccessControls. */ kind?: string; } function serializeObjectAccessControls(data: any): ObjectAccessControls { return { ...data, items: data["items"] !== undefined ? data["items"].map((item: any) => (serializeObjectAccessControl(item))) : undefined, }; } function deserializeObjectAccessControls(data: any): ObjectAccessControls { return { ...data, items: data["items"] !== undefined ? data["items"].map((item: any) => (deserializeObjectAccessControl(item))) : undefined, }; } /** * Additional options for Storage#objectAccessControlsDelete. */ export interface ObjectAccessControlsDeleteOptions { /** * If present, selects a specific revision of this object (as opposed to the * latest version, the default). */ generation?: bigint; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeObjectAccessControlsDeleteOptions(data: any): ObjectAccessControlsDeleteOptions { return { ...data, generation: data["generation"] !== undefined ? String(data["generation"]) : undefined, }; } function deserializeObjectAccessControlsDeleteOptions(data: any): ObjectAccessControlsDeleteOptions { return { ...data, generation: data["generation"] !== undefined ? BigInt(data["generation"]) : undefined, }; } /** * Additional options for Storage#objectAccessControlsGet. */ export interface ObjectAccessControlsGetOptions { /** * If present, selects a specific revision of this object (as opposed to the * latest version, the default). */ generation?: bigint; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeObjectAccessControlsGetOptions(data: any): ObjectAccessControlsGetOptions { return { ...data, generation: data["generation"] !== undefined ? String(data["generation"]) : undefined, }; } function deserializeObjectAccessControlsGetOptions(data: any): ObjectAccessControlsGetOptions { return { ...data, generation: data["generation"] !== undefined ? BigInt(data["generation"]) : undefined, }; } /** * Additional options for Storage#objectAccessControlsInsert. */ export interface ObjectAccessControlsInsertOptions { /** * If present, selects a specific revision of this object (as opposed to the * latest version, the default). */ generation?: bigint; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeObjectAccessControlsInsertOptions(data: any): ObjectAccessControlsInsertOptions { return { ...data, generation: data["generation"] !== undefined ? String(data["generation"]) : undefined, }; } function deserializeObjectAccessControlsInsertOptions(data: any): ObjectAccessControlsInsertOptions { return { ...data, generation: data["generation"] !== undefined ? BigInt(data["generation"]) : undefined, }; } /** * Additional options for Storage#objectAccessControlsList. */ export interface ObjectAccessControlsListOptions { /** * If present, selects a specific revision of this object (as opposed to the * latest version, the default). */ generation?: bigint; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeObjectAccessControlsListOptions(data: any): ObjectAccessControlsListOptions { return { ...data, generation: data["generation"] !== undefined ? String(data["generation"]) : undefined, }; } function deserializeObjectAccessControlsListOptions(data: any): ObjectAccessControlsListOptions { return { ...data, generation: data["generation"] !== undefined ? BigInt(data["generation"]) : undefined, }; } /** * Additional options for Storage#objectAccessControlsPatch. */ export interface ObjectAccessControlsPatchOptions { /** * If present, selects a specific revision of this object (as opposed to the * latest version, the default). */ generation?: bigint; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeObjectAccessControlsPatchOptions(data: any): ObjectAccessControlsPatchOptions { return { ...data, generation: data["generation"] !== undefined ? String(data["generation"]) : undefined, }; } function deserializeObjectAccessControlsPatchOptions(data: any): ObjectAccessControlsPatchOptions { return { ...data, generation: data["generation"] !== undefined ? BigInt(data["generation"]) : undefined, }; } /** * Additional options for Storage#objectAccessControlsUpdate. */ export interface ObjectAccessControlsUpdateOptions { /** * If present, selects a specific revision of this object (as opposed to the * latest version, the default). */ generation?: bigint; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeObjectAccessControlsUpdateOptions(data: any): ObjectAccessControlsUpdateOptions { return { ...data, generation: data["generation"] !== undefined ? String(data["generation"]) : undefined, }; } function deserializeObjectAccessControlsUpdateOptions(data: any): ObjectAccessControlsUpdateOptions { return { ...data, generation: data["generation"] !== undefined ? BigInt(data["generation"]) : undefined, }; } /** * A list of objects. */ export interface Objects { /** * The list of items. */ items?: Object[]; /** * The kind of item this is. For lists of objects, this is always * storage#objects. */ kind?: string; /** * The continuation token, used to page through large result sets. Provide * this value in a subsequent request to return the next page of results. */ nextPageToken?: string; /** * The list of prefixes of objects matching-but-not-listed up to and * including the requested delimiter. */ prefixes?: string[]; } function serializeObjects(data: any): Objects { return { ...data, items: data["items"] !== undefined ? data["items"].map((item: any) => (serializeObject(item))) : undefined, }; } function deserializeObjects(data: any): Objects { return { ...data, items: data["items"] !== undefined ? data["items"].map((item: any) => (deserializeObject(item))) : undefined, }; } /** * Additional options for Storage#objectsCompose. */ export interface ObjectsComposeOptions { /** * Apply a predefined set of access controls to the destination object. */ destinationPredefinedAcl?: | "authenticatedRead" | "bucketOwnerFullControl" | "bucketOwnerRead" | "private" | "projectPrivate" | "publicRead"; /** * Makes the operation conditional on whether the object's current generation * matches the given value. Setting to 0 makes the operation succeed only if * there are no live versions of the object. */ ifGenerationMatch?: bigint; /** * Makes the operation conditional on whether the object's current * metageneration matches the given value. */ ifMetagenerationMatch?: bigint; /** * Resource name of the Cloud KMS key, of the form * projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that * will be used to encrypt the object. Overrides the object metadata's * kms_key_name value, if any. */ kmsKeyName?: string; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeObjectsComposeOptions(data: any): ObjectsComposeOptions { return { ...data, ifGenerationMatch: data["ifGenerationMatch"] !== undefined ? String(data["ifGenerationMatch"]) : undefined, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? String(data["ifMetagenerationMatch"]) : undefined, }; } function deserializeObjectsComposeOptions(data: any): ObjectsComposeOptions { return { ...data, ifGenerationMatch: data["ifGenerationMatch"] !== undefined ? BigInt(data["ifGenerationMatch"]) : undefined, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? BigInt(data["ifMetagenerationMatch"]) : undefined, }; } /** * Additional options for Storage#objectsCopy. */ export interface ObjectsCopyOptions { /** * Resource name of the Cloud KMS key, of the form * projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that * will be used to encrypt the object. Overrides the object metadata's * kms_key_name value, if any. */ destinationKmsKeyName?: string; /** * Apply a predefined set of access controls to the destination object. */ destinationPredefinedAcl?: | "authenticatedRead" | "bucketOwnerFullControl" | "bucketOwnerRead" | "private" | "projectPrivate" | "publicRead"; /** * Makes the operation conditional on whether the destination object's * current generation matches the given value. Setting to 0 makes the * operation succeed only if there are no live versions of the object. */ ifGenerationMatch?: bigint; /** * Makes the operation conditional on whether the destination object's * current generation does not match the given value. If no live object * exists, the precondition fails. Setting to 0 makes the operation succeed * only if there is a live version of the object. */ ifGenerationNotMatch?: bigint; /** * Makes the operation conditional on whether the destination object's * current metageneration matches the given value. */ ifMetagenerationMatch?: bigint; /** * Makes the operation conditional on whether the destination object's * current metageneration does not match the given value. */ ifMetagenerationNotMatch?: bigint; /** * Makes the operation conditional on whether the source object's current * generation matches the given value. */ ifSourceGenerationMatch?: bigint; /** * Makes the operation conditional on whether the source object's current * generation does not match the given value. */ ifSourceGenerationNotMatch?: bigint; /** * Makes the operation conditional on whether the source object's current * metageneration matches the given value. */ ifSourceMetagenerationMatch?: bigint; /** * Makes the operation conditional on whether the source object's current * metageneration does not match the given value. */ ifSourceMetagenerationNotMatch?: bigint; /** * Set of properties to return. Defaults to noAcl, unless the object resource * specifies the acl property, when it defaults to full. */ projection?: | "full" | "noAcl"; /** * If present, selects a specific revision of the source object (as opposed * to the latest version, the default). */ sourceGeneration?: bigint; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeObjectsCopyOptions(data: any): ObjectsCopyOptions { return { ...data, ifGenerationMatch: data["ifGenerationMatch"] !== undefined ? String(data["ifGenerationMatch"]) : undefined, ifGenerationNotMatch: data["ifGenerationNotMatch"] !== undefined ? String(data["ifGenerationNotMatch"]) : undefined, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? String(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? String(data["ifMetagenerationNotMatch"]) : undefined, ifSourceGenerationMatch: data["ifSourceGenerationMatch"] !== undefined ? String(data["ifSourceGenerationMatch"]) : undefined, ifSourceGenerationNotMatch: data["ifSourceGenerationNotMatch"] !== undefined ? String(data["ifSourceGenerationNotMatch"]) : undefined, ifSourceMetagenerationMatch: data["ifSourceMetagenerationMatch"] !== undefined ? String(data["ifSourceMetagenerationMatch"]) : undefined, ifSourceMetagenerationNotMatch: data["ifSourceMetagenerationNotMatch"] !== undefined ? String(data["ifSourceMetagenerationNotMatch"]) : undefined, sourceGeneration: data["sourceGeneration"] !== undefined ? String(data["sourceGeneration"]) : undefined, }; } function deserializeObjectsCopyOptions(data: any): ObjectsCopyOptions { return { ...data, ifGenerationMatch: data["ifGenerationMatch"] !== undefined ? BigInt(data["ifGenerationMatch"]) : undefined, ifGenerationNotMatch: data["ifGenerationNotMatch"] !== undefined ? BigInt(data["ifGenerationNotMatch"]) : undefined, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? BigInt(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? BigInt(data["ifMetagenerationNotMatch"]) : undefined, ifSourceGenerationMatch: data["ifSourceGenerationMatch"] !== undefined ? BigInt(data["ifSourceGenerationMatch"]) : undefined, ifSourceGenerationNotMatch: data["ifSourceGenerationNotMatch"] !== undefined ? BigInt(data["ifSourceGenerationNotMatch"]) : undefined, ifSourceMetagenerationMatch: data["ifSourceMetagenerationMatch"] !== undefined ? BigInt(data["ifSourceMetagenerationMatch"]) : undefined, ifSourceMetagenerationNotMatch: data["ifSourceMetagenerationNotMatch"] !== undefined ? BigInt(data["ifSourceMetagenerationNotMatch"]) : undefined, sourceGeneration: data["sourceGeneration"] !== undefined ? BigInt(data["sourceGeneration"]) : undefined, }; } /** * Additional options for Storage#objectsDelete. */ export interface ObjectsDeleteOptions { /** * If present, permanently deletes a specific revision of this object (as * opposed to the latest version, the default). */ generation?: bigint; /** * Makes the operation conditional on whether the object's current generation * matches the given value. Setting to 0 makes the operation succeed only if * there are no live versions of the object. */ ifGenerationMatch?: bigint; /** * Makes the operation conditional on whether the object's current generation * does not match the given value. If no live object exists, the precondition * fails. Setting to 0 makes the operation succeed only if there is a live * version of the object. */ ifGenerationNotMatch?: bigint; /** * Makes the operation conditional on whether the object's current * metageneration matches the given value. */ ifMetagenerationMatch?: bigint; /** * Makes the operation conditional on whether the object's current * metageneration does not match the given value. */ ifMetagenerationNotMatch?: bigint; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeObjectsDeleteOptions(data: any): ObjectsDeleteOptions { return { ...data, generation: data["generation"] !== undefined ? String(data["generation"]) : undefined, ifGenerationMatch: data["ifGenerationMatch"] !== undefined ? String(data["ifGenerationMatch"]) : undefined, ifGenerationNotMatch: data["ifGenerationNotMatch"] !== undefined ? String(data["ifGenerationNotMatch"]) : undefined, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? String(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? String(data["ifMetagenerationNotMatch"]) : undefined, }; } function deserializeObjectsDeleteOptions(data: any): ObjectsDeleteOptions { return { ...data, generation: data["generation"] !== undefined ? BigInt(data["generation"]) : undefined, ifGenerationMatch: data["ifGenerationMatch"] !== undefined ? BigInt(data["ifGenerationMatch"]) : undefined, ifGenerationNotMatch: data["ifGenerationNotMatch"] !== undefined ? BigInt(data["ifGenerationNotMatch"]) : undefined, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? BigInt(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? BigInt(data["ifMetagenerationNotMatch"]) : undefined, }; } /** * Additional options for Storage#objectsGetIamPolicy. */ export interface ObjectsGetIamPolicyOptions { /** * If present, selects a specific revision of this object (as opposed to the * latest version, the default). */ generation?: bigint; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeObjectsGetIamPolicyOptions(data: any): ObjectsGetIamPolicyOptions { return { ...data, generation: data["generation"] !== undefined ? String(data["generation"]) : undefined, }; } function deserializeObjectsGetIamPolicyOptions(data: any): ObjectsGetIamPolicyOptions { return { ...data, generation: data["generation"] !== undefined ? BigInt(data["generation"]) : undefined, }; } /** * Additional options for Storage#objectsGet. */ export interface ObjectsGetOptions { /** * If present, selects a specific revision of this object (as opposed to the * latest version, the default). */ generation?: bigint; /** * Makes the operation conditional on whether the object's current generation * matches the given value. Setting to 0 makes the operation succeed only if * there are no live versions of the object. */ ifGenerationMatch?: bigint; /** * Makes the operation conditional on whether the object's current generation * does not match the given value. If no live object exists, the precondition * fails. Setting to 0 makes the operation succeed only if there is a live * version of the object. */ ifGenerationNotMatch?: bigint; /** * Makes the operation conditional on whether the object's current * metageneration matches the given value. */ ifMetagenerationMatch?: bigint; /** * Makes the operation conditional on whether the object's current * metageneration does not match the given value. */ ifMetagenerationNotMatch?: bigint; /** * Set of properties to return. Defaults to noAcl. */ projection?: | "full" | "noAcl"; /** * Restore token used to differentiate soft-deleted objects with the same * name and generation. Only applicable for hierarchical namespace buckets and * if softDeleted is set to true. This parameter is optional, and is only * required in the rare case when there are multiple soft-deleted objects with * the same name and generation. */ restoreToken?: string; /** * If true, only soft-deleted object versions will be listed. The default is * false. For more information, see [Soft * Delete](https://cloud.google.com/storage/docs/soft-delete). */ softDeleted?: boolean; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeObjectsGetOptions(data: any): ObjectsGetOptions { return { ...data, generation: data["generation"] !== undefined ? String(data["generation"]) : undefined, ifGenerationMatch: data["ifGenerationMatch"] !== undefined ? String(data["ifGenerationMatch"]) : undefined, ifGenerationNotMatch: data["ifGenerationNotMatch"] !== undefined ? String(data["ifGenerationNotMatch"]) : undefined, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? String(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? String(data["ifMetagenerationNotMatch"]) : undefined, }; } function deserializeObjectsGetOptions(data: any): ObjectsGetOptions { return { ...data, generation: data["generation"] !== undefined ? BigInt(data["generation"]) : undefined, ifGenerationMatch: data["ifGenerationMatch"] !== undefined ? BigInt(data["ifGenerationMatch"]) : undefined, ifGenerationNotMatch: data["ifGenerationNotMatch"] !== undefined ? BigInt(data["ifGenerationNotMatch"]) : undefined, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? BigInt(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? BigInt(data["ifMetagenerationNotMatch"]) : undefined, }; } /** * Additional options for Storage#objectsInsert. */ export interface ObjectsInsertOptions { /** * If set, sets the contentEncoding property of the final object to this * value. Setting this parameter is equivalent to setting the contentEncoding * metadata property. This can be useful when uploading an object with * uploadType=media to indicate the encoding of the content being uploaded. */ contentEncoding?: string; /** * Makes the operation conditional on whether the object's current generation * matches the given value. Setting to 0 makes the operation succeed only if * there are no live versions of the object. */ ifGenerationMatch?: bigint; /** * Makes the operation conditional on whether the object's current generation * does not match the given value. If no live object exists, the precondition * fails. Setting to 0 makes the operation succeed only if there is a live * version of the object. */ ifGenerationNotMatch?: bigint; /** * Makes the operation conditional on whether the object's current * metageneration matches the given value. */ ifMetagenerationMatch?: bigint; /** * Makes the operation conditional on whether the object's current * metageneration does not match the given value. */ ifMetagenerationNotMatch?: bigint; /** * Resource name of the Cloud KMS key, of the form * projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that * will be used to encrypt the object. Overrides the object metadata's * kms_key_name value, if any. */ kmsKeyName?: string; /** * Name of the object. Required when the object metadata is not otherwise * provided. Overrides the object metadata's name value, if any. For * information about how to URL encode object names to be path safe, see * [Encoding URI Path * Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding). */ name?: string; /** * Apply a predefined set of access controls to this object. */ predefinedAcl?: | "authenticatedRead" | "bucketOwnerFullControl" | "bucketOwnerRead" | "private" | "projectPrivate" | "publicRead"; /** * Set of properties to return. Defaults to noAcl, unless the object resource * specifies the acl property, when it defaults to full. */ projection?: | "full" | "noAcl"; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeObjectsInsertOptions(data: any): ObjectsInsertOptions { return { ...data, ifGenerationMatch: data["ifGenerationMatch"] !== undefined ? String(data["ifGenerationMatch"]) : undefined, ifGenerationNotMatch: data["ifGenerationNotMatch"] !== undefined ? String(data["ifGenerationNotMatch"]) : undefined, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? String(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? String(data["ifMetagenerationNotMatch"]) : undefined, }; } function deserializeObjectsInsertOptions(data: any): ObjectsInsertOptions { return { ...data, ifGenerationMatch: data["ifGenerationMatch"] !== undefined ? BigInt(data["ifGenerationMatch"]) : undefined, ifGenerationNotMatch: data["ifGenerationNotMatch"] !== undefined ? BigInt(data["ifGenerationNotMatch"]) : undefined, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? BigInt(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? BigInt(data["ifMetagenerationNotMatch"]) : undefined, }; } /** * Additional options for Storage#objectsList. */ export interface ObjectsListOptions { /** * Returns results in a directory-like mode. items will contain only objects * whose names, aside from the prefix, do not contain delimiter. Objects whose * names, aside from the prefix, contain delimiter will have their name, * truncated after the delimiter, returned in prefixes. Duplicate prefixes are * omitted. */ delimiter?: string; /** * Filter results to objects whose names are lexicographically before * endOffset. If startOffset is also set, the objects listed will have names * between startOffset (inclusive) and endOffset (exclusive). */ endOffset?: string; /** * Only applicable if delimiter is set to '/'. If true, will also include * folders and managed folders (besides objects) in the returned prefixes. */ includeFoldersAsPrefixes?: boolean; /** * If true, objects that end in exactly one instance of delimiter will have * their metadata included in items in addition to prefixes. */ includeTrailingDelimiter?: boolean; /** * Filter results to objects and prefixes that match this glob pattern. */ matchGlob?: string; /** * Maximum number of items plus prefixes to return in a single page of * responses. As duplicate prefixes are omitted, fewer total results may be * returned than requested. The service will use this parameter or 1,000 * items, whichever is smaller. */ maxResults?: number; /** * A previously-returned page token representing part of the larger set of * results to view. */ pageToken?: string; /** * Filter results to objects whose names begin with this prefix. */ prefix?: string; /** * Set of properties to return. Defaults to noAcl. */ projection?: | "full" | "noAcl"; /** * If true, only soft-deleted object versions will be listed. The default is * false. For more information, see [Soft * Delete](https://cloud.google.com/storage/docs/soft-delete). */ softDeleted?: boolean; /** * Filter results to objects whose names are lexicographically equal to or * after startOffset. If endOffset is also set, the objects listed will have * names between startOffset (inclusive) and endOffset (exclusive). */ startOffset?: string; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; /** * If true, lists all versions of an object as distinct results. The default * is false. For more information, see [Object * Versioning](https://cloud.google.com/storage/docs/object-versioning). */ versions?: boolean; } /** * Additional options for Storage#objectsPatch. */ export interface ObjectsPatchOptions { /** * If present, selects a specific revision of this object (as opposed to the * latest version, the default). */ generation?: bigint; /** * Makes the operation conditional on whether the object's current generation * matches the given value. Setting to 0 makes the operation succeed only if * there are no live versions of the object. */ ifGenerationMatch?: bigint; /** * Makes the operation conditional on whether the object's current generation * does not match the given value. If no live object exists, the precondition * fails. Setting to 0 makes the operation succeed only if there is a live * version of the object. */ ifGenerationNotMatch?: bigint; /** * Makes the operation conditional on whether the object's current * metageneration matches the given value. */ ifMetagenerationMatch?: bigint; /** * Makes the operation conditional on whether the object's current * metageneration does not match the given value. */ ifMetagenerationNotMatch?: bigint; /** * Must be true to remove the retention configuration, reduce its unlocked * retention period, or change its mode from unlocked to locked. */ overrideUnlockedRetention?: boolean; /** * Apply a predefined set of access controls to this object. */ predefinedAcl?: | "authenticatedRead" | "bucketOwnerFullControl" | "bucketOwnerRead" | "private" | "projectPrivate" | "publicRead"; /** * Set of properties to return. Defaults to full. */ projection?: | "full" | "noAcl"; /** * The project to be billed for this request, for Requester Pays buckets. */ userProject?: string; } function serializeObjectsPatchOptions(data: any): ObjectsPatchOptions { return { ...data, generation: data["generation"] !== undefined ? String(data["generation"]) : undefined, ifGenerationMatch: data["ifGenerationMatch"] !== undefined ? String(data["ifGenerationMatch"]) : undefined, ifGenerationNotMatch: data["ifGenerationNotMatch"] !== undefined ? String(data["ifGenerationNotMatch"]) : undefined, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? String(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? String(data["ifMetagenerationNotMatch"]) : undefined, }; } function deserializeObjectsPatchOptions(data: any): ObjectsPatchOptions { return { ...data, generation: data["generation"] !== undefined ? BigInt(data["generation"]) : undefined, ifGenerationMatch: data["ifGenerationMatch"] !== undefined ? BigInt(data["ifGenerationMatch"]) : undefined, ifGenerationNotMatch: data["ifGenerationNotMatch"] !== undefined ? BigInt(data["ifGenerationNotMatch"]) : undefined, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? BigInt(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? BigInt(data["ifMetagenerationNotMatch"]) : undefined, }; } /** * Additional options for Storage#objectsRestore. */ export interface ObjectsRestoreOptions { /** * If true, copies the source object's ACL; otherwise, uses the bucket's * default object ACL. The default is false. */ copySourceAcl?: boolean; /** * Selects a specific revision of this object. */ generation: bigint; /** * Makes the operation conditional on whether the object's one live * generation matches the given value. Setting to 0 makes the operation * succeed only if there are no live versions of the object. */ ifGenerationMatch?: bigint; /** * Makes the operation conditional on whether none of the object's live * generations match the given value. If no live object exists, the * precondition fails. Setting to 0 makes the operation succeed only if there * is a live version of the object. */ ifGenerationNotMatch?: bigint; /** * Makes the operation conditional on whether the object's one live * metageneration matches the given value. */ ifMetagenerationMatch?: bigint; /** * Makes the operation conditional on whether none of the object's live * metagenerations match the given value. */ ifMetagenerationNotMatch?: bigint; /** * Set of properties to return. Defaults to full. */ projection?: | "full" | "noAcl"; /** * Restore token used to differentiate sof-deleted objects with the same name * and generation. Only applicable for hierarchical namespace buckets. This * parameter is optional, and is only required in the rare case when there are * multiple soft-deleted objects with the same name and generation. */ restoreToken?: string; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeObjectsRestoreOptions(data: any): ObjectsRestoreOptions { return { ...data, generation: String(data["generation"]), ifGenerationMatch: data["ifGenerationMatch"] !== undefined ? String(data["ifGenerationMatch"]) : undefined, ifGenerationNotMatch: data["ifGenerationNotMatch"] !== undefined ? String(data["ifGenerationNotMatch"]) : undefined, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? String(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? String(data["ifMetagenerationNotMatch"]) : undefined, }; } function deserializeObjectsRestoreOptions(data: any): ObjectsRestoreOptions { return { ...data, generation: BigInt(data["generation"]), ifGenerationMatch: data["ifGenerationMatch"] !== undefined ? BigInt(data["ifGenerationMatch"]) : undefined, ifGenerationNotMatch: data["ifGenerationNotMatch"] !== undefined ? BigInt(data["ifGenerationNotMatch"]) : undefined, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? BigInt(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? BigInt(data["ifMetagenerationNotMatch"]) : undefined, }; } /** * Additional options for Storage#objectsRewrite. */ export interface ObjectsRewriteOptions { /** * Resource name of the Cloud KMS key, of the form * projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that * will be used to encrypt the object. Overrides the object metadata's * kms_key_name value, if any. */ destinationKmsKeyName?: string; /** * Apply a predefined set of access controls to the destination object. */ destinationPredefinedAcl?: | "authenticatedRead" | "bucketOwnerFullControl" | "bucketOwnerRead" | "private" | "projectPrivate" | "publicRead"; /** * Makes the operation conditional on whether the object's current generation * matches the given value. Setting to 0 makes the operation succeed only if * there are no live versions of the object. */ ifGenerationMatch?: bigint; /** * Makes the operation conditional on whether the object's current generation * does not match the given value. If no live object exists, the precondition * fails. Setting to 0 makes the operation succeed only if there is a live * version of the object. */ ifGenerationNotMatch?: bigint; /** * Makes the operation conditional on whether the destination object's * current metageneration matches the given value. */ ifMetagenerationMatch?: bigint; /** * Makes the operation conditional on whether the destination object's * current metageneration does not match the given value. */ ifMetagenerationNotMatch?: bigint; /** * Makes the operation conditional on whether the source object's current * generation matches the given value. */ ifSourceGenerationMatch?: bigint; /** * Makes the operation conditional on whether the source object's current * generation does not match the given value. */ ifSourceGenerationNotMatch?: bigint; /** * Makes the operation conditional on whether the source object's current * metageneration matches the given value. */ ifSourceMetagenerationMatch?: bigint; /** * Makes the operation conditional on whether the source object's current * metageneration does not match the given value. */ ifSourceMetagenerationNotMatch?: bigint; /** * The maximum number of bytes that will be rewritten per rewrite request. * Most callers shouldn't need to specify this parameter - it is primarily in * place to support testing. If specified the value must be an integral * multiple of 1 MiB (1048576). Also, this only applies to requests where the * source and destination span locations and/or storage classes. Finally, this * value must not change across rewrite calls else you'll get an error that * the rewriteToken is invalid. */ maxBytesRewrittenPerCall?: bigint; /** * Set of properties to return. Defaults to noAcl, unless the object resource * specifies the acl property, when it defaults to full. */ projection?: | "full" | "noAcl"; /** * Include this field (from the previous rewrite response) on each rewrite * request after the first one, until the rewrite response 'done' flag is * true. Calls that provide a rewriteToken can omit all other request fields, * but if included those fields must match the values provided in the first * rewrite request. */ rewriteToken?: string; /** * If present, selects a specific revision of the source object (as opposed * to the latest version, the default). */ sourceGeneration?: bigint; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeObjectsRewriteOptions(data: any): ObjectsRewriteOptions { return { ...data, ifGenerationMatch: data["ifGenerationMatch"] !== undefined ? String(data["ifGenerationMatch"]) : undefined, ifGenerationNotMatch: data["ifGenerationNotMatch"] !== undefined ? String(data["ifGenerationNotMatch"]) : undefined, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? String(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? String(data["ifMetagenerationNotMatch"]) : undefined, ifSourceGenerationMatch: data["ifSourceGenerationMatch"] !== undefined ? String(data["ifSourceGenerationMatch"]) : undefined, ifSourceGenerationNotMatch: data["ifSourceGenerationNotMatch"] !== undefined ? String(data["ifSourceGenerationNotMatch"]) : undefined, ifSourceMetagenerationMatch: data["ifSourceMetagenerationMatch"] !== undefined ? String(data["ifSourceMetagenerationMatch"]) : undefined, ifSourceMetagenerationNotMatch: data["ifSourceMetagenerationNotMatch"] !== undefined ? String(data["ifSourceMetagenerationNotMatch"]) : undefined, maxBytesRewrittenPerCall: data["maxBytesRewrittenPerCall"] !== undefined ? String(data["maxBytesRewrittenPerCall"]) : undefined, sourceGeneration: data["sourceGeneration"] !== undefined ? String(data["sourceGeneration"]) : undefined, }; } function deserializeObjectsRewriteOptions(data: any): ObjectsRewriteOptions { return { ...data, ifGenerationMatch: data["ifGenerationMatch"] !== undefined ? BigInt(data["ifGenerationMatch"]) : undefined, ifGenerationNotMatch: data["ifGenerationNotMatch"] !== undefined ? BigInt(data["ifGenerationNotMatch"]) : undefined, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? BigInt(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? BigInt(data["ifMetagenerationNotMatch"]) : undefined, ifSourceGenerationMatch: data["ifSourceGenerationMatch"] !== undefined ? BigInt(data["ifSourceGenerationMatch"]) : undefined, ifSourceGenerationNotMatch: data["ifSourceGenerationNotMatch"] !== undefined ? BigInt(data["ifSourceGenerationNotMatch"]) : undefined, ifSourceMetagenerationMatch: data["ifSourceMetagenerationMatch"] !== undefined ? BigInt(data["ifSourceMetagenerationMatch"]) : undefined, ifSourceMetagenerationNotMatch: data["ifSourceMetagenerationNotMatch"] !== undefined ? BigInt(data["ifSourceMetagenerationNotMatch"]) : undefined, maxBytesRewrittenPerCall: data["maxBytesRewrittenPerCall"] !== undefined ? BigInt(data["maxBytesRewrittenPerCall"]) : undefined, sourceGeneration: data["sourceGeneration"] !== undefined ? BigInt(data["sourceGeneration"]) : undefined, }; } /** * Additional options for Storage#objectsSetIamPolicy. */ export interface ObjectsSetIamPolicyOptions { /** * If present, selects a specific revision of this object (as opposed to the * latest version, the default). */ generation?: bigint; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeObjectsSetIamPolicyOptions(data: any): ObjectsSetIamPolicyOptions { return { ...data, generation: data["generation"] !== undefined ? String(data["generation"]) : undefined, }; } function deserializeObjectsSetIamPolicyOptions(data: any): ObjectsSetIamPolicyOptions { return { ...data, generation: data["generation"] !== undefined ? BigInt(data["generation"]) : undefined, }; } /** * Additional options for Storage#objectsTestIamPermissions. */ export interface ObjectsTestIamPermissionsOptions { /** * If present, selects a specific revision of this object (as opposed to the * latest version, the default). */ generation?: bigint; /** * Permissions to test. */ permissions: string; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeObjectsTestIamPermissionsOptions(data: any): ObjectsTestIamPermissionsOptions { return { ...data, generation: data["generation"] !== undefined ? String(data["generation"]) : undefined, }; } function deserializeObjectsTestIamPermissionsOptions(data: any): ObjectsTestIamPermissionsOptions { return { ...data, generation: data["generation"] !== undefined ? BigInt(data["generation"]) : undefined, }; } /** * Additional options for Storage#objectsUpdate. */ export interface ObjectsUpdateOptions { /** * If present, selects a specific revision of this object (as opposed to the * latest version, the default). */ generation?: bigint; /** * Makes the operation conditional on whether the object's current generation * matches the given value. Setting to 0 makes the operation succeed only if * there are no live versions of the object. */ ifGenerationMatch?: bigint; /** * Makes the operation conditional on whether the object's current generation * does not match the given value. If no live object exists, the precondition * fails. Setting to 0 makes the operation succeed only if there is a live * version of the object. */ ifGenerationNotMatch?: bigint; /** * Makes the operation conditional on whether the object's current * metageneration matches the given value. */ ifMetagenerationMatch?: bigint; /** * Makes the operation conditional on whether the object's current * metageneration does not match the given value. */ ifMetagenerationNotMatch?: bigint; /** * Must be true to remove the retention configuration, reduce its unlocked * retention period, or change its mode from unlocked to locked. */ overrideUnlockedRetention?: boolean; /** * Apply a predefined set of access controls to this object. */ predefinedAcl?: | "authenticatedRead" | "bucketOwnerFullControl" | "bucketOwnerRead" | "private" | "projectPrivate" | "publicRead"; /** * Set of properties to return. Defaults to full. */ projection?: | "full" | "noAcl"; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; } function serializeObjectsUpdateOptions(data: any): ObjectsUpdateOptions { return { ...data, generation: data["generation"] !== undefined ? String(data["generation"]) : undefined, ifGenerationMatch: data["ifGenerationMatch"] !== undefined ? String(data["ifGenerationMatch"]) : undefined, ifGenerationNotMatch: data["ifGenerationNotMatch"] !== undefined ? String(data["ifGenerationNotMatch"]) : undefined, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? String(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? String(data["ifMetagenerationNotMatch"]) : undefined, }; } function deserializeObjectsUpdateOptions(data: any): ObjectsUpdateOptions { return { ...data, generation: data["generation"] !== undefined ? BigInt(data["generation"]) : undefined, ifGenerationMatch: data["ifGenerationMatch"] !== undefined ? BigInt(data["ifGenerationMatch"]) : undefined, ifGenerationNotMatch: data["ifGenerationNotMatch"] !== undefined ? BigInt(data["ifGenerationNotMatch"]) : undefined, ifMetagenerationMatch: data["ifMetagenerationMatch"] !== undefined ? BigInt(data["ifMetagenerationMatch"]) : undefined, ifMetagenerationNotMatch: data["ifMetagenerationNotMatch"] !== undefined ? BigInt(data["ifMetagenerationNotMatch"]) : undefined, }; } /** * Additional options for Storage#objectsWatchAll. */ export interface ObjectsWatchAllOptions { /** * Returns results in a directory-like mode. items will contain only objects * whose names, aside from the prefix, do not contain delimiter. Objects whose * names, aside from the prefix, contain delimiter will have their name, * truncated after the delimiter, returned in prefixes. Duplicate prefixes are * omitted. */ delimiter?: string; /** * Filter results to objects whose names are lexicographically before * endOffset. If startOffset is also set, the objects listed will have names * between startOffset (inclusive) and endOffset (exclusive). */ endOffset?: string; /** * If true, objects that end in exactly one instance of delimiter will have * their metadata included in items in addition to prefixes. */ includeTrailingDelimiter?: boolean; /** * Maximum number of items plus prefixes to return in a single page of * responses. As duplicate prefixes are omitted, fewer total results may be * returned than requested. The service will use this parameter or 1,000 * items, whichever is smaller. */ maxResults?: number; /** * A previously-returned page token representing part of the larger set of * results to view. */ pageToken?: string; /** * Filter results to objects whose names begin with this prefix. */ prefix?: string; /** * Set of properties to return. Defaults to noAcl. */ projection?: | "full" | "noAcl"; /** * Filter results to objects whose names are lexicographically equal to or * after startOffset. If endOffset is also set, the objects listed will have * names between startOffset (inclusive) and endOffset (exclusive). */ startOffset?: string; /** * The project to be billed for this request. Required for Requester Pays * buckets. */ userProject?: string; /** * If true, lists all versions of an object as distinct results. The default * is false. For more information, see [Object * Versioning](https://cloud.google.com/storage/docs/object-versioning). */ versions?: boolean; } /** * Additional options for Storage#operationsList. */ export interface OperationsListOptions { /** * A filter to narrow down results to a preferred subset. The filtering * language is documented in more detail in * [AIP-160](https://google.aip.dev/160). */ filter?: string; /** * Maximum number of items to return in a single page of responses. Fewer * total results may be returned than requested. The service uses this * parameter or 100 items, whichever is smaller. */ pageSize?: number; /** * A previously-returned page token representing part of the larger set of * results to view. */ pageToken?: string; } /** * A bucket/object/managedFolder IAM policy. */ export interface Policy { /** * An association between a role, which comes with a set of permissions, and * members who may assume that role. */ bindings?: { condition?: Expr; members?: string[]; role?: string; }[]; /** * HTTP 1.1 Entity tag for the policy. */ etag?: Uint8Array; /** * The kind of item this is. For policies, this is always storage#policy. * This field is ignored on input. */ kind?: string; /** * The ID of the resource to which this policy belongs. Will be of the form * projects/_/buckets/bucket for buckets, * projects/_/buckets/bucket/objects/object for objects, and * projects/_/buckets/bucket/managedFolders/managedFolder. A specific * generation may be specified by appending #generationNumber to the end of * the object name, e.g. projects/_/buckets/my-bucket/objects/data.txt#17. The * current generation can be denoted with #0. This field is ignored on input. */ resourceId?: string; /** * The IAM policy format version. */ version?: number; } function serializePolicy(data: any): Policy { return { ...data, etag: data["etag"] !== undefined ? encodeBase64(data["etag"]) : undefined, }; } function deserializePolicy(data: any): Policy { return { ...data, etag: data["etag"] !== undefined ? decodeBase64(data["etag"] as string) : undefined, }; } /** * Additional options for Storage#projectsHmacKeysCreate. */ export interface ProjectsHmacKeysCreateOptions { /** * Email address of the service account. */ serviceAccountEmail: string; /** * The project to be billed for this request. */ userProject?: string; } /** * Additional options for Storage#projectsHmacKeysDelete. */ export interface ProjectsHmacKeysDeleteOptions { /** * The project to be billed for this request. */ userProject?: string; } /** * Additional options for Storage#projectsHmacKeysGet. */ export interface ProjectsHmacKeysGetOptions { /** * The project to be billed for this request. */ userProject?: string; } /** * Additional options for Storage#projectsHmacKeysList. */ export interface ProjectsHmacKeysListOptions { /** * Maximum number of items to return in a single page of responses. The * service uses this parameter or 250 items, whichever is smaller. The max * number of items per page will also be limited by the number of distinct * service accounts in the response. If the number of service accounts in a * single response is too high, the page will truncated and a next page token * will be returned. */ maxResults?: number; /** * A previously-returned page token representing part of the larger set of * results to view. */ pageToken?: string; /** * If present, only keys for the given service account are returned. */ serviceAccountEmail?: string; /** * Whether or not to show keys in the DELETED state. */ showDeletedKeys?: boolean; /** * The project to be billed for this request. */ userProject?: string; } /** * Additional options for Storage#projectsHmacKeysUpdate. */ export interface ProjectsHmacKeysUpdateOptions { /** * The project to be billed for this request. */ userProject?: string; } /** * Additional options for Storage#projectsServiceAccountGet. */ export interface ProjectsServiceAccountGetOptions { /** * The project to be billed for this request. */ userProject?: string; } /** * A Relocate Bucket request. */ export interface RelocateBucketRequest { /** * The bucket's new custom placement configuration if relocating to a Custom * Dual Region. */ destinationCustomPlacementConfig?: { dataLocations?: string[]; }; /** * The new location the bucket will be relocated to. */ destinationLocation?: string; /** * If true, validate the operation, but do not actually relocate the bucket. */ validateOnly?: boolean; } /** * A rewrite response. */ export interface RewriteResponse { /** * true if the copy is finished; otherwise, false if the copy is in progress. * This property is always present in the response. */ done?: boolean; /** * The kind of item this is. */ kind?: string; /** * The total size of the object being copied in bytes. This property is * always present in the response. */ objectSize?: bigint; /** * A resource containing the metadata for the copied-to object. This property * is present in the response only when copying completes. */ resource?: Object; /** * A token to use in subsequent requests to continue copying data. This token * is present in the response only when there is more data to copy. */ rewriteToken?: string; /** * The total bytes written so far, which can be used to provide a waiting * user with a progress indicator. This property is always present in the * response. */ totalBytesRewritten?: bigint; } function serializeRewriteResponse(data: any): RewriteResponse { return { ...data, objectSize: data["objectSize"] !== undefined ? String(data["objectSize"]) : undefined, resource: data["resource"] !== undefined ? serializeObject(data["resource"]) : undefined, totalBytesRewritten: data["totalBytesRewritten"] !== undefined ? String(data["totalBytesRewritten"]) : undefined, }; } function deserializeRewriteResponse(data: any): RewriteResponse { return { ...data, objectSize: data["objectSize"] !== undefined ? BigInt(data["objectSize"]) : undefined, resource: data["resource"] !== undefined ? deserializeObject(data["resource"]) : undefined, totalBytesRewritten: data["totalBytesRewritten"] !== undefined ? BigInt(data["totalBytesRewritten"]) : undefined, }; } /** * A subscription to receive Google PubSub notifications. */ export interface ServiceAccount { /** * The ID of the notification. */ email_address?: string; /** * The kind of item this is. For notifications, this is always * storage#notification. */ kind?: string; } /** * A storage.(buckets|objects|managedFolders).testIamPermissions response. */ export interface TestIamPermissionsResponse { /** * The kind of item this is. */ kind?: string; /** * The permissions held by the caller. Permissions are always of the format * storage.resource.capability, where resource is one of buckets, objects, or * managedFolders. The supported permissions are as follows: - * storage.buckets.delete — Delete bucket. - storage.buckets.get — Read bucket * metadata. - storage.buckets.getIamPolicy — Read bucket IAM policy. - * storage.buckets.create — Create bucket. - storage.buckets.list — List * buckets. - storage.buckets.setIamPolicy — Update bucket IAM policy. - * storage.buckets.update — Update bucket metadata. - storage.objects.delete — * Delete object. - storage.objects.get — Read object data and metadata. - * storage.objects.getIamPolicy — Read object IAM policy. - * storage.objects.create — Create object. - storage.objects.list — List * objects. - storage.objects.setIamPolicy — Update object IAM policy. - * storage.objects.update — Update object metadata. - * storage.managedFolders.delete — Delete managed folder. - * storage.managedFolders.get — Read managed folder metadata. - * storage.managedFolders.getIamPolicy — Read managed folder IAM policy. - * storage.managedFolders.create — Create managed folder. - * storage.managedFolders.list — List managed folders. - * storage.managedFolders.setIamPolicy — Update managed folder IAM policy. */ permissions?: string[]; } function decodeBase64(b64: string): Uint8Array { const binString = atob(b64); const size = binString.length; const bytes = new Uint8Array(size); for (let i = 0; i < size; i++) { bytes[i] = binString.charCodeAt(i); } return bytes; } const base64abc = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"]; /** * CREDIT: https://gist.github.com/enepomnyaschih/72c423f727d395eeaa09697058238727 * Encodes a given Uint8Array, ArrayBuffer or string into RFC4648 base64 representation * @param data */ function encodeBase64(uint8: Uint8Array): string { let result = "", i; const l = uint8.length; for (i = 2; i < l; i += 3) { result += base64abc[uint8[i - 2] >> 2]; result += base64abc[((uint8[i - 2] & 0x03) << 4) | (uint8[i - 1] >> 4)]; result += base64abc[((uint8[i - 1] & 0x0f) << 2) | (uint8[i] >> 6)]; result += base64abc[uint8[i] & 0x3f]; } if (i === l + 1) { // 1 octet yet to write result += base64abc[uint8[i - 2] >> 2]; result += base64abc[(uint8[i - 2] & 0x03) << 4]; result += "=="; } if (i === l) { // 2 octets yet to write result += base64abc[uint8[i - 2] >> 2]; result += base64abc[((uint8[i - 2] & 0x03) << 4) | (uint8[i - 1] >> 4)]; result += base64abc[(uint8[i - 1] & 0x0f) << 2]; result += "="; } return result; }