@origincloud/iam 0.0.0-stage → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +23 -2
  3. package/dist/v1beta1/audit_log.d.ts +136 -0
  4. package/dist/v1beta1/audit_log.d.ts.map +1 -0
  5. package/dist/v1beta1/audit_log.js +77 -0
  6. package/dist/v1beta1/audit_log.js.map +1 -0
  7. package/dist/v1beta1/index.d.ts +7 -0
  8. package/dist/v1beta1/index.d.ts.map +1 -0
  9. package/dist/v1beta1/index.js +8 -0
  10. package/dist/v1beta1/index.js.map +1 -0
  11. package/dist/v1beta1/permission.d.ts +92 -0
  12. package/dist/v1beta1/permission.d.ts.map +1 -0
  13. package/dist/v1beta1/permission.js +63 -0
  14. package/dist/v1beta1/permission.js.map +1 -0
  15. package/dist/v1beta1/role.d.ts +55 -0
  16. package/dist/v1beta1/role.d.ts.map +1 -0
  17. package/dist/v1beta1/role.js +42 -0
  18. package/dist/v1beta1/role.js.map +1 -0
  19. package/dist/v1beta1/role_binding.d.ts +172 -0
  20. package/dist/v1beta1/role_binding.d.ts.map +1 -0
  21. package/dist/v1beta1/role_binding.js +118 -0
  22. package/dist/v1beta1/role_binding.js.map +1 -0
  23. package/dist/v1beta1/service_account.d.ts +146 -0
  24. package/dist/v1beta1/service_account.d.ts.map +1 -0
  25. package/dist/v1beta1/service_account.js +106 -0
  26. package/dist/v1beta1/service_account.js.map +1 -0
  27. package/dist/v1beta1/user.d.ts +50 -0
  28. package/dist/v1beta1/user.d.ts.map +1 -0
  29. package/dist/v1beta1/user.js +36 -0
  30. package/dist/v1beta1/user.js.map +1 -0
  31. package/package.json +40 -4
  32. package/src/v1beta1/audit_log.ts +180 -0
  33. package/src/v1beta1/index.ts +8 -0
  34. package/src/v1beta1/permission.ts +138 -0
  35. package/src/v1beta1/role.ts +87 -0
  36. package/src/v1beta1/role_binding.ts +251 -0
  37. package/src/v1beta1/service_account.ts +225 -0
  38. package/src/v1beta1/user.ts +70 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service_account.js","sourceRoot":"","sources":["../../src/v1beta1/service_account.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,50 @@
