1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | import { App } from '../app';
|
18 | export interface Release {
|
19 | readonly name: string;
|
20 | readonly rulesetName: string;
|
21 | readonly createTime?: string;
|
22 | readonly updateTime?: string;
|
23 | }
|
24 | export interface RulesetContent {
|
25 | readonly source: {
|
26 | readonly files: Array<{
|
27 | name: string;
|
28 | content: string;
|
29 | }>;
|
30 | };
|
31 | }
|
32 | export interface RulesetResponse extends RulesetContent {
|
33 | readonly name: string;
|
34 | readonly createTime: string;
|
35 | }
|
36 | export interface ListRulesetsResponse {
|
37 | readonly rulesets: Array<{
|
38 | name: string;
|
39 | createTime: string;
|
40 | }>;
|
41 | readonly nextPageToken?: string;
|
42 | }
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 | export declare class SecurityRulesApiClient {
|
49 | private readonly app;
|
50 | private readonly httpClient;
|
51 | private projectIdPrefix?;
|
52 | constructor(app: App);
|
53 | getRuleset(name: string): Promise<RulesetResponse>;
|
54 | createRuleset(ruleset: RulesetContent): Promise<RulesetResponse>;
|
55 | deleteRuleset(name: string): Promise<void>;
|
56 | listRulesets(pageSize?: number, pageToken?: string): Promise<ListRulesetsResponse>;
|
57 | getRelease(name: string): Promise<Release>;
|
58 | updateRelease(name: string, rulesetName: string): Promise<Release>;
|
59 | private getUrl;
|
60 | private getProjectIdPrefix;
|
61 | /**
|
62 | * Gets the specified resource from the rules API. Resource names must be the short names without project
|
63 | * ID prefix (e.g. `rulesets/ruleset-name`).
|
64 | *
|
65 | * @param {string} name Full qualified name of the resource to get.
|
66 | * @returns {Promise<T>} A promise that fulfills with the resource.
|
67 | */
|
68 | private getResource;
|
69 | private getReleaseDescription;
|
70 | private getRulesetName;
|
71 | private sendRequest;
|
72 | private toFirebaseError;
|
73 | }
|