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