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