1 | import { BodyResponseCallback, DecorateRequestOptions, BaseMetadata } from './nodejs-common/index.js';
|
2 | export interface AclOptions {
|
3 | pathPrefix: string;
|
4 | request: (reqOpts: DecorateRequestOptions, callback: BodyResponseCallback) => void;
|
5 | }
|
6 | export type GetAclResponse = [
|
7 | AccessControlObject | AccessControlObject[],
|
8 | AclMetadata
|
9 | ];
|
10 | export interface GetAclCallback {
|
11 | (err: Error | null, acl?: AccessControlObject | AccessControlObject[] | null, apiResponse?: AclMetadata): void;
|
12 | }
|
13 | export interface GetAclOptions {
|
14 | entity: string;
|
15 | generation?: number;
|
16 | userProject?: string;
|
17 | }
|
18 | export interface UpdateAclOptions {
|
19 | entity: string;
|
20 | role: string;
|
21 | generation?: number;
|
22 | userProject?: string;
|
23 | }
|
24 | export type UpdateAclResponse = [AccessControlObject, AclMetadata];
|
25 | export interface UpdateAclCallback {
|
26 | (err: Error | null, acl?: AccessControlObject | null, apiResponse?: AclMetadata): void;
|
27 | }
|
28 | export interface AddAclOptions {
|
29 | entity: string;
|
30 | role: string;
|
31 | generation?: number;
|
32 | userProject?: string;
|
33 | }
|
34 | export type AddAclResponse = [AccessControlObject, AclMetadata];
|
35 | export interface AddAclCallback {
|
36 | (err: Error | null, acl?: AccessControlObject | null, apiResponse?: AclMetadata): void;
|
37 | }
|
38 | export type RemoveAclResponse = [AclMetadata];
|
39 | export interface RemoveAclCallback {
|
40 | (err: Error | null, apiResponse?: AclMetadata): void;
|
41 | }
|
42 | export interface RemoveAclOptions {
|
43 | entity: string;
|
44 | generation?: number;
|
45 | userProject?: string;
|
46 | }
|
47 | export interface AccessControlObject {
|
48 | entity: string;
|
49 | role: string;
|
50 | projectTeam: string;
|
51 | }
|
52 | export interface AclMetadata extends BaseMetadata {
|
53 | bucket?: string;
|
54 | domain?: string;
|
55 | entity?: string;
|
56 | entityId?: string;
|
57 | generation?: string;
|
58 | object?: string;
|
59 | projectTeam?: {
|
60 | projectNumber?: string;
|
61 | team?: 'editors' | 'owners' | 'viewers';
|
62 | };
|
63 | role?: 'OWNER' | 'READER' | 'WRITER' | 'FULL_CONTROL';
|
64 | [key: string]: unknown;
|
65 | }
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 | declare class AclRoleAccessorMethods {
|
82 | private static accessMethods;
|
83 | private static entities;
|
84 | private static roles;
|
85 | owners: {};
|
86 | readers: {};
|
87 | writers: {};
|
88 | constructor();
|
89 | _assignAccessMethods(role: string): void;
|
90 | }
|
91 | /**
|
92 | * Cloud Storage uses access control lists (ACLs) to manage object and
|
93 | * bucket access. ACLs are the mechanism you use to share objects with other
|
94 | * users and allow other users to access your buckets and objects.
|
95 | *
|
96 | * An ACL consists of one or more entries, where each entry grants permissions
|
97 | * to an entity. Permissions define the actions that can be performed against an
|
98 | * object or bucket (for example, `READ` or `WRITE`); the entity defines who the
|
99 | * permission applies to (for example, a specific user or group of users).
|
100 | *
|
101 | * Where an `entity` value is accepted, we follow the format the Cloud Storage
|
102 | * API expects.
|
103 | *
|
104 | * Refer to
|
105 | * https://cloud.google.com/storage/docs/json_api/v1/defaultObjectAccessControls
|
106 | * for the most up-to-date values.
|
107 | *
|
108 | * - `user-userId`
|
109 | * - `user-email`
|
110 | * - `group-groupId`
|
111 | * - `group-email`
|
112 | * - `domain-domain`
|
113 | * - `project-team-projectId`
|
114 | * - `allUsers`
|
115 | * - `allAuthenticatedUsers`
|
116 | *
|
117 | * Examples:
|
118 | *
|
119 | * - The user "liz@example.com" would be `user-liz@example.com`.
|
120 | * - The group "example@googlegroups.com" would be
|
121 | * `group-example@googlegroups.com`.
|
122 | * - To refer to all members of the Google Apps for Business domain
|
123 | * "example.com", the entity would be `domain-example.com`.
|
124 | *
|
125 | * For more detailed information, see
|
126 | * {@link http:
|
127 | *
|
128 | * @constructor Acl
|
129 | * @mixin
|
130 | * @param {object} options Configuration options.
|
131 | */
|
132 | declare class Acl extends AclRoleAccessorMethods {
|
133 | default: Acl;
|
134 | pathPrefix: string;
|
135 | request_: (reqOpts: DecorateRequestOptions, callback: BodyResponseCallback) => void;
|
136 | constructor(options: AclOptions);
|
137 | add(options: AddAclOptions): Promise<AddAclResponse>;
|
138 | add(options: AddAclOptions, callback: AddAclCallback): void;
|
139 | delete(options: RemoveAclOptions): Promise<RemoveAclResponse>;
|
140 | delete(options: RemoveAclOptions, callback: RemoveAclCallback): void;
|
141 | get(options?: GetAclOptions): Promise<GetAclResponse>;
|
142 | get(options: GetAclOptions, callback: GetAclCallback): void;
|
143 | get(callback: GetAclCallback): void;
|
144 | update(options: UpdateAclOptions): Promise<UpdateAclResponse>;
|
145 | update(options: UpdateAclOptions, callback: UpdateAclCallback): void;
|
146 | /**
|
147 | * Transform API responses to a consistent object format.
|
148 | *
|
149 | * @private
|
150 | */
|
151 | makeAclObject_(accessControlObject: AccessControlObject): AccessControlObject;
|
152 | /**
|
153 | * Patch requests up to the bucket's request object.
|
154 | *
|
155 | * @private
|
156 | *
|
157 | * @param {string} method Action.
|
158 | * @param {string} path Request path.
|
159 | * @param {*} query Request query object.
|
160 | * @param {*} body Request body contents.
|
161 | * @param {function} callback Callback function.
|
162 | */
|
163 | request(reqOpts: DecorateRequestOptions, callback: BodyResponseCallback): void;
|
164 | }
|
165 | export { Acl, AclRoleAccessorMethods };
|