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