1
+ import { type CallOptions, type Client, type Service } from "@origincloud/core";
2
+ /**
3
+ * Calls UserService.
4
+ *
5
+ * The signed-in user. Each user can read only their own profile, by the
6
+ * name `users/me` or by their own id; the role bindings they hold are
7
+ * listed by ListRoleBindings with the parent `organizations/-`.
8
+ */
9
+ export declare class UserClient {
10
+ /**
11
+ * The endpoint the client sends its calls to, which also serves the
12
+ * operations its methods answer with.
13
+ */
14
+ readonly service: Service;
15
+ /** A client of UserService that sends its calls through `client`. */
16
+ constructor(client: Client);
17
+ /**
18
+ * Returns the caller's own profile. Any other user is `NOT_FOUND`; a
19
+ * service account caller is refused with `BAD_REQUEST`, having no
20
+ * profile.
21
+ */
22
+ getUser(request: GetUserRequest, options?: CallOptions): Promise<User>;
23
+ }
24
+ /** A person who signs in to the platform. */
25
+ export interface User {
26
+ /**
27
+ * The user's resource name, `users/{user}`, with their id; never
28
+ * `users/me`.
29
+ */
30
+ name?: string;
31
+ /**
32
+ * How a role binding shows the user: `user:{email}` once `email` is
33
+ * verified, `userId:{user}` until then.
34
+ */
35
+ member?: string;
36
+ /** The email address the user signs in with. */
37
+ email?: string;
38
+ /** Whether the user has confirmed `email`. */
39
+ emailVerified?: boolean;
40
+ /** The user's given name; empty when they haven't set one. */
41
+ givenName?: string;
42
+ /** The user's family name; empty when they haven't set one. */
43
+ familyName?: string;
44
+ }
45
+ /** The request for GetUser. */
46
+ export interface GetUserRequest {
47
+ /** The user to return: `users/me`, or the caller's own `users/{user}`. */
48
+ name?: string;
49
+ }
50
+ //# sourceMappingURL=user.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/v1beta1/user.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAoB,MAAM,mBAAmB,CAAC;AAElG;;;;;;GAMG;AACH,qBAAa,UAAU;IACrB;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B,qEAAqE;gBACzD,MAAM,EAAE,MAAM;IAI1B;;;;OAIG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAY7E;AAED,6CAA6C;AAC7C,MAAM,WAAW,IAAI;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,+BAA+B;AAC/B,MAAM,WAAW,cAAc;IAC7B,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,36 @@
1
+ // Code generated by the SDK's generator (generator/). DO NOT EDIT.
2
+ // source: origincloud/iam/v1beta1/user.proto
3
+ import { pathValue, query } from "@origincloud/core";
4
+ /**
5
+ * Calls UserService.
6
+ *
7
+ * The signed-in user. Each user can read only their own profile, by the
8
+ * name `users/me` or by their own id; the role bindings they hold are
9
+ * listed by ListRoleBindings with the parent `organizations/-`.
10
+ */
11
+ export class UserClient {
12
+ /**
13
+ * The endpoint the client sends its calls to, which also serves the
14
+ * operations its methods answer with.
15
+ */
16
+ service;
17
+ /** A client of UserService that sends its calls through `client`. */
18
+ constructor(client) {
19
+ this.service = client.service("iam", false);
20
+ }
21
+ /**
22
+ * Returns the caller's own profile. Any other user is `NOT_FOUND`; a
23
+ * service account caller is refused with `BAD_REQUEST`, having no
24
+ * profile.
25
+ */
26
+ async getUser(request, options) {
27
+ const p0 = pathValue("name", request.name, "users/*");
28
+ return this.service.call({
29
+ method: "GET",
30
+ path: `/v1beta1/${p0}`,
31
+ query: query(request, ["name"]),
32
+ idempotent: true,
33
+ }, options);
34
+ }
35
+ }
36
+ //# sourceMappingURL=user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.js","sourceRoot":"","sources":["../../src/v1beta1/user.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,6CAA6C;AAE7C,OAAO,EAA+C,SAAS,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAElG;;;;;;GAMG;AACH,MAAM,OAAO,UAAU;IACrB;;;OAGG;IACM,OAAO,CAAU;IAE1B,qEAAqE;IACrE,YAAY,MAAc;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,OAAuB,EAAE,OAAqB;QAC1D,MAAM,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,YAAY,EAAE,EAAE;YACtB,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC;YAC/B,UAAU,EAAE,IAAI;SACjB,EACD,OAAO,CACR,CAAC;IACJ,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,42 @@
1
1
  {
2
2
  "name": "@origincloud/iam",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.6.0",
4
+ "description": "Origin Cloud's IAM service: users, service accounts, roles, role bindings, permissions and the audit log.",
5
+ "license": "Apache-2.0",
6
+ "homepage": "https://github.com/origincloudhq/sdk-typescript#readme",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/origincloudhq/sdk-typescript.git",
10
+ "directory": "packages/iam"
11
+ },
12
+ "bugs": "https://github.com/origincloudhq/sdk-typescript/issues",
13
+ "keywords": [
14
+ "origincloud",
15
+ "origin-cloud",
16
+ "sdk",
17
+ "iam"
18
+ ],
19
+ "type": "module",
20
+ "sideEffects": false,
21
+ "engines": {
22
+ "node": ">=20"
23
+ },
24
+ "exports": {
25
+ "./*": {
26
+ "types": "./dist/*/index.d.ts",
27
+ "default": "./dist/*/index.js"
28
+ },
29
+ "./package.json": "./package.json"
30
+ },
31
+ "files": [
32
+ "dist",
33
+ "src",
34
+ "!dist/**/*.tsbuildinfo"
35
+ ],
36
+ "peerDependencies": {
37
+ "@origincloud/core": "^0.6.0"
38
+ },
39
+ "devDependencies": {
40
+ "@origincloud/core": "^0.6.0"
41
+ }
42
+ }
@@ -0,0 +1,180 @@
1
+ // Code generated by the SDK's generator (generator/). DO NOT EDIT.
2
+ // source: origincloud/iam/v1beta1/audit_log.proto
3
+
4
+ import { type CallOptions, type Client, type Service, pathValue, query } from "@origincloud/core";
5
+
6
+ /**
7
+ * Calls AuditLogService.
8
+ *
9
+ * An organization's audit log: a record of each change to who may do what
10
+ * in it, written when the change is made and never changed afterwards.
11
+ * It records role bindings created and deleted, members removed, invites
12
+ * created and deleted, and service accounts created and deleted.
13
+ *
14
+ * This API serves a recent window of the log, 90 days unless the platform
15
+ * sets it longer: a list says where its window starts in
16
+ * `windowStartTime`, and an older entry is `NOT_FOUND` here.
17
+ */
18
+ export class AuditLogClient {
19
+ /**
20
+ * The endpoint the client sends its calls to, which also serves the
21
+ * operations its methods answer with.
22
+ */
23
+ readonly service: Service;
24
+
25
+ /** A client of AuditLogService that sends its calls through `client`. */
26
+ constructor(client: Client) {
27
+ this.service = client.service("iam", false);
28
+ }
29
+
30
+ /**
31
+ * Returns an audit log entry. Needs `iam.audit_log.list` on the
32
+ * organization.
33
+ */
34
+ async getAuditLogEntry(request: GetAuditLogEntryRequest, options?: CallOptions): Promise<AuditLogEntry> {
35
+ const p0 = pathValue("name", request.name, "organizations/*/auditLogEntries/*");
36
+ return this.service.call<AuditLogEntry>(
37
+ {
38
+ method: "GET",
39
+ path: `/v1beta1/${p0}`,
40
+ query: query(request, ["name"]),
41
+ idempotent: true,
42
+ },
43
+ options,
44
+ );
45
+ }
46
+
47
+ /**
48
+ * Lists an organization's audit log entries, most recent first,
49
+ * optionally only a project's, an actor's or an action's. Needs
50
+ * `iam.audit_log.list` on the organization.
51
+ */
52
+ async listAuditLogEntries(request: ListAuditLogEntriesRequest, options?: CallOptions): Promise<ListAuditLogEntriesResponse> {
53
+ const p0 = pathValue("parent", request.parent, "organizations/*");
54
+ return this.service.call<ListAuditLogEntriesResponse>(
55
+ {
56
+ method: "GET",
57
+ path: `/v1beta1/${p0}/auditLogEntries`,
58
+ query: query(request, ["parent"]),
59
+ idempotent: true,
60
+ },
61
+ options,
62
+ );
63
+ }
64
+
65
+ /**
66
+ * Iterates over everything listAuditLogEntries lists from the request's page on,
67
+ * fetching the next page as the loop reaches it. A page that fails ends
68
+ * the iteration with its error.
69
+ */
70
+ async *allAuditLogEntries(request: ListAuditLogEntriesRequest, options?: CallOptions): AsyncGenerator<AuditLogEntry, void, undefined> {
71
+ for (let page = request; ; ) {
72
+ const response = await this.listAuditLogEntries(page, options);
73
+ yield* response.auditLogEntries ?? [];
74
+ if (!response.nextPageToken) return;
75
+ page = { ...page, pageToken: response.nextPageToken };
76
+ }
77
+ }
78
+ }
79
+
80
+ /** One recorded change. */
81
+ export interface AuditLogEntry {
82
+ /** The entry's resource name. */
83
+ name?: string;
84
+ /**
85
+ * The project the change was limited to, `projects/{project}`; empty for
86
+ * a change to the whole organization.
87
+ */
88
+ project?: string;
89
+ /**
90
+ * Who made the change, as it was when the change was made:
91
+ * `user:{email}` with the verified address the account had then,
92
+ * `userId:{user}` when none was recorded, `serviceAccount:{service_account}`,
93
+ * or `platform` for a change the platform made itself. A later change of
94
+ * address doesn't change it.
95
+ */
96
+ actor?: string;
97
+ /**
98
+ * What was done, as a permission key names it, such as
99
+ * `iam.role.assign`.
100
+ */
101
+ action?: string;
102
+ /**
103
+ * What it was done to, written as `actor` is, or the email address
104
+ * invited; empty when the action has no target.
105
+ */
106
+ target?: string;
107
+ /** Whether the change was made. */
108
+ outcome?: AuditLogEntry_Outcome;
109
+ /** When the change was made. */
110
+ occurTime?: string;
111
+ /**
112
+ * Details of the change that depend on the action, such as the `role`
113
+ * granted or a service account's `displayName`.
114
+ */
115
+ details?: Record<string, string>;
116
+ }
117
+
118
+ /** Whether the change was made. */
119
+ export const AuditLogEntry_Outcome = {
120
+ /** Not set. */
121
+ OUTCOME_UNSPECIFIED: "OUTCOME_UNSPECIFIED",
122
+ /** It was made. */
123
+ SUCCEEDED: "SUCCEEDED",
124
+ /** It was refused for lack of a permission. */
125
+ DENIED: "DENIED",
126
+ } as const;
127
+
128
+ /** Whether the change was made. */
129
+ export type AuditLogEntry_Outcome = (typeof AuditLogEntry_Outcome)[keyof typeof AuditLogEntry_Outcome];
130
+
131
+ /** The request for GetAuditLogEntry. */
132
+ export interface GetAuditLogEntryRequest {
133
+ /** The entry to return. */
134
+ name?: string;
135
+ }
136
+
137
+ /** The request for ListAuditLogEntries. */
138
+ export interface ListAuditLogEntriesRequest {
139
+ /**
140
+ * The organization whose audit log to list,
141
+ * `organizations/{organization}`.
142
+ */
143
+ parent?: string;
144
+ /**
145
+ * Only the entries of changes limited to this project,
146
+ * `projects/{project}`. Every entry when empty.
147
+ */
148
+ project?: string;
149
+ /**
150
+ * Only the entries of changes made by this member's account,
151
+ * `user:{email}` or `serviceAccount:{service_account}`. Every actor's
152
+ * when empty.
153
+ */
154
+ actor?: string;
155
+ /**
156
+ * Only the entries of this action, such as `iam.role.assign`. Every
157
+ * action's when empty.
158
+ */
159
+ action?: string;
160
+ /**
161
+ * The most entries to return; the server clamps it, and 0 means its
162
+ * default.
163
+ */
164
+ pageSize?: number;
165
+ /** A previous response's `nextPageToken`, for the page after it. */
166
+ pageToken?: string;
167
+ }
168
+
169
+ /** The response for ListAuditLogEntries. */
170
+ export interface ListAuditLogEntriesResponse {
171
+ /** The entries on this page, most recent first. */
172
+ auditLogEntries?: AuditLogEntry[];
173
+ /** The token for the next page; empty on the last one. */
174
+ nextPageToken?: string;
175
+ /**
176
+ * Where the window this API serves starts: entries older than it aren't
177
+ * listed.
178
+ */
179
+ windowStartTime?: string;
180
+ }
@@ -0,0 +1,8 @@
1
+ // Code generated by the SDK's generator (generator/). DO NOT EDIT.
2
+
3
+ export * from "./audit_log.js";
4
+ export * from "./permission.js";
5
+ export * from "./role.js";
6
+ export * from "./role_binding.js";
7
+ export * from "./service_account.js";
8
+ export * from "./user.js";
@@ -0,0 +1,138 @@
1
+ // Code generated by the SDK's generator (generator/). DO NOT EDIT.
2
+ // source: origincloud/iam/v1beta1/permission.proto
3
+
4
+ import { type CallOptions, type Client, type Service, pathValue, query } from "@origincloud/core";
5
+
6
+ /**
7
+ * Calls PermissionService.
8
+ *
9
+ * The catalog of permissions, and which of them a caller holds. A
10
+ * permission allows one action on one kind of resource, such as
11
+ * `pvs.volume.create`; roles bundle them. Reading the catalog needs no
12
+ * permission.
13
+ */
14
+ export class PermissionClient {
15
+ /**
16
+ * The endpoint the client sends its calls to, which also serves the
17
+ * operations its methods answer with.
18
+ */
19
+ readonly service: Service;
20
+
21
+ /** A client of PermissionService that sends its calls through `client`. */
22
+ constructor(client: Client) {
23
+ this.service = client.service("iam", false);
24
+ }
25
+
26
+ /** Returns a permission. */
27
+ async getPermission(request: GetPermissionRequest, options?: CallOptions): Promise<Permission> {
28
+ const p0 = pathValue("name", request.name, "permissions/*");
29
+ return this.service.call<Permission>(
30
+ {
31
+ method: "GET",
32
+ path: `/v1beta1/${p0}`,
33
+ query: query(request, ["name"]),
34
+ idempotent: true,
35
+ },
36
+ options,
37
+ );
38
+ }
39
+
40
+ /**
41
+ * Lists every permission the platform checks, in catalog order,
42
+ * including those no predefined role grants by default, such as the
43
+ * billing account permissions.
44
+ */
45
+ async listPermissions(request: ListPermissionsRequest, options?: CallOptions): Promise<ListPermissionsResponse> {
46
+ return this.service.call<ListPermissionsResponse>(
47
+ {
48
+ method: "GET",
49
+ path: `/v1beta1/permissions`,
50
+ query: query(request, []),
51
+ idempotent: true,
52
+ },
53
+ options,
54
+ );
55
+ }
56
+
57
+ /**
58
+ * Returns the subset of `permissions` the caller holds on an organization
59
+ * or a project. A permission held on the organization counts for each of
60
+ * its projects; one held on a project counts only there. Every resource
61
+ * in a project is governed by the project's permissions, so asking about
62
+ * the project answers for each of its resources. A permission the
63
+ * catalog doesn't name is never held.
64
+ */
65
+ async testIamPermissions(request: TestIamPermissionsRequest, options?: CallOptions): Promise<TestIamPermissionsResponse> {
66
+ const p0 = pathValue("resource", request.resource, "*/*");
67
+ return this.service.call<TestIamPermissionsResponse>(
68
+ {
69
+ method: "POST",
70
+ path: `/v1beta1/${p0}:testIamPermissions`,
71
+ body: request,
72
+ idempotent: true,
73
+ },
74
+ options,
75
+ );
76
+ }
77
+ }
78
+
79
+ /** One action on one kind of resource, which a role grants. */
80
+ export interface Permission {
81
+ /**
82
+ * The permission's resource name, `permissions/{service}.{resource}.{action}`,
83
+ * such as `permissions/pvs.volume.create`.
84
+ */
85
+ name?: string;
86
+ /**
87
+ * The permission's URN, the identifier access policies and the audit log
88
+ * use.
89
+ */
90
+ urn?: string;
91
+ /** The service whose API checks it, such as `pvs`. */
92
+ service?: string;
93
+ /** The kind of resource it applies to, such as `volume`. */
94
+ resourceType?: string;
95
+ /** The action it allows, such as `create`. */
96
+ action?: string;
97
+ }
98
+
99
+ /** The request for GetPermission. */
100
+ export interface GetPermissionRequest {
101
+ /** The permission to return, `permissions/{permission}`. */
102
+ name?: string;
103
+ }
104
+
105
+ /**
106
+ * The request for ListPermissions. The catalog is bounded, so it comes in
107
+ * one page.
108
+ */
109
+ export interface ListPermissionsRequest {}
110
+
111
+ /** The response for ListPermissions. */
112
+ export interface ListPermissionsResponse {
113
+ /** Every permission, in catalog order. */
114
+ permissions?: Permission[];
115
+ }
116
+
117
+ /** The request for TestIamPermissions. */
118
+ export interface TestIamPermissionsRequest {
119
+ /**
120
+ * The organization, `organizations/{organization}`, or the project,
121
+ * `projects/{project}`, to test the permissions on.
122
+ */
123
+ resource?: string;
124
+ /**
125
+ * The permissions to test, by their keys, such as `pvs.volume.create`;
126
+ * at most 100.
127
+ */
128
+ permissions?: string[];
129
+ }
130
+
131
+ /** The response for TestIamPermissions. */
132
+ export interface TestIamPermissionsResponse {
133
+ /**
134
+ * The permissions of the request the caller holds on the resource, in the
135
+ * order they were asked for.
136
+ */
137
+ permissions?: string[];
138
+ }
@@ -0,0 +1,87 @@
1
+ // Code generated by the SDK's generator (generator/). DO NOT EDIT.
2
+ // source: origincloud/iam/v1beta1/role.proto
3
+
4
+ import { type CallOptions, type Client, type Service, pathValue, query } from "@origincloud/core";
5
+
6
+ /**
7
+ * Calls RoleService.
8
+ *
9
+ * The catalog of predefined roles. A role is a named set of permissions; a
10
+ * role binding grants one to a principal in an organization or in one of
11
+ * its projects. The same for every caller: any authenticated caller can
12
+ * read it, and no permission is needed.
13
+ */
14
+ export class RoleClient {
15
+ /**
16
+ * The endpoint the client sends its calls to, which also serves the
17
+ * operations its methods answer with.
18
+ */
19
+ readonly service: Service;
20
+
21
+ /** A client of RoleService that sends its calls through `client`. */
22
+ constructor(client: Client) {
23
+ this.service = client.service("iam", false);
24
+ }
25
+
26
+ /** Returns a role. */
27
+ async getRole(request: GetRoleRequest, options?: CallOptions): Promise<Role> {
28
+ const p0 = pathValue("name", request.name, "roles/*");
29
+ return this.service.call<Role>(
30
+ {
31
+ method: "GET",
32
+ path: `/v1beta1/${p0}`,
33
+ query: query(request, ["name"]),
34
+ idempotent: true,
35
+ },
36
+ options,
37
+ );
38
+ }
39
+
40
+ /** Lists every predefined role, in catalog order. */
41
+ async listRoles(request: ListRolesRequest, options?: CallOptions): Promise<ListRolesResponse> {
42
+ return this.service.call<ListRolesResponse>(
43
+ {
44
+ method: "GET",
45
+ path: `/v1beta1/roles`,
46
+ query: query(request, []),
47
+ idempotent: true,
48
+ },
49
+ options,
50
+ );
51
+ }
52
+ }
53
+
54
+ /** A predefined role: a named set of permissions that a role binding grants. */
55
+ export interface Role {
56
+ /**
57
+ * The role's resource name, such as `roles/owner`, `roles/viewer` or
58
+ * `roles/billing.administrator`. A role binding names its role by it.
59
+ */
60
+ name?: string;
61
+ /** The role's URN, the identifier access policies and the audit log use. */
62
+ urn?: string;
63
+ /** The name the console shows, such as `Owner`. */
64
+ displayName?: string;
65
+ /** What holding the role allows, in a sentence. */
66
+ description?: string;
67
+ /**
68
+ * The permissions the role grants, `permissions/{permission}`, in
69
+ * catalog order.
70
+ */
71
+ includedPermissions?: string[];
72
+ }
73
+
74
+ /** The request for GetRole. */
75
+ export interface GetRoleRequest {
76
+ /** The role to return, `roles/{role}`. */
77
+ name?: string;
78
+ }
79
+
80
+ /** The request for ListRoles. The catalog is small, so it comes in one page. */
81
+ export interface ListRolesRequest {}
82
+
83
+ /** The response for ListRoles. */
84
+ export interface ListRolesResponse {
85
+ /** Every predefined role, in catalog order. */
86
+ roles?: Role[];
87
+ }